23 #include <QAbstractItemModel>
26 #include <QItemSelectionModel>
27 #include <QSizePolicy>
31 #include <QDBusConnection>
90 virtual QStringList renderPosition()
const {
return QStringList() <<
"USER_TOOLS"; }
92 virtual bool render( GeoPainter *painter, ViewportParams *
viewport,
93 const QString &renderPos, GeoSceneLayer *layer )
96 Q_UNUSED( renderPos );
99 m_map->customPaint( painter );
104 virtual qreal zValue()
const {
return 1.0e6; }
106 virtual QString runtimeTrace()
const {
return "CustomPaint"; }
113 class MarbleMapPrivate
118 explicit MarbleMapPrivate( MarbleMap *parent, MarbleModel *
model );
120 void updateMapTheme();
122 void updateProperty(
const QString &,
bool );
124 void setDocument( QString key );
129 MarbleModel *
const m_model;
133 ViewParams m_viewParams;
134 ViewportParams m_viewport;
135 bool m_showFrameRate;
137 VectorComposer m_veccomposer;
139 LayerManager m_layerManager;
140 MarbleSplashLayer m_marbleSplashLayer;
142 GeometryLayer m_geometryLayer;
144 GroundLayer m_groundLayer;
145 VectorMapBaseLayer m_vectorMapBaseLayer;
146 VectorMapLayer m_vectorMapLayer;
147 TextureLayer m_textureLayer;
148 PlacemarkLayer m_placemarkLayer;
149 VectorTileLayer m_vectorTileLayer;
151 bool m_isLockedToSubSolarPoint;
152 bool m_isSubSolarPointIconVisible;
155 MarbleMapPrivate::MarbleMapPrivate( MarbleMap *parent, MarbleModel *
model ) :
159 m_showFrameRate( false ),
161 m_layerManager( model, parent ),
162 m_customPaintLayer( parent ),
163 m_geometryLayer( model->treeModel() ),
164 m_vectorMapBaseLayer( &m_veccomposer ),
165 m_vectorMapLayer( &m_veccomposer ),
166 m_textureLayer( model->downloadManager(), model->sunLocator(), &m_veccomposer, model->pluginManager(), model->groundOverlayModel() ),
167 m_placemarkLayer( model->placemarkModel(), model->placemarkSelectionModel(), model->clock() ),
168 m_vectorTileLayer( model->downloadManager(), model->pluginManager(), model->treeModel() ),
169 m_isLockedToSubSolarPoint( false ),
170 m_isSubSolarPointIconVisible( false )
172 m_layerManager.addLayer( &m_fogLayer );
173 m_layerManager.addLayer( &m_groundLayer );
174 m_layerManager.addLayer( &m_geometryLayer );
175 m_layerManager.addLayer( &m_placemarkLayer );
176 m_layerManager.addLayer( &m_customPaintLayer );
178 QObject::connect( m_model, SIGNAL(themeChanged(QString)),
179 parent, SLOT(updateMapTheme()) );
180 QObject::connect( m_model->fileManager(), SIGNAL(fileAdded(QString)),
181 parent, SLOT(setDocument(QString)) );
183 QObject::connect( &m_veccomposer, SIGNAL(datasetLoaded()),
184 parent, SIGNAL(repaintNeeded()));
186 QObject::connect( &m_placemarkLayer, SIGNAL(repaintNeeded()),
187 parent, SIGNAL(repaintNeeded()));
189 QObject::connect ( &m_layerManager, SIGNAL(pluginSettingsChanged()),
190 parent, SIGNAL(pluginSettingsChanged()) );
191 QObject::connect ( &m_layerManager, SIGNAL(repaintNeeded(QRegion)),
192 parent, SIGNAL(repaintNeeded(QRegion)) );
193 QObject::connect ( &m_layerManager, SIGNAL(renderPluginInitialized(RenderPlugin*)),
194 parent, SIGNAL(renderPluginInitialized(RenderPlugin*)) );
195 QObject::connect ( &m_layerManager, SIGNAL(visibilityChanged(QString,
bool)),
196 parent, SLOT(setPropertyValue(QString,
bool)) );
198 QObject::connect( &m_geometryLayer, SIGNAL(repaintNeeded()),
199 parent, SIGNAL(repaintNeeded()));
201 QObject::connect( &m_textureLayer, SIGNAL(tileLevelChanged(
int)),
202 parent, SIGNAL(tileLevelChanged(
int)) );
203 QObject::connect( &m_textureLayer, SIGNAL(repaintNeeded()),
204 parent, SIGNAL(repaintNeeded()) );
207 parent, SIGNAL(repaintNeeded()) );
210 void MarbleMapPrivate::updateProperty(
const QString &name,
bool show )
213 if ( name ==
"places" ) {
214 m_placemarkLayer.setShowPlaces( show );
215 }
else if ( name ==
"cities" ) {
216 m_placemarkLayer.setShowCities( show );
217 }
else if ( name ==
"terrain" ) {
218 m_placemarkLayer.setShowTerrain( show );
219 }
else if ( name ==
"otherplaces" ) {
220 m_placemarkLayer.setShowOtherPlaces( show );
224 else if ( name ==
"landingsites" ) {
225 m_placemarkLayer.setShowLandingSites( show );
226 }
else if ( name ==
"craters" ) {
227 m_placemarkLayer.setShowCraters( show );
228 }
else if ( name ==
"maria" ) {
229 m_placemarkLayer.setShowMaria( show );
232 else if ( name ==
"waterbodies" ) {
233 m_veccomposer.setShowWaterBodies( show );
234 }
else if ( name ==
"lakes" ) {
235 m_veccomposer.setShowLakes( show );
236 }
else if ( name ==
"ice" ) {
237 m_veccomposer.setShowIce( show );
238 }
else if ( name ==
"coastlines" ) {
239 m_veccomposer.setShowCoastLines( show );
240 }
else if ( name ==
"rivers" ) {
241 m_veccomposer.setShowRivers( show );
242 }
else if ( name ==
"borders" ) {
243 m_veccomposer.setShowBorders( show );
246 else if ( name ==
"relief" ) {
247 m_textureLayer.setShowRelief( show );
250 m_layerManager.setVisible( name, show );
257 : d( new MarbleMapPrivate( this, new
MarbleModel( this ) ) )
260 QDBusConnection::sessionBus().registerObject(
"/MarbleMap",
this,
261 QDBusConnection::ExportAllSlots
262 | QDBusConnection::ExportAllSignals
263 | QDBusConnection::ExportAllProperties );
268 : d( new MarbleMapPrivate( this, model ) )
271 QDBusConnection::sessionBus().registerObject(
"/MarbleMap",
this,
272 QDBusConnection::ExportAllSlots
273 | QDBusConnection::ExportAllSignals
274 | QDBusConnection::ExportAllProperties );
277 d->m_modelIsOwned =
false;
282 MarbleModel *model = d->m_modelIsOwned ? d->m_model : 0;
284 d->m_layerManager.removeLayer( &d->m_customPaintLayer );
285 d->m_layerManager.removeLayer( &d->m_geometryLayer );
286 d->m_layerManager.removeLayer( &d->m_fogLayer );
287 d->m_layerManager.removeLayer( &d->m_placemarkLayer );
288 d->m_layerManager.removeLayer( &d->m_textureLayer );
289 d->m_layerManager.removeLayer( &d->m_groundLayer );
290 d->m_layerManager.removeLayer( &d->m_vectorMapLayer );
291 d->m_layerManager.removeLayer( &d->m_vectorMapBaseLayer );
304 return &d->m_viewport;
309 return &d->m_viewport;
315 d->m_viewParams.setMapQualityForViewContext( quality, viewContext );
318 d->m_textureLayer.setNeedsUpdate();
323 return d->m_viewParams.mapQuality( viewContext );
328 return d->m_viewParams.mapQuality();
333 const MapQuality oldQuality = d->m_viewParams.mapQuality();
335 d->m_viewParams.setViewContext( viewContext );
337 if ( d->m_viewParams.mapQuality() != oldQuality ) {
339 d->m_textureLayer.setNeedsUpdate();
347 return d->m_viewParams.viewContext();
353 setSize( QSize( width, height ) );
358 d->m_viewport.setSize( size );
365 return QSize( d->m_viewport.width(), d->m_viewport.height() );
370 return d->m_viewport.width();
375 return d->m_viewport.height();
380 return d->m_viewport.radius();
385 const int oldRadius = d->m_viewport.radius();
387 d->m_viewport.setRadius( radius );
389 if ( oldRadius != d->m_viewport.radius() ) {
398 if ( !d->m_layerManager.internalLayers().contains( &d->m_textureLayer ) )
401 return d->m_textureLayer.preferredRadiusCeil( radius );
407 if ( !d->m_layerManager.internalLayers().contains( &d->m_textureLayer ) )
410 return d->m_textureLayer.preferredRadiusFloor( radius );
416 return d->m_textureLayer.tileZoomLevel();
423 const qreal centerLat = d->m_viewport.centerLatitude();
431 const qreal centerLon = d->m_viewport.centerLongitude();
438 if ( d->m_model->mapTheme() )
439 return d->m_model->mapTheme()->head()->zoom()->minimum();
446 if ( d->m_model->mapTheme() )
447 return d->m_model->mapTheme()->head()->zoom()->maximum();
454 return d->m_placemarkLayer.whichPlacemarkAt( curpos );
459 d->m_textureLayer.reload();
465 Q_ASSERT( !pyramid.isEmpty() );
479 for (
int level = pyramid[first].bottomLevel(); level >= pyramid[first].topLevel(); --level ) {
480 QSet<TileId> tileIdSet;
481 for(
int i = 0; i < pyramid.size(); ++i ) {
482 QRect
const coords = pyramid[i].coords( level );
483 mDebug() <<
"MarbleMap::downloadRegion level:" << level <<
"tile coords:" << coords;
485 coords.getCoords( &x1, &y1, &x2, &y2 );
486 for (
int x = x1; x <= x2; ++x ) {
487 for (
int y = y1; y <= y2; ++y ) {
488 TileId const stackedTileId( 0, level, x, y );
489 tileIdSet.insert( stackedTileId );
497 QSetIterator<TileId> i( tileIdSet );
498 while( i.hasNext() ) {
499 TileId const tileId = i.next();
500 d->m_textureLayer.downloadStackedTile( tileId );
502 tilesCount += tileIdSet.count();
506 int const elapsedMs = t.elapsed();
507 mDebug() <<
"MarbleMap::downloadRegion:" << tilesCount <<
"tiles, " << elapsedMs <<
"ms";
513 if ( d->m_model->mapTheme() ) {
514 d->m_model->mapTheme()->settings()->propertyValue( name, value );
518 mDebug() <<
"WARNING: Failed to access a map theme! Property: " << name;
545 return d->m_viewParams.showClouds();
550 return d->m_textureLayer.showSunShading();
555 return d->m_textureLayer.showCityLights();
560 return d->m_isLockedToSubSolarPoint;
565 return d->m_isSubSolarPointIconVisible;
570 return d->m_viewParams.showAtmosphere();
575 bool visible =
false;
578 QList<RenderPlugin *>::const_iterator i = pluginList.constBegin();
579 QList<RenderPlugin *>::const_iterator
const end = pluginList.constEnd();
580 for (; i != end; ++i ) {
581 if ( (*i)->nameId() ==
"crosshairs" ) {
582 visible = (*i)->visible();
636 return d->m_showFrameRate;
641 return d->m_layerManager.showBackground();
646 return d->m_textureLayer.volatileCacheLimit();
653 d->m_viewport.centerLatitude() *
RAD2DEG + deltaLat );
659 d->m_viewport.centerOn( lon *
DEG2RAD, lat * DEG2RAD );
676 return d->m_viewport.projection();
681 if ( d->m_viewport.projection() ==
projection )
686 d->m_viewport.setProjection( projection );
688 d->m_textureLayer.setProjection( projection );
695 qreal& x, qreal& y )
const
697 return d->m_viewport.screenCoordinates( lon *
DEG2RAD, lat * DEG2RAD, x, y );
701 qreal& lon, qreal& lat,
704 return d->m_viewport.geoCoordinates( x, y, lon, lat, unit );
707 void MarbleMapPrivate::setDocument( QString key )
709 if ( !m_model->mapTheme() ) {
720 GeoDataDocument* doc = m_model->fileManager()->at( key );
722 foreach (
const GeoSceneLayer *layer, m_model->mapTheme()->map()->layers() ) {
727 foreach (
const GeoSceneAbstractDataset *dataset, layer->datasets() ) {
728 const GeoSceneGeodata *data =
static_cast<const GeoSceneGeodata*
>( dataset );
729 QString containername = data->sourceFile();
730 QString colorize = data->colorize();
731 if( key == containername ) {
732 if( colorize ==
"land" ) {
733 m_textureLayer.addLandDocument( doc );
735 if( colorize ==
"sea" ) {
736 m_textureLayer.addSeaDocument( doc );
740 if( !data->property().isEmpty() ) {
742 m_model->mapTheme()->settings()->propertyValue( data->property(), value );
743 doc->setVisible( value );
744 m_model->treeModel()->updateFeature( doc );
754 Q_UNUSED( dirtyRect );
756 if ( !d->m_model->mapTheme() ) {
757 mDebug() <<
"No theme yet!";
758 d->m_marbleSplashLayer.render( &painter, &d->m_viewport );
765 d->m_layerManager.renderLayers( &painter, &d->m_viewport );
767 if ( d->m_showFrameRate ) {
769 fpsPainter.
paint( &painter );
772 const qreal fps = 1000.0 / (qreal)( t.elapsed() );
783 return d->m_model->mapThemeId();
788 d->m_model->setMapThemeId( mapThemeId );
791 void MarbleMapPrivate::updateMapTheme()
793 m_layerManager.removeLayer( &m_textureLayer );
795 m_vectorTileLayer.reset();
796 m_layerManager.removeLayer( &m_vectorTileLayer );
797 m_layerManager.removeLayer( &m_vectorMapLayer );
798 m_layerManager.removeLayer( &m_vectorMapBaseLayer );
799 m_layerManager.removeLayer( &m_groundLayer );
801 QObject::connect( m_model->mapTheme()->settings(), SIGNAL(valueChanged(QString,
bool)),
802 q, SLOT(updateProperty(QString,
bool)) );
803 QObject::connect( m_model->mapTheme()->settings(), SIGNAL(valueChanged(QString,
bool)),
804 m_model, SLOT(updateProperty(QString,
bool)) );
806 q->setPropertyValue(
"clouds_data", m_viewParams.showClouds() );
808 if ( !m_model->mapTheme()->map()->hasTextureLayers() ) {
809 m_groundLayer.setColor( m_model->mapTheme()->map()->backgroundColor() );
810 m_layerManager.addLayer( &m_groundLayer );
814 if ( m_model->mapTheme()->map()->hasVectorLayers() ) {
815 m_veccomposer.setShowWaterBodies( q->propertyValue(
"waterbodies" ) );
816 m_veccomposer.setShowLakes( q->propertyValue(
"lakes" ) );
817 m_veccomposer.setShowIce( q->propertyValue(
"ice" ) );
818 m_veccomposer.setShowCoastLines( q->propertyValue(
"coastlines" ) );
819 m_veccomposer.setShowRivers( q->propertyValue(
"rivers" ) );
820 m_veccomposer.setShowBorders( q->propertyValue(
"borders" ) );
823 m_veccomposer.setOceanColor( m_model->mapTheme()->map()->backgroundColor() );
828 const GeoSceneLayer *layer = m_model->mapTheme()->map()->layer(
"mwdbii" );
830 const GeoSceneVector *vector = 0;
832 vector =
static_cast<const GeoSceneVector*
>( layer->dataset(
"pdiffborder") );
834 m_veccomposer.setCountryBorderColor( vector->pen().color() );
836 vector =
static_cast<const GeoSceneVector*
>( layer->dataset(
"rivers") );
838 m_veccomposer.setRiverColor( vector->pen().color() );
840 vector =
static_cast<const GeoSceneVector*
>( layer->dataset(
"pusa48") );
842 m_veccomposer.setStateBorderColor( vector->pen().color() );
844 vector =
static_cast<const GeoSceneVector*
>( layer->dataset(
"plake") );
846 m_veccomposer.setLakeColor( vector->pen().color() );
848 vector =
static_cast<const GeoSceneVector*
>( layer->dataset(
"pcoast") );
851 m_veccomposer.setLandColor( vector->brush().color() );
852 m_veccomposer.setCoastColor( vector->pen().color() );
856 if ( !m_model->mapTheme()->map()->hasTextureLayers() ) {
857 m_layerManager.addLayer( &m_vectorMapBaseLayer );
860 m_layerManager.addLayer( &m_vectorMapLayer );
864 if ( m_model->mapTheme()->map()->hasTextureLayers() ) {
865 const GeoSceneSettings *
const settings = m_model->mapTheme()->settings();
866 const GeoSceneGroup *
const textureLayerSettings = settings ? settings->group(
"Texture Layers" ) : 0;
867 const GeoSceneGroup *
const vectorTileLayerSettings = settings ? settings->group(
"VectorTile Layers" ) : 0;
869 bool textureLayersOk =
true;
870 bool vectorTileLayersOk =
true;
874 QVector<const GeoSceneTextureTile *> textures;
875 QVector<const GeoSceneVectorTile *> vectorTiles;
877 foreach( GeoSceneLayer* layer, m_model->mapTheme()->map()->layers() ){
880 foreach (
const GeoSceneAbstractDataset *pos, layer->datasets() ) {
881 const GeoSceneTextureTile *
const texture =
dynamic_cast<GeoSceneTextureTile
const *
>( pos );
885 const QString sourceDir = texture->sourceDir();
886 const QString installMap = texture->installMap();
887 const QString role = layer->role();
892 && !installMap.isEmpty() )
894 mDebug() <<
"Base tiles not available. Creating Tiles ... \n"
895 <<
"SourceDir: " << sourceDir <<
"InstallMap:" << installMap;
897 TileCreator *tileCreator =
new TileCreator(
900 (role ==
"dem") ?
"true" :
"false" );
901 tileCreator->setTileFormat( texture->fileFormat().toLower() );
903 QPointer<TileCreatorDialog> tileCreatorDlg =
new TileCreatorDialog( tileCreator, 0 );
904 tileCreatorDlg->setSummary( m_model->mapTheme()->head()->name(),
905 m_model->mapTheme()->head()->description() );
906 tileCreatorDlg->exec();
908 mDebug() <<
"Base tiles for" << sourceDir <<
"successfully created.";
910 qWarning() <<
"Some or all base tiles for" << sourceDir <<
"could not be created.";
913 delete tileCreatorDlg;
917 textures.append( texture );
919 qWarning() <<
"Base tiles for" << sourceDir <<
"not available. Skipping all texture layers.";
920 textureLayersOk =
false;
926 foreach (
const GeoSceneAbstractDataset *pos, layer->datasets() ) {
927 const GeoSceneVectorTile *
const vectorTile =
dynamic_cast<GeoSceneVectorTile
const *
>( pos );
931 const QString sourceDir = vectorTile->sourceDir();
932 const QString installMap = vectorTile->installMap();
933 const QString role = layer->role();
938 && !installMap.isEmpty() )
940 mDebug() <<
"Base tiles not available. Creating Tiles ... \n"
941 <<
"SourceDir: " << sourceDir <<
"InstallMap:" << installMap;
943 TileCreator *tileCreator =
new TileCreator(
946 (role ==
"dem") ?
"true" :
"false" );
947 tileCreator->setTileFormat( vectorTile->fileFormat().toLower() );
949 QPointer<TileCreatorDialog> tileCreatorDlg =
new TileCreatorDialog( tileCreator, 0 );
950 tileCreatorDlg->setSummary( m_model->mapTheme()->head()->name(),
951 m_model->mapTheme()->head()->description() );
952 tileCreatorDlg->exec();
954 qDebug() <<
"Base tiles for" << sourceDir <<
"successfully created.";
956 qDebug() <<
"Some or all base tiles for" << sourceDir <<
"could not be created.";
959 delete tileCreatorDlg;
963 vectorTiles.append( vectorTile );
965 qWarning() <<
"Base tiles for" << sourceDir <<
"not available. Skipping all texture layers.";
966 vectorTileLayersOk =
false;
972 QString seafile, landfile;
973 if( !m_model->mapTheme()->map()->filters().isEmpty() ) {
974 const GeoSceneFilter *filter= m_model->mapTheme()->map()->filters().first();
976 if( filter->type() ==
"colorize" ) {
978 QList<const GeoScenePalette*> palette = filter->palette();
979 foreach (
const GeoScenePalette *curPalette, palette ) {
981 if( curPalette->type() ==
"sea" ) {
983 }
else if( curPalette->type() ==
"land" ) {
988 if( seafile.isEmpty() )
990 if( landfile.isEmpty() )
995 m_textureLayer.setMapTheme( textures, textureLayerSettings, seafile, landfile );
996 m_textureLayer.setProjection( m_viewport.projection() );
997 m_textureLayer.setShowRelief( q->showRelief() );
999 m_vectorTileLayer.setMapTheme( vectorTiles, vectorTileLayerSettings );
1001 if ( textureLayersOk )
1002 m_layerManager.addLayer( &m_textureLayer );
1003 if ( vectorTileLayersOk )
1004 m_layerManager.addLayer( &m_vectorTileLayer );
1007 m_textureLayer.setMapTheme( QVector<const GeoSceneTextureTile *>(), 0,
"",
"" );
1008 m_vectorTileLayer.setMapTheme( QVector<const GeoSceneVectorTile *>(), 0 );
1012 m_placemarkLayer.setShowPlaces( q->showPlaces() );
1014 m_placemarkLayer.setShowCities( q->showCities() );
1015 m_placemarkLayer.setShowTerrain( q->showTerrain() );
1016 m_placemarkLayer.setShowOtherPlaces( q->showOtherPlaces() );
1017 m_placemarkLayer.setShowLandingSites( q->propertyValue(
"landingsites") );
1018 m_placemarkLayer.setShowCraters( q->propertyValue(
"craters") );
1019 m_placemarkLayer.setShowMaria( q->propertyValue(
"maria") );
1022 m_placemarkLayer.requestStyleReset();
1024 foreach( RenderPlugin *
renderPlugin, m_layerManager.renderPlugins() ) {
1025 bool propertyAvailable =
false;
1026 m_model->mapTheme()->settings()->propertyAvailable( renderPlugin->nameId(), propertyAvailable );
1027 bool propertyValue =
false;
1028 m_model->mapTheme()->settings()->propertyValue( renderPlugin->nameId(), propertyValue );
1030 if ( propertyAvailable ) {
1031 renderPlugin->setVisible( propertyValue );
1035 emit q->themeChanged( m_model->mapTheme()->head()->mapThemeId() );
1040 mDebug() <<
"In MarbleMap the property " << name <<
"was set to " << value;
1041 if ( d->m_model->mapTheme() ) {
1042 d->m_model->mapTheme()->settings()->setPropertyValue( name, value );
1043 d->m_textureLayer.setNeedsUpdate();
1046 mDebug() <<
"WARNING: Failed to access a map theme! Property: " << name;
1068 if ( plugin->
nameId() ==
"atmosphere" ) {
1073 d->m_viewParams.setShowAtmosphere( visible );
1079 QList<RenderPlugin *>::const_iterator i = pluginList.constBegin();
1080 QList<RenderPlugin *>::const_iterator
const end = pluginList.constEnd();
1081 for (; i != end; ++i ) {
1082 if ( (*i)->nameId() ==
"crosshairs" ) {
1083 (*i)->setVisible( visible );
1090 d->m_viewParams.setShowClouds( visible );
1097 d->m_textureLayer.setShowSunShading( visible );
1102 d->m_textureLayer.setShowCityLights( visible );
1108 disconnect( d->m_model->sunLocator(), SIGNAL(positionChanged(qreal,qreal)),
1109 this, SLOT(
centerOn(qreal,qreal)) );
1112 d->m_isLockedToSubSolarPoint = visible;
1116 connect( d->m_model->sunLocator(), SIGNAL(positionChanged(qreal,qreal)),
1117 this, SLOT(
centerOn(qreal,qreal)) );
1119 centerOn( d->m_model->sunLocator()->getLon(), d->m_model->sunLocator()->getLat() );
1120 }
else if ( visible ) {
1121 mDebug() <<
"Ignoring centering on sun, since the sun plugin is not loaded.";
1128 d->m_isSubSolarPointIconVisible = visible;
1134 d->m_textureLayer.setShowTileId( visible );
1189 d->m_showFrameRate = visible;
1194 d->m_layerManager.setShowRuntimeTrace( visible );
1199 d->m_layerManager.setShowBackground( visible );
1216 d->m_vectorTileLayer.reset();
1217 d->m_textureLayer.reset();
1218 mDebug() <<
"Cleared Volatile Cache!";
1223 mDebug() <<
"kiloBytes" << kilobytes;
1224 d->m_textureLayer.setVolatileCacheLimit( kilobytes );
1243 }
else if ( angleUnit ==
UTM ) {
1259 d->m_placemarkLayer.requestStyleReset();
1264 return d->m_layerManager.renderPlugins();
1269 return d->m_layerManager.floatItems();
1275 if ( floatItem && floatItem->
nameId() == nameId ) {
1285 return d->m_layerManager.dataPlugins();
1290 return d->m_layerManager.whichItemAt( curpos );
1295 d->m_layerManager.addLayer(layer);
1300 d->m_layerManager.removeLayer(layer);
1306 return &d->m_textureLayer;
1311 #include "MarbleMap.moc"
Unit
enum used constructor to specify the units used
bool screenCoordinates(qreal lon, qreal lat, qreal &x, qreal &y) const
Get the screen coordinates corresponding to geographical coordinates in the map.
bool showCityLights() const
Return whether the city lights are shown instead of the night shadow.
bool showGrid() const
Return whether the coordinate grid is visible.
AngleUnit defaultAngleUnit() const
bool showSunShading() const
Return whether the night shadow is visible.
void setCenterLongitude(qreal lon)
Set the longitude for the center point.
QFont defaultFont() const
bool showOverviewMap() const
Return whether the overview map is visible.
void setDefaultFont(const QFont &font)
void setLockToSubSolarPoint(bool visible)
Set the globe locked to the sub solar point.
quint64 volatileTileCacheLimit() const
Returns the limit in kilobytes of the volatile (in RAM) tile cache.
void radiusChanged(int radius)
static QString path(const QString &relativePath)
void setShowBorders(bool visible)
Set whether the borders visible.
void setPropertyValue(const QString &name, bool value)
Sets the value of a map theme property.
qreal centerLatitude() const
Return the latitude of the center point.
void addLayer(LayerInterface *layer)
Add a layer to be included in rendering.
static bool baseTilesAvailable(GeoSceneTiled const &texture)
Returns whether the mandatory most basic tile level is fully available for the given texture layer...
A painter that allows to draw geometric primitives on the map.
void setShowRuntimeTrace(bool visible)
int radius() const
Return the radius of the globe in pixels.
void setShowCrosshairs(bool visible)
Set whether the crosshairs are visible.
This file contains the headers for MarbleModel.
void reload()
Reload the currently displayed map by reloading texture tiles from the Internet.
ViewContext
This enum is used to choose context in which map quality gets used.
int preferredRadiusFloor(int radius)
void setShowRivers(bool visible)
Set whether the rivers are visible.
bool showClouds() const
Return whether the cloud cover is visible.
QVector< const GeoDataPlacemark * > whichFeatureAt(const QPoint &) const
void setSubSolarPointIconVisible(bool visible)
Set whether the sun icon is shown in the sub solar point.
Degrees in decimal notation.
"Decimal" notation (base-10)
MapQuality
This enum is used to choose the map quality shown in the view.
bool showBorders() const
Return whether the borders are visible.
void setMapQualityForViewContext(MapQuality qualityForViewContext, ViewContext viewContext)
void setViewContext(ViewContext viewContext)
ViewportParams * viewport()
void setShowTileId(bool visible)
Set whether the is tile is visible NOTE: This is part of the transitional debug API and might be subj...
void paint(QPainter *painter)
friend class CustomPaintLayer
MapQuality mapQuality() const
Return the current map quality.
MarbleModel * model() const
Return the model that this view shows.
void setMapThemeId(const QString &maptheme)
Set a new map theme.
void setShowFrameRate(bool visible)
Set whether the frame rate gets shown.
int tileZoomLevel() const
This file contains the headers for ViewParameters.
void visibleLatLonAltBoxChanged(const GeoDataLatLonAltBox &visibleLatLonAltBox)
This signal is emitted when the visible region of the map changes.
void setShowRelief(bool visible)
Set whether the relief is visible.
void setShowAtmosphere(bool visible)
Set whether the atmospheric glow is visible.
This file contains the headers for MarbleMap.
void setSize(int width, int height)
int maximumZoom() const
return the minimum zoom value for the current map theme.
QList< AbstractFloatItem * > floatItems() const
void rotateBy(const qreal &deltaLon, const qreal &deltaLat)
Rotate the view by the two angles phi and theta.
bool showRivers() const
Return whether the rivers are visible.
void setShowCompass(bool visible)
Set whether the compass overlay is visible.
void setShowPlaces(bool visible)
Set whether the place mark overlay is visible.
The abstract class for float item plugins.
virtual void customPaint(GeoPainter *painter)
Enables custom drawing onto the MarbleMap straight after.
void setRadius(int radius)
Set the radius of the globe in pixels.
void removeLayer(LayerInterface *layer)
Remove a layer from being included in rendering.
void setShowOverviewMap(bool visible)
Set whether the overview map overlay is visible.
bool showOtherPlaces() const
Return whether other places are visible.
void setShowBackground(bool visible)
bool showCompass() const
Return whether the compass bar is visible.
bool showCrosshairs() const
Return whether the crosshairs are visible.
static void setDefaultLabelColor(const QColor &color)
void setVisible(bool visible)
settting visible
bool showBackground() const
void paint(GeoPainter &painter, const QRect &dirtyRect)
Paint the map using a give painter.
void clearVolatileTileCache()
void setShowSunShading(bool visible)
Set whether the night shadow is visible.
void mouseClickGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::Unit)
int minimumZoom() const
return the minimum zoom value for the current map theme.
QList< RenderPlugin * > renderPlugins() const
Returns a list of all RenderPlugins in the model, this includes float items.
A public class that controls what is visible in the viewport of a Marble map.
const char * dgmlValue_geodata
bool geoCoordinates(int x, int y, qreal &lon, qreal &lat, GeoDataCoordinates::Unit=GeoDataCoordinates::Degree) const
Get the earth coordinates corresponding to a pixel in the map.
const TextureLayer * textureLayer() const
static void setDefaultFont(const QFont &font)
void setProjection(Projection projection)
Set the Projection used for the map.
void setShowTerrain(bool visible)
Set whether the terrain place mark overlay is visible.
This file contains the headers for ViewportParams.
void setCenterLatitude(qreal lat)
Set the latitude for the center point.
void setShowClouds(bool visible)
Set whether the cloud cover is visible.
void setShowGrid(bool visible)
Set whether the coordinate grid overlay is visible.
MarbleMap()
Construct a new MarbleMap.
bool showScaleBar() const
Return whether the scale bar is visible.
void setVolatileTileCacheLimit(quint64 kiloBytes)
Set the limit of the volatile (in RAM) tile cache.
The data model (not based on QAbstractModel) for a MarbleWidget.
bool showLakes() const
Return whether the lakes are visible.
qreal centerLongitude() const
Return the longitude of the center point.
bool showFrameRate() const
Return whether the frame rate gets displayed.
bool propertyValue(const QString &name) const
Return the property value by name.
bool isSubSolarPointIconVisible() const
Return whether the sun icon is shown in the sub solar point.
bool showAtmosphere() const
Return whether the atmospheric glow is visible.
AngleUnit
This enum is used to choose the unit chosen to measure angles.
void downloadRegion(QVector< TileCoordsPyramid > const &)
bool showPlaces() const
Return whether the place marks are visible.
void setShowOtherPlaces(bool visible)
Set whether the other places overlay is visible.
QList< AbstractDataPlugin * > dataPlugins() const
Returns a list of all DataPlugins on the layer.
void framesPerSecond(qreal fps)
QList< AbstractDataPluginItem * > whichItemAt(const QPoint &curpos) const
Returns all widgets of dataPlugins on the position curpos.
void setShowIceLayer(bool visible)
Set whether the ice layer is visible.
bool showRelief() const
Return whether the relief is visible.
Projection projection() const
Get the Projection used for the map.
bool isLockedToSubSolarPoint() const
Return whether the globe is locked to the sub solar point.
Projection
This enum is used to choose the projection shown in the view.
static void setDefaultNotation(GeoDataCoordinates::Notation notation)
set the Notation of the string representation
QString mapThemeId() const
Get the ID of the current map theme To ensure that a unique identifier is being used the theme does N...
bool showCities() const
Return whether the city place marks are visible.
void centerOn(const qreal lon, const qreal lat)
Center the view on a geographical point.
const char * dgmlValue_texture
AbstractFloatItem * floatItem(const QString &nameId) const
Returns a list of all FloatItems in the model.
void setShowCityLights(bool visible)
Set whether city lights instead of night shadow are visible.
ViewContext viewContext() const
bool showIceLayer() const
Return whether the ice layer is visible.
static QFont defaultFont()
void setDefaultAngleUnit(AngleUnit angleUnit)
"Sexagesimal DMS" notation (base-60)
static GeoDataCoordinates::Notation defaultNotation()
return Notation of string representation
void setShowLakes(bool visible)
Set whether the lakes are visible.
QDebug mDebug()
a function to replace qDebug() in Marble library code
bool showTerrain() const
Return whether the terrain place marks are visible.
The abstract class that creates a renderable item.
void setShowCities(bool visible)
Set whether the city place mark overlay is visible.
int preferredRadiusCeil(int radius)
void repaintNeeded(const QRegion &dirtyRegion=QRegion())
This signal is emitted when the repaint of the view was requested.
void projectionChanged(Projection)
const char * dgmlValue_vectortile
void setShowScaleBar(bool visible)
Set whether the scale bar overlay is visible.
void notifyMouseClick(int x, int y)
used to notify about the position of the mouse click