• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • lib
  • marble
MarbleMap.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2006-2009 Torsten Rahn <tackat@kde.org>
9 // Copyright 2007 Inge Wallin <ingwa@kde.org>
10 // Copyright 2008 Carlos Licea <carlos.licea@kdemail.net>
11 // Copyright 2009 Jens-Michael Hoffmann <jensmh@gmx.de>
12 // Copyright 2010-2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
13 //
14 
15 
16 // Own
17 #include "MarbleMap.h"
18 
19 // Posix
20 #include <cmath>
21 
22 // Qt
23 #include <QAbstractItemModel>
24 #include <QTime>
25 #include <QTimer>
26 #include <QItemSelectionModel>
27 #include <QSizePolicy>
28 #include <QRegion>
29 
30 #ifdef MARBLE_DBUS
31 #include <QDBusConnection>
32 #endif
33 
34 // Marble
35 #include "layers/FogLayer.h"
36 #include "layers/FpsLayer.h"
37 #include "layers/GeometryLayer.h"
38 #include "layers/GroundLayer.h"
39 #include "layers/MarbleSplashLayer.h"
40 #include "layers/PlacemarkLayer.h"
41 #include "layers/TextureLayer.h"
42 #include "layers/VectorMapBaseLayer.h"
43 #include "layers/VectorMapLayer.h"
44 #include "layers/VectorTileLayer.h"
45 #include "AbstractFloatItem.h"
46 #include "DgmlAuxillaryDictionary.h"
47 #include "FileManager.h"
48 #include "GeoDataTreeModel.h"
49 #include "GeoPainter.h"
50 #include "GeoSceneDocument.h"
51 #include "GeoSceneFilter.h"
52 #include "GeoSceneGeodata.h"
53 #include "GeoSceneHead.h"
54 #include "GeoSceneLayer.h"
55 #include "GeoSceneMap.h"
56 #include "GeoScenePalette.h"
57 #include "GeoSceneSettings.h"
58 #include "GeoSceneVector.h"
59 #include "GeoSceneVectorTile.h"
60 #include "GeoSceneZoom.h"
61 #include "GeoDataDocument.h"
62 #include "LayerManager.h"
63 #include "MapThemeManager.h"
64 #include "MarbleDebug.h"
65 #include "MarbleDirs.h"
66 #include "MarbleModel.h"
67 #include "RenderPlugin.h"
68 #include "SunLocator.h"
69 #include "TileCoordsPyramid.h"
70 #include "TileCreator.h"
71 #include "TileCreatorDialog.h"
72 #include "TileLoader.h"
73 #include "VectorComposer.h"
74 #include "ViewParams.h"
75 #include "ViewportParams.h"
76 
77 
78 namespace Marble
79 {
80 
81 
82 class MarbleMap::CustomPaintLayer : public LayerInterface
83 {
84 public:
85  CustomPaintLayer( MarbleMap *map )
86  : m_map( map )
87  {
88  }
89 
90  virtual QStringList renderPosition() const { return QStringList() << "USER_TOOLS"; }
91 
92  virtual bool render( GeoPainter *painter, ViewportParams *viewport,
93  const QString &renderPos, GeoSceneLayer *layer )
94  {
95  Q_UNUSED( viewport );
96  Q_UNUSED( renderPos );
97  Q_UNUSED( layer );
98 
99  m_map->customPaint( painter );
100 
101  return true;
102  }
103 
104  virtual qreal zValue() const { return 1.0e6; }
105 
106  virtual QString runtimeTrace() const { return "CustomPaint"; }
107 
108 private:
109  MarbleMap *const m_map;
110 };
111 
112 
113 class MarbleMapPrivate
114 {
115  friend class MarbleWidget;
116 
117 public:
118  explicit MarbleMapPrivate( MarbleMap *parent, MarbleModel *model );
119 
120  void updateMapTheme();
121 
122  void updateProperty( const QString &, bool );
123 
124  void setDocument( QString key );
125 
126  MarbleMap *const q;
127 
128  // The model we are showing.
129  MarbleModel *const m_model;
130  bool m_modelIsOwned;
131 
132  // Parameters for the maps appearance.
133  ViewParams m_viewParams;
134  ViewportParams m_viewport;
135  bool m_showFrameRate;
136 
137  VectorComposer m_veccomposer;
138 
139  LayerManager m_layerManager;
140  MarbleSplashLayer m_marbleSplashLayer;
141  MarbleMap::CustomPaintLayer m_customPaintLayer;
142  GeometryLayer m_geometryLayer;
143  FogLayer m_fogLayer;
144  GroundLayer m_groundLayer;
145  VectorMapBaseLayer m_vectorMapBaseLayer;
146  VectorMapLayer m_vectorMapLayer;
147  TextureLayer m_textureLayer;
148  PlacemarkLayer m_placemarkLayer;
149  VectorTileLayer m_vectorTileLayer;
150 
151  bool m_isLockedToSubSolarPoint;
152  bool m_isSubSolarPointIconVisible;
153 };
154 
155 MarbleMapPrivate::MarbleMapPrivate( MarbleMap *parent, MarbleModel *model ) :
156  q( parent ),
157  m_model( model ),
158  m_viewParams(),
159  m_showFrameRate( false ),
160  m_veccomposer(),
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 )
171 {
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 );
177 
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)) );
182 
183  QObject::connect( &m_veccomposer, SIGNAL(datasetLoaded()),
184  parent, SIGNAL(repaintNeeded()));
185 
186  QObject::connect( &m_placemarkLayer, SIGNAL(repaintNeeded()),
187  parent, SIGNAL(repaintNeeded()));
188 
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)) );
197 
198  QObject::connect( &m_geometryLayer, SIGNAL(repaintNeeded()),
199  parent, SIGNAL(repaintNeeded()));
200 
201  QObject::connect( &m_textureLayer, SIGNAL(tileLevelChanged(int)),
202  parent, SIGNAL(tileLevelChanged(int)) );
203  QObject::connect( &m_textureLayer, SIGNAL(repaintNeeded()),
204  parent, SIGNAL(repaintNeeded()) );
205 
206  QObject::connect( parent, SIGNAL(visibleLatLonAltBoxChanged(GeoDataLatLonAltBox)),
207  parent, SIGNAL(repaintNeeded()) );
208 }
209 
210 void MarbleMapPrivate::updateProperty( const QString &name, bool show )
211 {
212  // earth
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 );
221  }
222 
223  // other planets
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 );
230  }
231 
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 );
244  }
245 
246  else if ( name == "relief" ) {
247  m_textureLayer.setShowRelief( show );
248  }
249 
250  m_layerManager.setVisible( name, show );
251 }
252 
253 // ----------------------------------------------------------------
254 
255 
256 MarbleMap::MarbleMap()
257  : d( new MarbleMapPrivate( this, new MarbleModel( this ) ) )
258 {
259 #ifdef MARBLE_DBUS
260  QDBusConnection::sessionBus().registerObject( "/MarbleMap", this,
261  QDBusConnection::ExportAllSlots
262  | QDBusConnection::ExportAllSignals
263  | QDBusConnection::ExportAllProperties );
264 #endif
265 }
266 
267 MarbleMap::MarbleMap(MarbleModel *model)
268  : d( new MarbleMapPrivate( this, model ) )
269 {
270 #ifdef MARBLE_DBUS
271  QDBusConnection::sessionBus().registerObject( "/MarbleMap", this,
272  QDBusConnection::ExportAllSlots
273  | QDBusConnection::ExportAllSignals
274  | QDBusConnection::ExportAllProperties );
275 #endif
276 
277  d->m_modelIsOwned = false;
278 }
279 
280 MarbleMap::~MarbleMap()
281 {
282  MarbleModel *model = d->m_modelIsOwned ? d->m_model : 0;
283 
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 );
292  delete d;
293 
294  delete model; // delete the model after private data
295 }
296 
297 MarbleModel *MarbleMap::model() const
298 {
299  return d->m_model;
300 }
301 
302 ViewportParams *MarbleMap::viewport()
303 {
304  return &d->m_viewport;
305 }
306 
307 const ViewportParams *MarbleMap::viewport() const
308 {
309  return &d->m_viewport;
310 }
311 
312 
313 void MarbleMap::setMapQualityForViewContext( MapQuality quality, ViewContext viewContext )
314 {
315  d->m_viewParams.setMapQualityForViewContext( quality, viewContext );
316 
317  // Update texture map during the repaint that follows:
318  d->m_textureLayer.setNeedsUpdate();
319 }
320 
321 MapQuality MarbleMap::mapQuality( ViewContext viewContext ) const
322 {
323  return d->m_viewParams.mapQuality( viewContext );
324 }
325 
326 MapQuality MarbleMap::mapQuality() const
327 {
328  return d->m_viewParams.mapQuality();
329 }
330 
331 void MarbleMap::setViewContext( ViewContext viewContext )
332 {
333  const MapQuality oldQuality = d->m_viewParams.mapQuality();
334 
335  d->m_viewParams.setViewContext( viewContext );
336 
337  if ( d->m_viewParams.mapQuality() != oldQuality ) {
338  // Update texture map during the repaint that follows:
339  d->m_textureLayer.setNeedsUpdate();
340 
341  emit repaintNeeded();
342  }
343 }
344 
345 ViewContext MarbleMap::viewContext() const
346 {
347  return d->m_viewParams.viewContext();
348 }
349 
350 
351 void MarbleMap::setSize( int width, int height )
352 {
353  setSize( QSize( width, height ) );
354 }
355 
356 void MarbleMap::setSize( const QSize& size )
357 {
358  d->m_viewport.setSize( size );
359 
360  emit visibleLatLonAltBoxChanged( d->m_viewport.viewLatLonAltBox() );
361 }
362 
363 QSize MarbleMap::size() const
364 {
365  return QSize( d->m_viewport.width(), d->m_viewport.height() );
366 }
367 
368 int MarbleMap::width() const
369 {
370  return d->m_viewport.width();
371 }
372 
373 int MarbleMap::height() const
374 {
375  return d->m_viewport.height();
376 }
377 
378 int MarbleMap::radius() const
379 {
380  return d->m_viewport.radius();
381 }
382 
383 void MarbleMap::setRadius( int radius )
384 {
385  const int oldRadius = d->m_viewport.radius();
386 
387  d->m_viewport.setRadius( radius );
388 
389  if ( oldRadius != d->m_viewport.radius() ) {
390  emit radiusChanged( radius );
391  emit visibleLatLonAltBoxChanged( d->m_viewport.viewLatLonAltBox() );
392  }
393 }
394 
395 
396 int MarbleMap::preferredRadiusCeil( int radius )
397 {
398  if ( !d->m_layerManager.internalLayers().contains( &d->m_textureLayer ) )
399  return radius;
400 
401  return d->m_textureLayer.preferredRadiusCeil( radius );
402 }
403 
404 
405 int MarbleMap::preferredRadiusFloor( int radius )
406 {
407  if ( !d->m_layerManager.internalLayers().contains( &d->m_textureLayer ) )
408  return radius;
409 
410  return d->m_textureLayer.preferredRadiusFloor( radius );
411 }
412 
413 
414 int MarbleMap::tileZoomLevel() const
415 {
416  return d->m_textureLayer.tileZoomLevel();
417 }
418 
419 
420 qreal MarbleMap::centerLatitude() const
421 {
422  // Calculate translation of center point
423  const qreal centerLat = d->m_viewport.centerLatitude();
424 
425  return centerLat * RAD2DEG;
426 }
427 
428 qreal MarbleMap::centerLongitude() const
429 {
430  // Calculate translation of center point
431  const qreal centerLon = d->m_viewport.centerLongitude();
432 
433  return centerLon * RAD2DEG;
434 }
435 
436 int MarbleMap::minimumZoom() const
437 {
438  if ( d->m_model->mapTheme() )
439  return d->m_model->mapTheme()->head()->zoom()->minimum();
440 
441  return 950;
442 }
443 
444 int MarbleMap::maximumZoom() const
445 {
446  if ( d->m_model->mapTheme() )
447  return d->m_model->mapTheme()->head()->zoom()->maximum();
448 
449  return 2100;
450 }
451 
452 QVector<const GeoDataPlacemark*> MarbleMap::whichFeatureAt( const QPoint& curpos ) const
453 {
454  return d->m_placemarkLayer.whichPlacemarkAt( curpos );
455 }
456 
457 void MarbleMap::reload()
458 {
459  d->m_textureLayer.reload();
460 }
461 
462 void MarbleMap::downloadRegion( QVector<TileCoordsPyramid> const & pyramid )
463 {
464  Q_ASSERT( textureLayer() );
465  Q_ASSERT( !pyramid.isEmpty() );
466  QTime t;
467  t.start();
468 
469  // When downloading a region (the author of these lines thinks) most users probably expect
470  // the download to begin with the low resolution tiles and then procede level-wise to
471  // higher resolution tiles. In order to achieve this, we start requesting downloads of
472  // high resolution tiles and request the low resolution tiles at the end because
473  // DownloadQueueSet (silly name) is implemented as stack.
474 
475 
476  int const first = 0;
477  int tilesCount = 0;
478 
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;
484  int x1, y1, x2, y2;
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 );
490  // FIXME: use lazy evaluation to not generate up to 100k tiles in one go
491  // this can take considerable time even on very fast systems
492  // in contrast generating the TileIds on the fly when they are needed
493  // does not seem to affect download speed.
494  }
495  }
496  }
497  QSetIterator<TileId> i( tileIdSet );
498  while( i.hasNext() ) {
499  TileId const tileId = i.next();
500  d->m_textureLayer.downloadStackedTile( tileId );
501  }
502  tilesCount += tileIdSet.count();
503  }
504  // Needed for downloading unique tiles only. Much faster than if tiles for each level is downloaded separately
505 
506  int const elapsedMs = t.elapsed();
507  mDebug() << "MarbleMap::downloadRegion:" << tilesCount << "tiles, " << elapsedMs << "ms";
508 }
509 
510 bool MarbleMap::propertyValue( const QString& name ) const
511 {
512  bool value;
513  if ( d->m_model->mapTheme() ) {
514  d->m_model->mapTheme()->settings()->propertyValue( name, value );
515  }
516  else {
517  value = false;
518  mDebug() << "WARNING: Failed to access a map theme! Property: " << name;
519  }
520  return value;
521 }
522 
523 bool MarbleMap::showOverviewMap() const
524 {
525  return propertyValue( "overviewmap" );
526 }
527 
528 bool MarbleMap::showScaleBar() const
529 {
530  return propertyValue( "scalebar" );
531 }
532 
533 bool MarbleMap::showCompass() const
534 {
535  return propertyValue( "compass" );
536 }
537 
538 bool MarbleMap::showGrid() const
539 {
540  return propertyValue( "coordinate-grid" );
541 }
542 
543 bool MarbleMap::showClouds() const
544 {
545  return d->m_viewParams.showClouds();
546 }
547 
548 bool MarbleMap::showSunShading() const
549 {
550  return d->m_textureLayer.showSunShading();
551 }
552 
553 bool MarbleMap::showCityLights() const
554 {
555  return d->m_textureLayer.showCityLights();
556 }
557 
558 bool MarbleMap::isLockedToSubSolarPoint() const
559 {
560  return d->m_isLockedToSubSolarPoint;
561 }
562 
563 bool MarbleMap::isSubSolarPointIconVisible() const
564 {
565  return d->m_isSubSolarPointIconVisible;
566 }
567 
568 bool MarbleMap::showAtmosphere() const
569 {
570  return d->m_viewParams.showAtmosphere();
571 }
572 
573 bool MarbleMap::showCrosshairs() const
574 {
575  bool visible = false;
576 
577  QList<RenderPlugin *> pluginList = renderPlugins();
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();
583  }
584  }
585 
586  return visible;
587 }
588 
589 bool MarbleMap::showPlaces() const
590 {
591  return propertyValue( "places" );
592 }
593 
594 bool MarbleMap::showCities() const
595 {
596  return propertyValue( "cities" );
597 }
598 
599 bool MarbleMap::showTerrain() const
600 {
601  return propertyValue( "terrain" );
602 }
603 
604 bool MarbleMap::showOtherPlaces() const
605 {
606  return propertyValue( "otherplaces" );
607 }
608 
609 bool MarbleMap::showRelief() const
610 {
611  return propertyValue( "relief" );
612 }
613 
614 bool MarbleMap::showIceLayer() const
615 {
616  return propertyValue( "ice" );
617 }
618 
619 bool MarbleMap::showBorders() const
620 {
621  return propertyValue( "borders" );
622 }
623 
624 bool MarbleMap::showRivers() const
625 {
626  return propertyValue( "rivers" );
627 }
628 
629 bool MarbleMap::showLakes() const
630 {
631  return propertyValue( "lakes" );
632 }
633 
634 bool MarbleMap::showFrameRate() const
635 {
636  return d->m_showFrameRate;
637 }
638 
639 bool MarbleMap::showBackground() const
640 {
641  return d->m_layerManager.showBackground();
642 }
643 
644 quint64 MarbleMap::volatileTileCacheLimit() const
645 {
646  return d->m_textureLayer.volatileCacheLimit();
647 }
648 
649 
650 void MarbleMap::rotateBy( const qreal& deltaLon, const qreal& deltaLat )
651 {
652  centerOn( d->m_viewport.centerLongitude() * RAD2DEG + deltaLon,
653  d->m_viewport.centerLatitude() * RAD2DEG + deltaLat );
654 }
655 
656 
657 void MarbleMap::centerOn( const qreal lon, const qreal lat )
658 {
659  d->m_viewport.centerOn( lon * DEG2RAD, lat * DEG2RAD );
660 
661  emit visibleLatLonAltBoxChanged( d->m_viewport.viewLatLonAltBox() );
662 }
663 
664 void MarbleMap::setCenterLatitude( qreal lat )
665 {
666  centerOn( centerLongitude(), lat );
667 }
668 
669 void MarbleMap::setCenterLongitude( qreal lon )
670 {
671  centerOn( lon, centerLatitude() );
672 }
673 
674 Projection MarbleMap::projection() const
675 {
676  return d->m_viewport.projection();
677 }
678 
679 void MarbleMap::setProjection( Projection projection )
680 {
681  if ( d->m_viewport.projection() == projection )
682  return;
683 
684  emit projectionChanged( projection );
685 
686  d->m_viewport.setProjection( projection );
687 
688  d->m_textureLayer.setProjection( projection );
689 
690  emit visibleLatLonAltBoxChanged( d->m_viewport.viewLatLonAltBox() );
691 }
692 
693 
694 bool MarbleMap::screenCoordinates( qreal lon, qreal lat,
695  qreal& x, qreal& y ) const
696 {
697  return d->m_viewport.screenCoordinates( lon * DEG2RAD, lat * DEG2RAD, x, y );
698 }
699 
700 bool MarbleMap::geoCoordinates( int x, int y,
701  qreal& lon, qreal& lat,
702  GeoDataCoordinates::Unit unit ) const
703 {
704  return d->m_viewport.geoCoordinates( x, y, lon, lat, unit );
705 }
706 
707 void MarbleMapPrivate::setDocument( QString key )
708 {
709  if ( !m_model->mapTheme() ) {
710  // Happens if no valid map theme is set or at application startup
711  // if a file is passed via command line parameters and the last
712  // map theme has not been loaded yet
717  return;
718  }
719 
720  GeoDataDocument* doc = m_model->fileManager()->at( key );
721 
722  foreach ( const GeoSceneLayer *layer, m_model->mapTheme()->map()->layers() ) {
723  if ( layer->backend() != dgml::dgmlValue_geodata )
724  continue;
725 
726  // look for documents
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 );
734  }
735  if( colorize == "sea" ) {
736  m_textureLayer.addSeaDocument( doc );
737  }
738 
739  // set visibility according to theme property
740  if( !data->property().isEmpty() ) {
741  bool value;
742  m_model->mapTheme()->settings()->propertyValue( data->property(), value );
743  doc->setVisible( value );
744  m_model->treeModel()->updateFeature( doc );
745  }
746  }
747  }
748  }
749 }
750 
751 // Used to be paintEvent()
752 void MarbleMap::paint( GeoPainter &painter, const QRect &dirtyRect )
753 {
754  Q_UNUSED( dirtyRect );
755 
756  if ( !d->m_model->mapTheme() ) {
757  mDebug() << "No theme yet!";
758  d->m_marbleSplashLayer.render( &painter, &d->m_viewport );
759  return;
760  }
761 
762  QTime t;
763  t.start();
764 
765  d->m_layerManager.renderLayers( &painter, &d->m_viewport );
766 
767  if ( d->m_showFrameRate ) {
768  FpsLayer fpsPainter( &t );
769  fpsPainter.paint( &painter );
770  }
771 
772  const qreal fps = 1000.0 / (qreal)( t.elapsed() );
773  emit framesPerSecond( fps );
774 }
775 
776 void MarbleMap::customPaint( GeoPainter *painter )
777 {
778  Q_UNUSED( painter );
779 }
780 
781 QString MarbleMap::mapThemeId() const
782 {
783  return d->m_model->mapThemeId();
784 }
785 
786 void MarbleMap::setMapThemeId( const QString& mapThemeId )
787 {
788  d->m_model->setMapThemeId( mapThemeId );
789 }
790 
791 void MarbleMapPrivate::updateMapTheme()
792 {
793  m_layerManager.removeLayer( &m_textureLayer );
794  // FIXME Find a better way to do this reset. Maybe connect to themeChanged SIGNAL?
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 );
800 
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)) );
805 
806  q->setPropertyValue( "clouds_data", m_viewParams.showClouds() );
807 
808  if ( !m_model->mapTheme()->map()->hasTextureLayers() ) {
809  m_groundLayer.setColor( m_model->mapTheme()->map()->backgroundColor() );
810  m_layerManager.addLayer( &m_groundLayer );
811  }
812 
813  // Check whether there is a vector layer available:
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" ) );
821 
822  // Set all the colors for the vector layers
823  m_veccomposer.setOceanColor( m_model->mapTheme()->map()->backgroundColor() );
824 
825  // Just as with textures, this is a workaround for DGML2 to
826  // emulate the old behaviour.
827 
828  const GeoSceneLayer *layer = m_model->mapTheme()->map()->layer( "mwdbii" );
829  if ( layer ) {
830  const GeoSceneVector *vector = 0;
831 
832  vector = static_cast<const GeoSceneVector*>( layer->dataset("pdiffborder") );
833  if ( vector )
834  m_veccomposer.setCountryBorderColor( vector->pen().color() );
835 
836  vector = static_cast<const GeoSceneVector*>( layer->dataset("rivers") );
837  if ( vector )
838  m_veccomposer.setRiverColor( vector->pen().color() );
839 
840  vector = static_cast<const GeoSceneVector*>( layer->dataset("pusa48") );
841  if ( vector )
842  m_veccomposer.setStateBorderColor( vector->pen().color() );
843 
844  vector = static_cast<const GeoSceneVector*>( layer->dataset("plake") );
845  if ( vector )
846  m_veccomposer.setLakeColor( vector->pen().color() );
847 
848  vector = static_cast<const GeoSceneVector*>( layer->dataset("pcoast") );
849  if ( vector )
850  {
851  m_veccomposer.setLandColor( vector->brush().color() );
852  m_veccomposer.setCoastColor( vector->pen().color() );
853  }
854  }
855 
856  if ( !m_model->mapTheme()->map()->hasTextureLayers() ) {
857  m_layerManager.addLayer( &m_vectorMapBaseLayer );
858  }
859 
860  m_layerManager.addLayer( &m_vectorMapLayer );
861  }
862 
863  // Check whether there is a texture layer and vectortile layer available:
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;
868 
869  bool textureLayersOk = true;
870  bool vectorTileLayersOk = true;
871 
872  // textures will contain texture layers and
873  // vectorTiles vectortile layers
874  QVector<const GeoSceneTextureTile *> textures;
875  QVector<const GeoSceneVectorTile *> vectorTiles;
876 
877  foreach( GeoSceneLayer* layer, m_model->mapTheme()->map()->layers() ){
878  if ( layer->backend() == dgml::dgmlValue_texture ){
879 
880  foreach ( const GeoSceneAbstractDataset *pos, layer->datasets() ) {
881  const GeoSceneTextureTile *const texture = dynamic_cast<GeoSceneTextureTile const *>( pos );
882  if ( !texture )
883  continue;
884 
885  const QString sourceDir = texture->sourceDir();
886  const QString installMap = texture->installMap();
887  const QString role = layer->role();
888 
889  // If the tiles aren't already there, put up a progress dialog
890  // while creating them.
891  if ( !TileLoader::baseTilesAvailable( *texture )
892  && !installMap.isEmpty() )
893  {
894  mDebug() << "Base tiles not available. Creating Tiles ... \n"
895  << "SourceDir: " << sourceDir << "InstallMap:" << installMap;
896 
897  TileCreator *tileCreator = new TileCreator(
898  sourceDir,
899  installMap,
900  (role == "dem") ? "true" : "false" );
901  tileCreator->setTileFormat( texture->fileFormat().toLower() );
902 
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();
907  if ( TileLoader::baseTilesAvailable( *texture ) ) {
908  mDebug() << "Base tiles for" << sourceDir << "successfully created.";
909  } else {
910  qWarning() << "Some or all base tiles for" << sourceDir << "could not be created.";
911  }
912 
913  delete tileCreatorDlg;
914  }
915 
916  if ( TileLoader::baseTilesAvailable( *texture ) ) {
917  textures.append( texture );
918  } else {
919  qWarning() << "Base tiles for" << sourceDir << "not available. Skipping all texture layers.";
920  textureLayersOk = false;
921  }
922  }
923  }
924  else if ( layer->backend() == dgml::dgmlValue_vectortile ){
925 
926  foreach ( const GeoSceneAbstractDataset *pos, layer->datasets() ) {
927  const GeoSceneVectorTile *const vectorTile = dynamic_cast<GeoSceneVectorTile const *>( pos );
928  if ( !vectorTile )
929  continue;
930 
931  const QString sourceDir = vectorTile->sourceDir();
932  const QString installMap = vectorTile->installMap();
933  const QString role = layer->role();
934 
935  // If the tiles aren't already there, put up a progress dialog
936  // while creating them.
937  if ( !TileLoader::baseTilesAvailable( *vectorTile )
938  && !installMap.isEmpty() )
939  {
940  mDebug() << "Base tiles not available. Creating Tiles ... \n"
941  << "SourceDir: " << sourceDir << "InstallMap:" << installMap;
942 
943  TileCreator *tileCreator = new TileCreator(
944  sourceDir,
945  installMap,
946  (role == "dem") ? "true" : "false" );
947  tileCreator->setTileFormat( vectorTile->fileFormat().toLower() );
948 
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();
953  if ( TileLoader::baseTilesAvailable( *vectorTile ) ) {
954  qDebug() << "Base tiles for" << sourceDir << "successfully created.";
955  } else {
956  qDebug() << "Some or all base tiles for" << sourceDir << "could not be created.";
957  }
958 
959  delete tileCreatorDlg;
960  }
961 
962  if ( TileLoader::baseTilesAvailable( *vectorTile ) ) {
963  vectorTiles.append( vectorTile );
964  } else {
965  qWarning() << "Base tiles for" << sourceDir << "not available. Skipping all texture layers.";
966  vectorTileLayersOk = false;
967  }
968  }
969  }
970  }
971 
972  QString seafile, landfile;
973  if( !m_model->mapTheme()->map()->filters().isEmpty() ) {
974  const GeoSceneFilter *filter= m_model->mapTheme()->map()->filters().first();
975 
976  if( filter->type() == "colorize" ) {
977  //no need to look up with MarbleDirs twice so they are left null for now
978  QList<const GeoScenePalette*> palette = filter->palette();
979  foreach (const GeoScenePalette *curPalette, palette ) {
980 
981  if( curPalette->type() == "sea" ) {
982  seafile = MarbleDirs::path( curPalette->file() );
983  } else if( curPalette->type() == "land" ) {
984  landfile = MarbleDirs::path( curPalette->file() );
985  }
986  }
987  //look up locations if they are empty
988  if( seafile.isEmpty() )
989  seafile = MarbleDirs::path( "seacolors.leg" );
990  if( landfile.isEmpty() )
991  landfile = MarbleDirs::path( "landcolors.leg" );
992  }
993  }
994 
995  m_textureLayer.setMapTheme( textures, textureLayerSettings, seafile, landfile );
996  m_textureLayer.setProjection( m_viewport.projection() );
997  m_textureLayer.setShowRelief( q->showRelief() );
998 
999  m_vectorTileLayer.setMapTheme( vectorTiles, vectorTileLayerSettings );
1000 
1001  if ( textureLayersOk )
1002  m_layerManager.addLayer( &m_textureLayer );
1003  if ( vectorTileLayersOk )
1004  m_layerManager.addLayer( &m_vectorTileLayer );
1005  }
1006  else {
1007  m_textureLayer.setMapTheme( QVector<const GeoSceneTextureTile *>(), 0, "", "" );
1008  m_vectorTileLayer.setMapTheme( QVector<const GeoSceneVectorTile *>(), 0 );
1009  }
1010 
1011  // earth
1012  m_placemarkLayer.setShowPlaces( q->showPlaces() );
1013 
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") );
1020 
1021  GeoDataFeature::setDefaultLabelColor( m_model->mapTheme()->map()->labelColor() );
1022  m_placemarkLayer.requestStyleReset();
1023 
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 );
1029 
1030  if ( propertyAvailable ) {
1031  renderPlugin->setVisible( propertyValue );
1032  }
1033  }
1034 
1035  emit q->themeChanged( m_model->mapTheme()->head()->mapThemeId() );
1036 }
1037 
1038 void MarbleMap::setPropertyValue( const QString& name, bool value )
1039 {
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();
1044  }
1045  else {
1046  mDebug() << "WARNING: Failed to access a map theme! Property: " << name;
1047  }
1048 }
1049 
1050 void MarbleMap::setShowOverviewMap( bool visible )
1051 {
1052  setPropertyValue( "overviewmap", visible );
1053 }
1054 
1055 void MarbleMap::setShowScaleBar( bool visible )
1056 {
1057  setPropertyValue( "scalebar", visible );
1058 }
1059 
1060 void MarbleMap::setShowCompass( bool visible )
1061 {
1062  setPropertyValue( "compass", visible );
1063 }
1064 
1065 void MarbleMap::setShowAtmosphere( bool visible )
1066 {
1067  foreach ( RenderPlugin *plugin, renderPlugins() ) {
1068  if ( plugin->nameId() == "atmosphere" ) {
1069  plugin->setVisible( visible );
1070  }
1071  }
1072 
1073  d->m_viewParams.setShowAtmosphere( visible );
1074 }
1075 
1076 void MarbleMap::setShowCrosshairs( bool visible )
1077 {
1078  QList<RenderPlugin *> pluginList = renderPlugins();
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 );
1084  }
1085  }
1086 }
1087 
1088 void MarbleMap::setShowClouds( bool visible )
1089 {
1090  d->m_viewParams.setShowClouds( visible );
1091 
1092  setPropertyValue( "clouds_data", visible );
1093 }
1094 
1095 void MarbleMap::setShowSunShading( bool visible )
1096 {
1097  d->m_textureLayer.setShowSunShading( visible );
1098 }
1099 
1100 void MarbleMap::setShowCityLights( bool visible )
1101 {
1102  d->m_textureLayer.setShowCityLights( visible );
1103  setPropertyValue( "citylights", visible );
1104 }
1105 
1106 void MarbleMap::setLockToSubSolarPoint( bool visible )
1107 {
1108  disconnect( d->m_model->sunLocator(), SIGNAL(positionChanged(qreal,qreal)),
1109  this, SLOT(centerOn(qreal,qreal)) );
1110 
1111  if( isLockedToSubSolarPoint() != visible ) {
1112  d->m_isLockedToSubSolarPoint = visible;
1113  }
1114 
1115  if ( isLockedToSubSolarPoint() ) {
1116  connect( d->m_model->sunLocator(), SIGNAL(positionChanged(qreal,qreal)),
1117  this, SLOT(centerOn(qreal,qreal)) );
1118 
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.";
1122  }
1123 }
1124 
1125 void MarbleMap::setSubSolarPointIconVisible( bool visible )
1126 {
1127  if ( isSubSolarPointIconVisible() != visible ) {
1128  d->m_isSubSolarPointIconVisible = visible;
1129  }
1130 }
1131 
1132 void MarbleMap::setShowTileId( bool visible )
1133 {
1134  d->m_textureLayer.setShowTileId( visible );
1135 }
1136 
1137 void MarbleMap::setShowGrid( bool visible )
1138 {
1139  setPropertyValue( "coordinate-grid", visible );
1140 }
1141 
1142 void MarbleMap::setShowPlaces( bool visible )
1143 {
1144  setPropertyValue( "places", visible );
1145 }
1146 
1147 void MarbleMap::setShowCities( bool visible )
1148 {
1149  setPropertyValue( "cities", visible );
1150 }
1151 
1152 void MarbleMap::setShowTerrain( bool visible )
1153 {
1154  setPropertyValue( "terrain", visible );
1155 }
1156 
1157 void MarbleMap::setShowOtherPlaces( bool visible )
1158 {
1159  setPropertyValue( "otherplaces", visible );
1160 }
1161 
1162 void MarbleMap::setShowRelief( bool visible )
1163 {
1164  setPropertyValue( "relief", visible );
1165 }
1166 
1167 void MarbleMap::setShowIceLayer( bool visible )
1168 {
1169  setPropertyValue( "ice", visible );
1170 }
1171 
1172 void MarbleMap::setShowBorders( bool visible )
1173 {
1174  setPropertyValue( "borders", visible );
1175 }
1176 
1177 void MarbleMap::setShowRivers( bool visible )
1178 {
1179  setPropertyValue( "rivers", visible );
1180 }
1181 
1182 void MarbleMap::setShowLakes( bool visible )
1183 {
1184  setPropertyValue( "lakes", visible );
1185 }
1186 
1187 void MarbleMap::setShowFrameRate( bool visible )
1188 {
1189  d->m_showFrameRate = visible;
1190 }
1191 
1192 void MarbleMap::setShowRuntimeTrace( bool visible )
1193 {
1194  d->m_layerManager.setShowRuntimeTrace( visible );
1195 }
1196 
1197 void MarbleMap::setShowBackground( bool visible )
1198 {
1199  d->m_layerManager.setShowBackground( visible );
1200 }
1201 
1202 void MarbleMap::notifyMouseClick( int x, int y )
1203 {
1204  qreal lon = 0;
1205  qreal lat = 0;
1206 
1207  const bool valid = geoCoordinates( x, y, lon, lat, GeoDataCoordinates::Radian );
1208 
1209  if ( valid ) {
1210  emit mouseClickGeoPosition( lon, lat, GeoDataCoordinates::Radian );
1211  }
1212 }
1213 
1214 void MarbleMap::clearVolatileTileCache()
1215 {
1216  d->m_vectorTileLayer.reset();
1217  d->m_textureLayer.reset();
1218  mDebug() << "Cleared Volatile Cache!";
1219 }
1220 
1221 void MarbleMap::setVolatileTileCacheLimit( quint64 kilobytes )
1222 {
1223  mDebug() << "kiloBytes" << kilobytes;
1224  d->m_textureLayer.setVolatileCacheLimit( kilobytes );
1225 }
1226 
1227 AngleUnit MarbleMap::defaultAngleUnit() const
1228 {
1229  if ( GeoDataCoordinates::defaultNotation() == GeoDataCoordinates::Decimal ) {
1230  return DecimalDegree;
1231  } else if ( GeoDataCoordinates::defaultNotation() == GeoDataCoordinates::UTM ) {
1232  return UTM;
1233  }
1234 
1235  return DMSDegree;
1236 }
1237 
1238 void MarbleMap::setDefaultAngleUnit( AngleUnit angleUnit )
1239 {
1240  if ( angleUnit == DecimalDegree ) {
1241  GeoDataCoordinates::setDefaultNotation( GeoDataCoordinates::Decimal );
1242  return;
1243  } else if ( angleUnit == UTM ) {
1244  GeoDataCoordinates::setDefaultNotation( GeoDataCoordinates::UTM );
1245  return;
1246  }
1247 
1248  GeoDataCoordinates::setDefaultNotation( GeoDataCoordinates::DMS );
1249 }
1250 
1251 QFont MarbleMap::defaultFont() const
1252 {
1253  return GeoDataFeature::defaultFont();
1254 }
1255 
1256 void MarbleMap::setDefaultFont( const QFont& font )
1257 {
1258  GeoDataFeature::setDefaultFont( font );
1259  d->m_placemarkLayer.requestStyleReset();
1260 }
1261 
1262 QList<RenderPlugin *> MarbleMap::renderPlugins() const
1263 {
1264  return d->m_layerManager.renderPlugins();
1265 }
1266 
1267 QList<AbstractFloatItem *> MarbleMap::floatItems() const
1268 {
1269  return d->m_layerManager.floatItems();
1270 }
1271 
1272 AbstractFloatItem * MarbleMap::floatItem( const QString &nameId ) const
1273 {
1274  foreach ( AbstractFloatItem * floatItem, floatItems() ) {
1275  if ( floatItem && floatItem->nameId() == nameId ) {
1276  return floatItem;
1277  }
1278  }
1279 
1280  return 0; // No item found
1281 }
1282 
1283 QList<AbstractDataPlugin *> MarbleMap::dataPlugins() const
1284 {
1285  return d->m_layerManager.dataPlugins();
1286 }
1287 
1288 QList<AbstractDataPluginItem *> MarbleMap::whichItemAt( const QPoint& curpos ) const
1289 {
1290  return d->m_layerManager.whichItemAt( curpos );
1291 }
1292 
1293 void MarbleMap::addLayer( LayerInterface *layer )
1294 {
1295  d->m_layerManager.addLayer(layer);
1296 }
1297 
1298 void MarbleMap::removeLayer( LayerInterface *layer )
1299 {
1300  d->m_layerManager.removeLayer(layer);
1301 }
1302 
1303 // this method will only temporarily "pollute" the MarbleModel class
1304 const TextureLayer *MarbleMap::textureLayer() const
1305 {
1306  return &d->m_textureLayer;
1307 }
1308 
1309 }
1310 
1311 #include "MarbleMap.moc"
Marble::GeoDataCoordinates::Unit
Unit
enum used constructor to specify the units used
Definition: GeoDataCoordinates.h:64
GeoSceneHead.h
VectorMapLayer.h
GeoDataDocument.h
Marble::MarbleMap::screenCoordinates
bool screenCoordinates(qreal lon, qreal lat, qreal &x, qreal &y) const
Get the screen coordinates corresponding to geographical coordinates in the map.
Definition: MarbleMap.cpp:694
Marble::MarbleMap::showCityLights
bool showCityLights() const
Return whether the city lights are shown instead of the night shadow.
Definition: MarbleMap.cpp:553
TileLoader.h
MarbleWidget::radius
int radius() const
FpsLayer.h
Marble::MarbleMap::showGrid
bool showGrid() const
Return whether the coordinate grid is visible.
Definition: MarbleMap.cpp:538
Marble::RAD2DEG
const qreal RAD2DEG
Definition: MarbleGlobal.h:201
Marble::MarbleMap::defaultAngleUnit
AngleUnit defaultAngleUnit() const
Definition: MarbleMap.cpp:1227
Marble::GeoDataCoordinates::UTM
Definition: GeoDataCoordinates.h:83
Marble::MarbleMap::showSunShading
bool showSunShading() const
Return whether the night shadow is visible.
Definition: MarbleMap.cpp:548
Marble::MarbleMap::setCenterLongitude
void setCenterLongitude(qreal lon)
Set the longitude for the center point.
Definition: MarbleMap.cpp:669
GeoScenePalette.h
Marble::MarbleMap::defaultFont
QFont defaultFont() const
Definition: MarbleMap.cpp:1251
FileManager.h
Marble::GeoDataCoordinates::Radian
Definition: GeoDataCoordinates.h:65
Marble::MarbleMap::showOverviewMap
bool showOverviewMap() const
Return whether the overview map is visible.
Definition: MarbleMap.cpp:523
Marble::MarbleMap::setDefaultFont
void setDefaultFont(const QFont &font)
Definition: MarbleMap.cpp:1256
MarbleWidget::mapThemeId
QString mapThemeId() const
Returns the currently active map theme id, if any, in the form of e.g.
TileCoordsPyramid.h
Marble::MarbleMap::setLockToSubSolarPoint
void setLockToSubSolarPoint(bool visible)
Set the globe locked to the sub solar point.
Definition: MarbleMap.cpp:1106
Marble::MarbleMap::volatileTileCacheLimit
quint64 volatileTileCacheLimit() const
Returns the limit in kilobytes of the volatile (in RAM) tile cache.
Definition: MarbleMap.cpp:644
GeoSceneGeodata.h
Marble::MarbleMap::radiusChanged
void radiusChanged(int radius)
Marble::MarbleDirs::path
static QString path(const QString &relativePath)
Definition: MarbleDirs.cpp:53
Marble::MarbleMap::setShowBorders
void setShowBorders(bool visible)
Set whether the borders visible.
Definition: MarbleMap.cpp:1172
Marble::MarbleMap::setPropertyValue
void setPropertyValue(const QString &name, bool value)
Sets the value of a map theme property.
Definition: MarbleMap.cpp:1038
Marble::MarbleMap::centerLatitude
qreal centerLatitude() const
Return the latitude of the center point.
Definition: MarbleMap.cpp:420
TileCreator.h
Marble::MarbleMap::addLayer
void addLayer(LayerInterface *layer)
Add a layer to be included in rendering.
Definition: MarbleMap.cpp:1293
DgmlAuxillaryDictionary.h
Marble::TileLoader::baseTilesAvailable
static bool baseTilesAvailable(GeoSceneTiled const &texture)
Returns whether the mandatory most basic tile level is fully available for the given texture layer...
Definition: TileLoader.cpp:168
Marble::GeoPainter
A painter that allows to draw geometric primitives on the map.
Definition: GeoPainter.h:98
Marble::MarbleMap::setShowRuntimeTrace
void setShowRuntimeTrace(bool visible)
Definition: MarbleMap.cpp:1192
Marble::MarbleMap::radius
int radius() const
Return the radius of the globe in pixels.
Definition: MarbleMap.cpp:378
Marble::MarbleMap::setShowCrosshairs
void setShowCrosshairs(bool visible)
Set whether the crosshairs are visible.
Definition: MarbleMap.cpp:1076
MarbleModel.h
This file contains the headers for MarbleModel.
Marble::MarbleMap::reload
void reload()
Reload the currently displayed map by reloading texture tiles from the Internet.
Definition: MarbleMap.cpp:457
Marble::ViewContext
ViewContext
This enum is used to choose context in which map quality gets used.
Definition: MarbleGlobal.h:72
AbstractFloatItem.h
Marble::MarbleMap::preferredRadiusFloor
int preferredRadiusFloor(int radius)
Definition: MarbleMap.cpp:405
Marble::MarbleMap::setShowRivers
void setShowRivers(bool visible)
Set whether the rivers are visible.
Definition: MarbleMap.cpp:1177
Marble::MarbleMap::showClouds
bool showClouds() const
Return whether the cloud cover is visible.
Definition: MarbleMap.cpp:543
Marble::MarbleMap::whichFeatureAt
QVector< const GeoDataPlacemark * > whichFeatureAt(const QPoint &) const
Definition: MarbleMap.cpp:452
Marble::MarbleMap::setSubSolarPointIconVisible
void setSubSolarPointIconVisible(bool visible)
Set whether the sun icon is shown in the sub solar point.
Definition: MarbleMap.cpp:1125
Marble::DecimalDegree
Degrees in decimal notation.
Definition: MarbleGlobal.h:65
Marble::UTM
UTM.
Definition: MarbleGlobal.h:66
PlacemarkLayer.h
Marble::GeoDataCoordinates::Decimal
"Decimal" notation (base-10)
Definition: GeoDataCoordinates.h:80
Marble::LayerInterface
Definition: LayerInterface.h:25
GeoSceneDocument.h
Marble::MapQuality
MapQuality
This enum is used to choose the map quality shown in the view.
Definition: MarbleGlobal.h:80
SunLocator.h
Marble::MarbleMap::showBorders
bool showBorders() const
Return whether the borders are visible.
Definition: MarbleMap.cpp:619
Marble::MarbleMap::setMapQualityForViewContext
void setMapQualityForViewContext(MapQuality qualityForViewContext, ViewContext viewContext)
Definition: MarbleMap.cpp:313
Marble::MarbleMap::size
QSize size() const
Definition: MarbleMap.cpp:363
MarbleWidget::projection
QString projection() const
Returns the active projection which can be either "Equirectangular", "Mercator" or "Spherical"...
MarbleDebug.h
Marble::MarbleMap::setViewContext
void setViewContext(ViewContext viewContext)
Definition: MarbleMap.cpp:331
Marble::MarbleMap::viewport
ViewportParams * viewport()
Definition: MarbleMap.cpp:302
Marble::MarbleMap::setShowTileId
void setShowTileId(bool visible)
Set whether the is tile is visible NOTE: This is part of the transitional debug API and might be subj...
Definition: MarbleMap.cpp:1132
Marble::FpsLayer::paint
void paint(QPainter *painter)
Definition: FpsLayer.cpp:28
Marble::MarbleMap::CustomPaintLayer
friend class CustomPaintLayer
Definition: MarbleMap.h:705
Marble::MarbleMap::mapQuality
MapQuality mapQuality() const
Return the current map quality.
Definition: MarbleMap.cpp:326
Marble::MarbleMap::model
MarbleModel * model() const
Return the model that this view shows.
Definition: MarbleMap.cpp:297
Marble::MarbleMap::setMapThemeId
void setMapThemeId(const QString &maptheme)
Set a new map theme.
Definition: MarbleMap.cpp:786
Marble::MarbleMap::setShowFrameRate
void setShowFrameRate(bool visible)
Set whether the frame rate gets shown.
Definition: MarbleMap.cpp:1187
Marble::MarbleMap::tileZoomLevel
int tileZoomLevel() const
Definition: MarbleMap.cpp:414
ViewParams.h
This file contains the headers for ViewParameters.
Marble::MarbleMap::~MarbleMap
virtual ~MarbleMap()
Definition: MarbleMap.cpp:280
Marble::MarbleMap::visibleLatLonAltBoxChanged
void visibleLatLonAltBoxChanged(const GeoDataLatLonAltBox &visibleLatLonAltBox)
This signal is emitted when the visible region of the map changes.
Marble::MarbleMap::width
int width() const
Definition: MarbleMap.cpp:368
MarbleWidget::renderPlugin
Marble::RenderPlugin * renderPlugin(const QString &name)
Definition: MarbleDeclarativeWidget.cpp:392
Marble::MarbleMap::setShowRelief
void setShowRelief(bool visible)
Set whether the relief is visible.
Definition: MarbleMap.cpp:1162
TextureLayer.h
Marble::MarbleMap::setShowAtmosphere
void setShowAtmosphere(bool visible)
Set whether the atmospheric glow is visible.
Definition: MarbleMap.cpp:1065
MarbleMap.h
This file contains the headers for MarbleMap.
VectorComposer.h
Marble::MarbleMap::setSize
void setSize(int width, int height)
Definition: MarbleMap.cpp:351
MarbleSplashLayer.h
Marble::MarbleMap::maximumZoom
int maximumZoom() const
return the minimum zoom value for the current map theme.
Definition: MarbleMap.cpp:444
MarbleWidget::visibleLatLonAltBoxChanged
void visibleLatLonAltBoxChanged()
Forwarded from MarbleWidget.
GroundLayer.h
Marble::MarbleMap::floatItems
QList< AbstractFloatItem * > floatItems() const
Definition: MarbleMap.cpp:1267
Marble::MarbleMap::rotateBy
void rotateBy(const qreal &deltaLon, const qreal &deltaLat)
Rotate the view by the two angles phi and theta.
Definition: MarbleMap.cpp:650
Marble::MarbleMap::showRivers
bool showRivers() const
Return whether the rivers are visible.
Definition: MarbleMap.cpp:624
Marble::MarbleMap::setShowCompass
void setShowCompass(bool visible)
Set whether the compass overlay is visible.
Definition: MarbleMap.cpp:1060
GeoSceneZoom.h
Marble::MarbleMap::setShowPlaces
void setShowPlaces(bool visible)
Set whether the place mark overlay is visible.
Definition: MarbleMap.cpp:1142
GeoSceneFilter.h
Marble::AbstractFloatItem
The abstract class for float item plugins.
Definition: AbstractFloatItem.h:48
Marble::MarbleMap::customPaint
virtual void customPaint(GeoPainter *painter)
Enables custom drawing onto the MarbleMap straight after.
Definition: MarbleMap.cpp:776
MarbleDirs.h
Marble::MarbleMap::setRadius
void setRadius(int radius)
Set the radius of the globe in pixels.
Definition: MarbleMap.cpp:383
GeoSceneVector.h
Marble::TextureLayer
Definition: TextureLayer.h:39
Marble::MarbleMap::removeLayer
void removeLayer(LayerInterface *layer)
Remove a layer from being included in rendering.
Definition: MarbleMap.cpp:1298
Marble::MarbleMap::setShowOverviewMap
void setShowOverviewMap(bool visible)
Set whether the overview map overlay is visible.
Definition: MarbleMap.cpp:1050
Marble::MarbleMap::showOtherPlaces
bool showOtherPlaces() const
Return whether other places are visible.
Definition: MarbleMap.cpp:604
Marble::MarbleMap::setShowBackground
void setShowBackground(bool visible)
Definition: MarbleMap.cpp:1197
Marble::MarbleMap::showCompass
bool showCompass() const
Return whether the compass bar is visible.
Definition: MarbleMap.cpp:533
Marble::MarbleMap::showCrosshairs
bool showCrosshairs() const
Return whether the crosshairs are visible.
Definition: MarbleMap.cpp:573
Marble::GeoDataFeature::setDefaultLabelColor
static void setDefaultLabelColor(const QColor &color)
Definition: GeoDataFeature.cpp:474
Marble::RenderPlugin::setVisible
void setVisible(bool visible)
settting visible
Definition: RenderPlugin.cpp:149
Marble::MarbleMap::showBackground
bool showBackground() const
Definition: MarbleMap.cpp:639
Marble::MarbleMap::paint
void paint(GeoPainter &painter, const QRect &dirtyRect)
Paint the map using a give painter.
Definition: MarbleMap.cpp:752
GeoPainter.h
Marble::MarbleMap::clearVolatileTileCache
void clearVolatileTileCache()
Definition: MarbleMap.cpp:1214
Marble::MarbleMap::setShowSunShading
void setShowSunShading(bool visible)
Set whether the night shadow is visible.
Definition: MarbleMap.cpp:1095
Marble::DEG2RAD
const qreal DEG2RAD
Definition: MarbleGlobal.h:200
GeometryLayer.h
Marble::MarbleMap::mouseClickGeoPosition
void mouseClickGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::Unit)
Marble::MarbleMap::minimumZoom
int minimumZoom() const
return the minimum zoom value for the current map theme.
Definition: MarbleMap.cpp:436
GeoDataTreeModel.h
Marble::MarbleMap::renderPlugins
QList< RenderPlugin * > renderPlugins() const
Returns a list of all RenderPlugins in the model, this includes float items.
Definition: MarbleMap.cpp:1262
Marble::ViewportParams
A public class that controls what is visible in the viewport of a Marble map.
Definition: ViewportParams.h:44
Marble::dgml::dgmlValue_geodata
const char * dgmlValue_geodata
Definition: DgmlAuxillaryDictionary.cpp:41
Marble::MarbleMap::geoCoordinates
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.
Definition: MarbleMap.cpp:700
Marble::MarbleMap::textureLayer
const TextureLayer * textureLayer() const
Definition: MarbleMap.cpp:1304
Marble::GeoDataFeature::setDefaultFont
static void setDefaultFont(const QFont &font)
Definition: GeoDataFeature.cpp:463
Marble::MarbleMap::setProjection
void setProjection(Projection projection)
Set the Projection used for the map.
Definition: MarbleMap.cpp:679
Marble::RenderPlugin::nameId
QString nameId
Definition: RenderPlugin.h:48
Marble::MarbleMap::setShowTerrain
void setShowTerrain(bool visible)
Set whether the terrain place mark overlay is visible.
Definition: MarbleMap.cpp:1152
GeoSceneVectorTile.h
Marble::MarbleMap::height
int height() const
Definition: MarbleMap.cpp:373
ViewportParams.h
This file contains the headers for ViewportParams.
Marble::MarbleMap::setCenterLatitude
void setCenterLatitude(qreal lat)
Set the latitude for the center point.
Definition: MarbleMap.cpp:664
Marble::MarbleMap::setShowClouds
void setShowClouds(bool visible)
Set whether the cloud cover is visible.
Definition: MarbleMap.cpp:1088
Marble::MarbleMap::setShowGrid
void setShowGrid(bool visible)
Set whether the coordinate grid overlay is visible.
Definition: MarbleMap.cpp:1137
Marble::MarbleMap::MarbleMap
MarbleMap()
Construct a new MarbleMap.
Definition: MarbleMap.cpp:256
Marble::MarbleMap::showScaleBar
bool showScaleBar() const
Return whether the scale bar is visible.
Definition: MarbleMap.cpp:528
Marble::MarbleMap::setVolatileTileCacheLimit
void setVolatileTileCacheLimit(quint64 kiloBytes)
Set the limit of the volatile (in RAM) tile cache.
Definition: MarbleMap.cpp:1221
VectorTileLayer.h
Marble::MarbleModel
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition: MarbleModel.h:96
Marble::MarbleMap::showLakes
bool showLakes() const
Return whether the lakes are visible.
Definition: MarbleMap.cpp:629
Marble::MarbleMap::centerLongitude
qreal centerLongitude() const
Return the longitude of the center point.
Definition: MarbleMap.cpp:428
Marble::TileId
Definition: TileId.h:27
Marble::MarbleMap::showFrameRate
bool showFrameRate() const
Return whether the frame rate gets displayed.
Definition: MarbleMap.cpp:634
GeoSceneSettings.h
Marble::MarbleMap::propertyValue
bool propertyValue(const QString &name) const
Return the property value by name.
Definition: MarbleMap.cpp:510
Marble::MarbleMap::isSubSolarPointIconVisible
bool isSubSolarPointIconVisible() const
Return whether the sun icon is shown in the sub solar point.
Definition: MarbleMap.cpp:563
Marble::DMSDegree
Degrees in DMS notation.
Definition: MarbleGlobal.h:64
Marble::MarbleMap::showAtmosphere
bool showAtmosphere() const
Return whether the atmospheric glow is visible.
Definition: MarbleMap.cpp:568
Marble::AngleUnit
AngleUnit
This enum is used to choose the unit chosen to measure angles.
Definition: MarbleGlobal.h:63
Marble::MarbleMap::downloadRegion
void downloadRegion(QVector< TileCoordsPyramid > const &)
Definition: MarbleMap.cpp:462
Marble::MarbleMap::showPlaces
bool showPlaces() const
Return whether the place marks are visible.
Definition: MarbleMap.cpp:589
Marble::MarbleMap::setShowOtherPlaces
void setShowOtherPlaces(bool visible)
Set whether the other places overlay is visible.
Definition: MarbleMap.cpp:1157
RenderPlugin.h
Marble::MarbleMap::dataPlugins
QList< AbstractDataPlugin * > dataPlugins() const
Returns a list of all DataPlugins on the layer.
Definition: MarbleMap.cpp:1283
Marble::MarbleMap::framesPerSecond
void framesPerSecond(qreal fps)
Marble::MarbleMap::whichItemAt
QList< AbstractDataPluginItem * > whichItemAt(const QPoint &curpos) const
Returns all widgets of dataPlugins on the position curpos.
Definition: MarbleMap.cpp:1288
Marble::MarbleMap::setShowIceLayer
void setShowIceLayer(bool visible)
Set whether the ice layer is visible.
Definition: MarbleMap.cpp:1167
Marble::MarbleMap::showRelief
bool showRelief() const
Return whether the relief is visible.
Definition: MarbleMap.cpp:609
Marble::MarbleMap::projection
Projection projection() const
Get the Projection used for the map.
Definition: MarbleMap.cpp:674
Marble::MarbleMap::isLockedToSubSolarPoint
bool isLockedToSubSolarPoint() const
Return whether the globe is locked to the sub solar point.
Definition: MarbleMap.cpp:558
Marble::Projection
Projection
This enum is used to choose the projection shown in the view.
Definition: MarbleGlobal.h:44
Marble::GeoDataCoordinates::setDefaultNotation
static void setDefaultNotation(GeoDataCoordinates::Notation notation)
set the Notation of the string representation
Definition: GeoDataCoordinates.cpp:770
Marble::FpsLayer
Definition: FpsLayer.h:20
Marble::MarbleMap::mapThemeId
QString mapThemeId() const
Get the ID of the current map theme To ensure that a unique identifier is being used the theme does N...
Definition: MarbleMap.cpp:781
Marble::MarbleMap::showCities
bool showCities() const
Return whether the city place marks are visible.
Definition: MarbleMap.cpp:594
MarbleWidget
Wraps a Marble::MarbleWidget, providing access to important properties and methods.
Definition: MarbleDeclarativeWidget.h:50
Marble::MarbleMap::centerOn
void centerOn(const qreal lon, const qreal lat)
Center the view on a geographical point.
Definition: MarbleMap.cpp:657
Marble::dgml::dgmlValue_texture
const char * dgmlValue_texture
Definition: DgmlAuxillaryDictionary.cpp:38
Marble::MarbleMap::floatItem
AbstractFloatItem * floatItem(const QString &nameId) const
Returns a list of all FloatItems in the model.
Definition: MarbleMap.cpp:1272
LayerManager.h
Marble::MarbleMap::setShowCityLights
void setShowCityLights(bool visible)
Set whether city lights instead of night shadow are visible.
Definition: MarbleMap.cpp:1100
MarbleWidget::model
Marble::MarbleModel * model()
Definition: MarbleDeclarativeWidget.cpp:85
Marble::MarbleMap::viewContext
ViewContext viewContext() const
Definition: MarbleMap.cpp:345
Marble::MarbleMap::showIceLayer
bool showIceLayer() const
Return whether the ice layer is visible.
Definition: MarbleMap.cpp:614
Marble::GeoDataFeature::defaultFont
static QFont defaultFont()
Definition: GeoDataFeature.cpp:458
Marble::MarbleMap::setDefaultAngleUnit
void setDefaultAngleUnit(AngleUnit angleUnit)
Definition: MarbleMap.cpp:1238
Marble::GeoDataCoordinates::DMS
"Sexagesimal DMS" notation (base-60)
Definition: GeoDataCoordinates.h:81
Marble::GeoDataCoordinates::defaultNotation
static GeoDataCoordinates::Notation defaultNotation()
return Notation of string representation
Definition: GeoDataCoordinates.cpp:764
Marble::MarbleMap::setShowLakes
void setShowLakes(bool visible)
Set whether the lakes are visible.
Definition: MarbleMap.cpp:1182
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:31
Marble::MarbleMap::showTerrain
bool showTerrain() const
Return whether the terrain place marks are visible.
Definition: MarbleMap.cpp:599
Marble::RenderPlugin
The abstract class that creates a renderable item.
Definition: RenderPlugin.h:43
Marble::MarbleMap::setShowCities
void setShowCities(bool visible)
Set whether the city place mark overlay is visible.
Definition: MarbleMap.cpp:1147
GeoSceneMap.h
Marble::MarbleMap::preferredRadiusCeil
int preferredRadiusCeil(int radius)
Definition: MarbleMap.cpp:396
MapThemeManager.h
VectorMapBaseLayer.h
TileCreatorDialog.h
Marble::MarbleMap::repaintNeeded
void repaintNeeded(const QRegion &dirtyRegion=QRegion())
This signal is emitted when the repaint of the view was requested.
GeoSceneLayer.h
FogLayer.h
Marble::MarbleMap::projectionChanged
void projectionChanged(Projection)
Marble::dgml::dgmlValue_vectortile
const char * dgmlValue_vectortile
Definition: DgmlAuxillaryDictionary.cpp:40
Marble::MarbleMap::setShowScaleBar
void setShowScaleBar(bool visible)
Set whether the scale bar overlay is visible.
Definition: MarbleMap.cpp:1055
Marble::MarbleMap::notifyMouseClick
void notifyMouseClick(int x, int y)
used to notify about the position of the mouse click
Definition: MarbleMap.cpp:1202
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal