QVector<TileCoordsPyramid> DownloadRegionDialog::region() const { if ( !d->hasTextureLayer() ) { return QVector<TileCoordsPyramid>(); } d->m_downloadRegion.setTileLevelRange( d->m_tileLevelRangeWidget->topLevel(), d->m_tileLevelRangeWidget->bottomLevel() ); d->m_downloadRegion.setVisibleTileLevel( d->m_visibleTileLevel ); // check whether "visible region" or "lat/lon region" is selection method GeoDataLatLonAltBox downloadRegion; switch ( d->m_selectionMethod ) { case VisibleRegionMethod: downloadRegion = d->m_visibleRegion; break; case SpecifiedRegionMethod: downloadRegion = GeoDataLatLonAltBox( d->m_latLonBoxWidget->latLonBox(), 0, 0 ); break; case RouteDownloadMethod: qreal offset = d->m_routeOffsetSpinBox->value(); if( d->m_routeOffsetSpinBox->suffix() == " km") { offset *= KM2METER; } const GeoDataLineString waypoints = d->m_model->routingManager()->routingModel()->route().path(); return d->m_downloadRegion.fromPath( d->m_textureLayer, offset, waypoints ); break; } return d->m_downloadRegion.region( d->m_textureLayer, downloadRegion ); }
GeoDataPoint::GeoDataPoint( const GeoDataCoordinates& other ) : GeoDataGeometry ( new GeoDataPointPrivate ) { Q_D(GeoDataPoint); d->m_coordinates = other; d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates); }
void GeoDataPoint::setCoordinates( const GeoDataCoordinates &coordinates ) { detach(); Q_D(GeoDataPoint); d->m_coordinates = coordinates; d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates); }
GeoDataPoint::GeoDataPoint( qreal lon, qreal lat, qreal alt, GeoDataCoordinates::Unit unit ) : GeoDataGeometry( new GeoDataPointPrivate ) { Q_D(GeoDataPoint); d->m_coordinates = GeoDataCoordinates(lon, lat, alt, unit); d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates); }
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; }