本文整理汇总了C++中GeoDataLatLonAltBox::setNorth方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoDataLatLonAltBox::setNorth方法的具体用法?C++ GeoDataLatLonAltBox::setNorth怎么用?C++ GeoDataLatLonAltBox::setNorth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoDataLatLonAltBox
的用法示例。
在下文中一共展示了GeoDataLatLonAltBox::setNorth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: latLonAltBox
GeoDataLatLonAltBox EquirectProjection::latLonAltBox( const QRect& screenRect,
const ViewportParams *viewport ) const
{
qreal west;
qreal north = 90*DEG2RAD;
geoCoordinates( screenRect.left(), screenRect.top(), viewport, west, north, GeoDataCoordinates::Radian );
qreal east;
qreal south = -90*DEG2RAD;
geoCoordinates( screenRect.right(), screenRect.bottom(), viewport, east, south, GeoDataCoordinates::Radian );
// For the case where the whole viewport gets covered there is a
// pretty dirty and generic detection algorithm:
GeoDataLatLonAltBox latLonAltBox;
latLonAltBox.setNorth( north, GeoDataCoordinates::Radian );
latLonAltBox.setSouth( south, GeoDataCoordinates::Radian );
latLonAltBox.setWest( west, GeoDataCoordinates::Radian );
latLonAltBox.setEast( east, GeoDataCoordinates::Radian );
latLonAltBox.setMinAltitude( -100000000.0 );
latLonAltBox.setMaxAltitude( 100000000000000.0 );
// Convenience variables
int radius = viewport->radius();
int width = viewport->width();
// The remaining algorithm should be pretty generic for all kinds of
// flat projections:
int xRepeatDistance = 4 * radius;
if ( width >= xRepeatDistance ) {
latLonAltBox.setWest( -M_PI );
latLonAltBox.setEast( +M_PI );
}
// Now we need to check whether maxLat (e.g. the north pole) gets displayed
// inside the viewport.
// We need a point on the screen at maxLat that definitely gets displayed:
qreal averageLongitude = latLonAltBox.east();
GeoDataCoordinates maxLatPoint( averageLongitude, maxLat(), 0.0, GeoDataCoordinates::Radian );
GeoDataCoordinates minLatPoint( averageLongitude, minLat(), 0.0, GeoDataCoordinates::Radian );
qreal dummyX, dummyY; // not needed
if ( screenCoordinates( maxLatPoint, viewport, dummyX, dummyY ) ) {
latLonAltBox.setEast( +M_PI );
latLonAltBox.setWest( -M_PI );
}
if ( screenCoordinates( minLatPoint, viewport, dummyX, dummyY ) ) {
latLonAltBox.setEast( +M_PI );
latLonAltBox.setWest( -M_PI );
}
return latLonAltBox;
}