本文整理汇总了C++中GeoDataLatLonAltBox::setMinAltitude方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoDataLatLonAltBox::setMinAltitude方法的具体用法?C++ GeoDataLatLonAltBox::setMinAltitude怎么用?C++ GeoDataLatLonAltBox::setMinAltitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoDataLatLonAltBox
的用法示例。
在下文中一共展示了GeoDataLatLonAltBox::setMinAltitude方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testAltitude
void TestGeoDataLatLonAltBox::testAltitude()
{
QFETCH(qreal, alt);
GeoDataLatLonAltBox box;
box.setMinAltitude(alt);
QCOMPARE(box.minAltitude(), alt);
box.setMaxAltitude(alt);
QCOMPARE(box.maxAltitude(), alt);
}
示例2: fromLineString
GeoDataLatLonAltBox GeoDataLatLonAltBox::fromLineString( const GeoDataLineString& lineString )
{
// If the line string is empty return a boundingbox that contains everything
if ( lineString.size() == 0 ) {
return GeoDataLatLonAltBox();
}
const qreal altitude = lineString.first().altitude();
GeoDataLatLonAltBox temp ( GeoDataLatLonBox::fromLineString( lineString ), altitude, altitude );
qreal maxAltitude = altitude;
qreal minAltitude = altitude;
// If there's only a single node stored then the boundingbox only contains that point
if ( lineString.size() == 1 ) {
temp.setMinAltitude( minAltitude );
temp.setMaxAltitude( maxAltitude );
return temp;
}
QVector<GeoDataCoordinates>::ConstIterator it( lineString.constBegin() );
QVector<GeoDataCoordinates>::ConstIterator itEnd( lineString.constEnd() );
for ( ; it != itEnd; ++it )
{
// Get coordinates and normalize them to the desired range.
const qreal altitude = (it)->altitude();
// Determining the maximum and minimum latitude
if ( altitude > maxAltitude ) maxAltitude = altitude;
if ( altitude < minAltitude ) minAltitude = altitude;
}
temp.setMinAltitude( minAltitude );
temp.setMaxAltitude( maxAltitude );
return temp;
}