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

marble

  • sources
  • kde-4.14
  • 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/VectorTileLayer.h"
43 #include "AbstractFloatItem.h"
44 #include "DgmlAuxillaryDictionary.h"
45 #include "FileManager.h"
46 #include "GeoDataTreeModel.h"
47 #include "GeoPainter.h"
48 #include "GeoSceneDocument.h"
49 #include "GeoSceneFilter.h"
50 #include "GeoSceneGeodata.h"
51 #include "GeoSceneHead.h"
52 #include "GeoSceneLayer.h"
53 #include "GeoSceneMap.h"
54 #include "GeoScenePalette.h"
55 #include "GeoSceneSettings.h"
56 #include "GeoSceneVector.h"
57 #include "GeoSceneVectorTile.h"
58 #include "GeoSceneZoom.h"
59 #include "GeoDataDocument.h"
60 #include "LayerManager.h"
61 #include "MapThemeManager.h"
62 #include "MarbleDebug.h"
63 #include "MarbleDirs.h"
64 #include "MarbleModel.h"
65 #include "RenderPlugin.h"
66 #include "SunLocator.h"
67 #include "TileCoordsPyramid.h"
68 #include "TileCreator.h"
69 #include "TileCreatorDialog.h"
70 #include "TileLoader.h"
71 #include "ViewParams.h"
72 #include "ViewportParams.h"
73 
74 
75 namespace Marble
76 {
77 
78 
79 class MarbleMap::CustomPaintLayer : public LayerInterface
80 {
81 public:
82  CustomPaintLayer( MarbleMap *map )
83  : m_map( map )
84  {
85  }
86 
87  virtual QStringList renderPosition() const { return QStringList() << "USER_TOOLS"; }
88 
89  virtual bool render( GeoPainter *painter, ViewportParams *viewport,
90  const QString &renderPos, GeoSceneLayer *layer )
91  {
92  Q_UNUSED( viewport );
93  Q_UNUSED( renderPos );
94  Q_UNUSED( layer );
95 
96  m_map->customPaint( painter );
97 
98  return true;
99  }
100 
101  virtual qreal zValue() const { return 1.0e6; }
102 
103  RenderState renderState() const { return RenderState( "Custom Map Paint" ); }
104 
105  virtual QString runtimeTrace() const { return "CustomPaint"; }
106 
107 private:
108  MarbleMap *const m_map;
109 };
110 
111 
112 class MarbleMapPrivate
113 {
114  friend class MarbleWidget;
115 
116 public:
117  explicit MarbleMapPrivate( MarbleMap *parent, MarbleModel *model );
118 
119  void updateMapTheme();
120 
121  void updateProperty( const QString &, bool );
122 
123  void setDocument( QString key );
124 
125  MarbleMap *const q;
126 
127  // The model we are showing.
128  MarbleModel *const m_model;
129  bool m_modelIsOwned;
130 
131  // Parameters for the maps appearance.
132  ViewParams m_viewParams;
133  ViewportParams m_viewport;
134  bool m_showFrameRate;
135 
136 
137  LayerManager m_layerManager;
138  MarbleSplashLayer m_marbleSplashLayer;
139  MarbleMap::CustomPaintLayer m_customPaintLayer;
140  GeometryLayer m_geometryLayer;
141  FogLayer m_fogLayer;
142  GroundLayer m_groundLayer;
143  TextureLayer m_textureLayer;
144  PlacemarkLayer m_placemarkLayer;
145  VectorTileLayer m_vectorTileLayer;
146 
147  bool m_isLockedToSubSolarPoint;
148  bool m_isSubSolarPointIconVisible;
149  RenderState m_renderState;
150 };
151 
152 MarbleMapPrivate::MarbleMapPrivate( MarbleMap *parent, MarbleModel *model ) :
153  q( parent ),
154  m_model( model ),
155  m_viewParams(),
156  m_showFrameRate( false ),
157  m_layerManager( model, parent ),
158  m_customPaintLayer( parent ),
159  m_geometryLayer( model->treeModel() ),
160  m_textureLayer( model->downloadManager(), model->sunLocator(), model->groundOverlayModel() ),
161  m_placemarkLayer( model->placemarkModel(), model->placemarkSelectionModel(), model->clock() ),
162  m_vectorTileLayer( model->downloadManager(), model->pluginManager(), model->treeModel() ),
163  m_isLockedToSubSolarPoint( false ),
164  m_isSubSolarPointIconVisible( false )
165 {
166  m_layerManager.addLayer( &m_fogLayer );
167  m_layerManager.addLayer( &m_groundLayer );
168  m_layerManager.addLayer( &m_geometryLayer );
169  m_layerManager.addLayer( &m_placemarkLayer );
170  m_layerManager.addLayer( &m_customPaintLayer );
171 
172  QObject::connect( m_model, SIGNAL(themeChanged(QString)),
173  parent, SLOT(updateMapTheme()) );
174  QObject::connect( m_model->fileManager(), SIGNAL(fileAdded(QString)),
175  parent, SLOT(setDocument(QString)) );
176 
177 
178  QObject::connect( &m_placemarkLayer, SIGNAL(repaintNeeded()),
179  parent, SIGNAL(repaintNeeded()));
180 
181  QObject::connect ( &m_layerManager, SIGNAL(pluginSettingsChanged()),
182  parent, SIGNAL(pluginSettingsChanged()) );
183  QObject::connect ( &m_layerManager, SIGNAL(repaintNeeded(QRegion)),
184  parent, SIGNAL(repaintNeeded(QRegion)) );
185  QObject::connect ( &m_layerManager, SIGNAL(renderPluginInitialized(RenderPlugin*)),
186  parent, SIGNAL(renderPluginInitialized(RenderPlugin*)) );
187  QObject::connect ( &m_layerManager, SIGNAL(visibilityChanged(QString,bool)),
188  parent, SLOT(setPropertyValue(QString,bool)) );
189 
190  QObject::connect( &m_geometryLayer, SIGNAL(repaintNeeded()),
191  parent, SIGNAL(repaintNeeded()));
192 
193  QObject::connect( &m_textureLayer, SIGNAL(tileLevelChanged(int)),
194  parent, SIGNAL(tileLevelChanged(int)) );
195  QObject::connect( &m_textureLayer, SIGNAL(repaintNeeded()),
196  parent, SIGNAL(repaintNeeded()) );
197 
198  QObject::connect( parent, SIGNAL(visibleLatLonAltBoxChanged(GeoDataLatLonAltBox)),
199  parent, SIGNAL(repaintNeeded()) );
200 }
201 
202 void MarbleMapPrivate::updateProperty( const QString &name, bool show )
203 {
204  // earth
205  if ( name == "places" ) {
206  m_placemarkLayer.setShowPlaces( show );
207  } else if ( name == "cities" ) {
208  m_placemarkLayer.setShowCities( show );
209  } else if ( name == "terrain" ) {
210  m_placemarkLayer.setShowTerrain( show );
211  } else if ( name == "otherplaces" ) {
212  m_placemarkLayer.setShowOtherPlaces( show );
213  }
214 
215  // other planets
216  else if ( name == "landingsites" ) {
217  m_placemarkLayer.setShowLandingSites( show );
218  } else if ( name == "craters" ) {
219  m_placemarkLayer.setShowCraters( show );
220  } else if ( name == "maria" ) {
221  m_placemarkLayer.setShowMaria( show );
222  }
223 
224  else if ( name == "relief" ) {
225  m_textureLayer.setShowRelief( show );
226  }
227 
228  foreach( RenderPlugin *renderPlugin, m_layerManager.renderPlugins() ) {
229  if ( name == renderPlugin->nameId() ) {
230  if ( renderPlugin->visible() == show ) {
231  break;
232  }
233 
234  renderPlugin->setVisible( show );
235 
236  break;
237  }
238  }
239 }
240 
241 // ----------------------------------------------------------------
242 
243 
244 MarbleMap::MarbleMap()
245  : d( new MarbleMapPrivate( this, new MarbleModel( this ) ) )
246 {
247 #ifdef MARBLE_DBUS
248  QDBusConnection::sessionBus().registerObject( "/MarbleMap", this,
249  QDBusConnection::ExportAllSlots
250  | QDBusConnection::ExportAllSignals
251  | QDBusConnection::ExportAllProperties );
252 #endif
253 }
254 
255 MarbleMap::MarbleMap(MarbleModel *model)
256  : d( new MarbleMapPrivate( this, model ) )
257 {
258 #ifdef MARBLE_DBUS
259  QDBusConnection::sessionBus().registerObject( "/MarbleMap", this,
260  QDBusConnection::ExportAllSlots
261  | QDBusConnection::ExportAllSignals
262  | QDBusConnection::ExportAllProperties );
263 #endif
264 
265  d->m_modelIsOwned = false;
266 }
267 
268 MarbleMap::~MarbleMap()
269 {
270  MarbleModel *model = d->m_modelIsOwned ? d->m_model : 0;
271 
272  d->m_layerManager.removeLayer( &d->m_customPaintLayer );
273  d->m_layerManager.removeLayer( &d->m_geometryLayer );
274  d->m_layerManager.removeLayer( &d->m_fogLayer );
275  d->m_layerManager.removeLayer( &d->m_placemarkLayer );
276  d->m_layerManager.removeLayer( &d->m_textureLayer );
277  d->m_layerManager.removeLayer( &d->m_groundLayer );
278  delete d;
279 
280  delete model; // delete the model after private data
281 }
282 
283 MarbleModel *MarbleMap::model() const
284 {
285  return d->m_model;
286 }
287 
288 ViewportParams *MarbleMap::viewport()
289 {
290  return &d->m_viewport;
291 }
292 
293 const ViewportParams *MarbleMap::viewport() const
294 {
295  return &d->m_viewport;
296 }
297 
298 
299 void MarbleMap::setMapQualityForViewContext( MapQuality quality, ViewContext viewContext )
300 {
301  d->m_viewParams.setMapQualityForViewContext( quality, viewContext );
302 
303  // Update texture map during the repaint that follows:
304  d->m_textureLayer.setNeedsUpdate();
305 }
306 
307 MapQuality MarbleMap::mapQuality( ViewContext viewContext ) const
308 {
309  return d->m_viewParams.mapQuality( viewContext );
310 }
311 
312 MapQuality MarbleMap::mapQuality() const
313 {
314  return d->m_viewParams.mapQuality();
315 }
316 
317 void MarbleMap::setViewContext( ViewContext viewContext )
318 {
319  const MapQuality oldQuality = d->m_viewParams.mapQuality();
320 
321  d->m_viewParams.setViewContext( viewContext );
322 
323  if ( d->m_viewParams.mapQuality() != oldQuality ) {
324  // Update texture map during the repaint that follows:
325  d->m_textureLayer.setNeedsUpdate();
326 
327  emit repaintNeeded();
328  }
329 }
330 
331 ViewContext MarbleMap::viewContext() const
332 {
333  return d->m_viewParams.viewContext();
334 }
335 
336 
337 void MarbleMap::setSize( int width, int height )
338 {
339  setSize( QSize( width, height ) );
340 }
341 
342 void MarbleMap::setSize( const QSize& size )
343 {
344  d->m_viewport.setSize( size );
345 
346  emit visibleLatLonAltBoxChanged( d->m_viewport.viewLatLonAltBox() );
347 }
348 
349 QSize MarbleMap::size() const
350 {
351  return QSize( d->m_viewport.width(), d->m_viewport.height() );
352 }
353 
354 int MarbleMap::width() const
355 {
356  return d->m_viewport.width();
357 }
358 
359 int MarbleMap::height() const
360 {
361  return d->m_viewport.height();
362 }
363 
364 int MarbleMap::radius() const
365 {
366  return d->m_viewport.radius();
367 }
368 
369 void MarbleMap::setRadius( int radius )
370 {
371  const int oldRadius = d->m_viewport.radius();
372 
373  d->m_viewport.setRadius( radius );
374 
375  if ( oldRadius != d->m_viewport.radius() ) {
376  emit radiusChanged( radius );
377  emit visibleLatLonAltBoxChanged( d->m_viewport.viewLatLonAltBox() );
378  }
379 }
380 
381 
382 int MarbleMap::preferredRadiusCeil( int radius )
383 {
384  if ( !d->m_layerManager.internalLayers().contains( &d->m_textureLayer ) )
385  return radius;
386 
387  return d->m_textureLayer.preferredRadiusCeil( radius );
388 }
389 
390 
391 int MarbleMap::preferredRadiusFloor( int radius )
392 {
393  if ( !d->m_layerManager.internalLayers().contains( &d->m_textureLayer ) )
394  return radius;
395 
396  return d->m_textureLayer.preferredRadiusFloor( radius );
397 }
398 
399 
400 int MarbleMap::tileZoomLevel() const
401 {
402  return d->m_textureLayer.tileZoomLevel();
403 }
404 
405 
406 qreal MarbleMap::centerLatitude() const
407 {
408  // Calculate translation of center point
409  const qreal centerLat = d->m_viewport.centerLatitude();
410 
411  return centerLat * RAD2DEG;
412 }
413 
414 qreal MarbleMap::centerLongitude() const
415 {
416  // Calculate translation of center point
417  const qreal centerLon = d->m_viewport.centerLongitude();
418 
419  return centerLon * RAD2DEG;
420 }
421 
422 int MarbleMap::minimumZoom() const
423 {
424  if ( d->m_model->mapTheme() )
425  return d->m_model->mapTheme()->head()->zoom()->minimum();
426 
427  return 950;
428 }
429 
430 int MarbleMap::maximumZoom() const
431 {
432  if ( d->m_model->mapTheme() )
433  return d->m_model->mapTheme()->head()->zoom()->maximum();
434 
435  return 2100;
436 }
437 
438 QVector<const GeoDataPlacemark*> MarbleMap::whichFeatureAt( const QPoint& curpos ) const
439 {
440  return d->m_placemarkLayer.whichPlacemarkAt( curpos );
441 }
442 
443 void MarbleMap::reload()
444 {
445  d->m_textureLayer.reload();
446 }
447 
448 void MarbleMap::downloadRegion( QVector<TileCoordsPyramid> const & pyramid )
449 {
450  Q_ASSERT( textureLayer() );
451  Q_ASSERT( !pyramid.isEmpty() );
452  QTime t;
453  t.start();
454 
455  // When downloading a region (the author of these lines thinks) most users probably expect
456  // the download to begin with the low resolution tiles and then procede level-wise to
457  // higher resolution tiles. In order to achieve this, we start requesting downloads of
458  // high resolution tiles and request the low resolution tiles at the end because
459  // DownloadQueueSet (silly name) is implemented as stack.
460 
461 
462  int const first = 0;
463  int tilesCount = 0;
464 
465  for ( int level = pyramid[first].bottomLevel(); level >= pyramid[first].topLevel(); --level ) {
466  QSet<TileId> tileIdSet;
467  for( int i = 0; i < pyramid.size(); ++i ) {
468  QRect const coords = pyramid[i].coords( level );
469  mDebug() << "MarbleMap::downloadRegion level:" << level << "tile coords:" << coords;
470  int x1, y1, x2, y2;
471  coords.getCoords( &x1, &y1, &x2, &y2 );
472  for ( int x = x1; x <= x2; ++x ) {
473  for ( int y = y1; y <= y2; ++y ) {
474  TileId const stackedTileId( 0, level, x, y );
475  tileIdSet.insert( stackedTileId );
476  // FIXME: use lazy evaluation to not generate up to 100k tiles in one go
477  // this can take considerable time even on very fast systems
478  // in contrast generating the TileIds on the fly when they are needed
479  // does not seem to affect download speed.
480  }
481  }
482  }
483  QSetIterator<TileId> i( tileIdSet );
484  while( i.hasNext() ) {
485  TileId const tileId = i.next();
486  d->m_textureLayer.downloadStackedTile( tileId );
487  }
488  tilesCount += tileIdSet.count();
489  }
490  // Needed for downloading unique tiles only. Much faster than if tiles for each level is downloaded separately
491 
492  int const elapsedMs = t.elapsed();
493  mDebug() << "MarbleMap::downloadRegion:" << tilesCount << "tiles, " << elapsedMs << "ms";
494 }
495 
496 bool MarbleMap::propertyValue( const QString& name ) const
497 {
498  bool value;
499  if ( d->m_model->mapTheme() ) {
500  d->m_model->mapTheme()->settings()->propertyValue( name, value );
501  }
502  else {
503  value = false;
504  mDebug() << "WARNING: Failed to access a map theme! Property: " << name;
505  }
506  return value;
507 }
508 
509 bool MarbleMap::showOverviewMap() const
510 {
511  return propertyValue( "overviewmap" );
512 }
513 
514 bool MarbleMap::showScaleBar() const
515 {
516  return propertyValue( "scalebar" );
517 }
518 
519 bool MarbleMap::showCompass() const
520 {
521  return propertyValue( "compass" );
522 }
523 
524 bool MarbleMap::showGrid() const
525 {
526  return propertyValue( "coordinate-grid" );
527 }
528 
529 bool MarbleMap::showClouds() const
530 {
531  return d->m_viewParams.showClouds();
532 }
533 
534 bool MarbleMap::showSunShading() const
535 {
536  return d->m_textureLayer.showSunShading();
537 }
538 
539 bool MarbleMap::showCityLights() const
540 {
541  return d->m_textureLayer.showCityLights();
542 }
543 
544 bool MarbleMap::isLockedToSubSolarPoint() const
545 {
546  return d->m_isLockedToSubSolarPoint;
547 }
548 
549 bool MarbleMap::isSubSolarPointIconVisible() const
550 {
551  return d->m_isSubSolarPointIconVisible;
552 }
553 
554 bool MarbleMap::showAtmosphere() const
555 {
556  return d->m_viewParams.showAtmosphere();
557 }
558 
559 bool MarbleMap::showCrosshairs() const
560 {
561  bool visible = false;
562 
563  QList<RenderPlugin *> pluginList = renderPlugins();
564  QList<RenderPlugin *>::const_iterator i = pluginList.constBegin();
565  QList<RenderPlugin *>::const_iterator const end = pluginList.constEnd();
566  for (; i != end; ++i ) {
567  if ( (*i)->nameId() == "crosshairs" ) {
568  visible = (*i)->visible();
569  }
570  }
571 
572  return visible;
573 }
574 
575 bool MarbleMap::showPlaces() const
576 {
577  return propertyValue( "places" );
578 }
579 
580 bool MarbleMap::showCities() const
581 {
582  return propertyValue( "cities" );
583 }
584 
585 bool MarbleMap::showTerrain() const
586 {
587  return propertyValue( "terrain" );
588 }
589 
590 bool MarbleMap::showOtherPlaces() const
591 {
592  return propertyValue( "otherplaces" );
593 }
594 
595 bool MarbleMap::showRelief() const
596 {
597  return propertyValue( "relief" );
598 }
599 
600 bool MarbleMap::showIceLayer() const
601 {
602  return propertyValue( "ice" );
603 }
604 
605 bool MarbleMap::showBorders() const
606 {
607  return propertyValue( "borders" );
608 }
609 
610 bool MarbleMap::showRivers() const
611 {
612  return propertyValue( "rivers" );
613 }
614 
615 bool MarbleMap::showLakes() const
616 {
617  return propertyValue( "lakes" );
618 }
619 
620 bool MarbleMap::showFrameRate() const
621 {
622  return d->m_showFrameRate;
623 }
624 
625 bool MarbleMap::showBackground() const
626 {
627  return d->m_layerManager.showBackground();
628 }
629 
630 quint64 MarbleMap::volatileTileCacheLimit() const
631 {
632  return d->m_textureLayer.volatileCacheLimit();
633 }
634 
635 
636 void MarbleMap::rotateBy( const qreal& deltaLon, const qreal& deltaLat )
637 {
638  centerOn( d->m_viewport.centerLongitude() * RAD2DEG + deltaLon,
639  d->m_viewport.centerLatitude() * RAD2DEG + deltaLat );
640 }
641 
642 
643 void MarbleMap::centerOn( const qreal lon, const qreal lat )
644 {
645  d->m_viewport.centerOn( lon * DEG2RAD, lat * DEG2RAD );
646 
647  emit visibleLatLonAltBoxChanged( d->m_viewport.viewLatLonAltBox() );
648 }
649 
650 void MarbleMap::setCenterLatitude( qreal lat )
651 {
652  centerOn( centerLongitude(), lat );
653 }
654 
655 void MarbleMap::setCenterLongitude( qreal lon )
656 {
657  centerOn( lon, centerLatitude() );
658 }
659 
660 Projection MarbleMap::projection() const
661 {
662  return d->m_viewport.projection();
663 }
664 
665 void MarbleMap::setProjection( Projection projection )
666 {
667  if ( d->m_viewport.projection() == projection )
668  return;
669 
670  emit projectionChanged( projection );
671 
672  d->m_viewport.setProjection( projection );
673 
674  d->m_textureLayer.setProjection( projection );
675 
676  emit visibleLatLonAltBoxChanged( d->m_viewport.viewLatLonAltBox() );
677 }
678 
679 
680 bool MarbleMap::screenCoordinates( qreal lon, qreal lat,
681  qreal& x, qreal& y ) const
682 {
683  return d->m_viewport.screenCoordinates( lon * DEG2RAD, lat * DEG2RAD, x, y );
684 }
685 
686 bool MarbleMap::geoCoordinates( int x, int y,
687  qreal& lon, qreal& lat,
688  GeoDataCoordinates::Unit unit ) const
689 {
690  return d->m_viewport.geoCoordinates( x, y, lon, lat, unit );
691 }
692 
693 void MarbleMapPrivate::setDocument( QString key )
694 {
695  if ( !m_model->mapTheme() ) {
696  // Happens if no valid map theme is set or at application startup
697  // if a file is passed via command line parameters and the last
698  // map theme has not been loaded yet
703  return;
704  }
705 
706  GeoDataDocument* doc = m_model->fileManager()->at( key );
707 
708  foreach ( const GeoSceneLayer *layer, m_model->mapTheme()->map()->layers() ) {
709  if ( layer->backend() != dgml::dgmlValue_geodata
710  && layer->backend() != dgml::dgmlValue_vector )
711  continue;
712 
713  // look for documents
714  foreach ( const GeoSceneAbstractDataset *dataset, layer->datasets() ) {
715  const GeoSceneGeodata *data = static_cast<const GeoSceneGeodata*>( dataset );
716  QString containername = data->sourceFile();
717  QString colorize = data->colorize();
718  if( key == containername ) {
719  if( colorize == "land" ) {
720  m_textureLayer.addLandDocument( doc );
721  }
722  if( colorize == "sea" ) {
723  m_textureLayer.addSeaDocument( doc );
724  }
725 
726  // set visibility according to theme property
727  if( !data->property().isEmpty() ) {
728  bool value;
729  m_model->mapTheme()->settings()->propertyValue( data->property(), value );
730  doc->setVisible( value );
731  m_model->treeModel()->updateFeature( doc );
732  }
733  }
734  }
735  }
736 }
737 
738 // Used to be paintEvent()
739 void MarbleMap::paint( GeoPainter &painter, const QRect &dirtyRect )
740 {
741  Q_UNUSED( dirtyRect );
742 
743  if ( !d->m_model->mapTheme() ) {
744  mDebug() << "No theme yet!";
745  d->m_marbleSplashLayer.render( &painter, &d->m_viewport );
746  return;
747  }
748 
749  QTime t;
750  t.start();
751 
752  RenderStatus const oldRenderStatus = d->m_renderState.status();
753  d->m_layerManager.renderLayers( &painter, &d->m_viewport );
754  d->m_renderState = d->m_layerManager.renderState();
755  bool const parsing = d->m_model->fileManager()->pendingFiles() > 0;
756  d->m_renderState.addChild( RenderState( "Files", parsing ? WaitingForData : Complete ) );
757  RenderStatus const newRenderStatus = d->m_renderState.status();
758  if ( oldRenderStatus != newRenderStatus ) {
759  emit renderStatusChanged( newRenderStatus );
760  }
761  emit renderStateChanged( d->m_renderState );
762 
763  if ( d->m_showFrameRate ) {
764  FpsLayer fpsPainter( &t );
765  fpsPainter.paint( &painter );
766  }
767 
768  const qreal fps = 1000.0 / (qreal)( t.elapsed() );
769  emit framesPerSecond( fps );
770 }
771 
772 void MarbleMap::customPaint( GeoPainter *painter )
773 {
774  Q_UNUSED( painter );
775 }
776 
777 QString MarbleMap::mapThemeId() const
778 {
779  return d->m_model->mapThemeId();
780 }
781 
782 void MarbleMap::setMapThemeId( const QString& mapThemeId )
783 {
784  d->m_model->setMapThemeId( mapThemeId );
785 }
786 
787 void MarbleMapPrivate::updateMapTheme()
788 {
789  m_layerManager.removeLayer( &m_textureLayer );
790  // FIXME Find a better way to do this reset. Maybe connect to themeChanged SIGNAL?
791  m_vectorTileLayer.reset();
792  m_layerManager.removeLayer( &m_vectorTileLayer );
793  m_layerManager.removeLayer( &m_groundLayer );
794 
795  QObject::connect( m_model->mapTheme()->settings(), SIGNAL(valueChanged(QString,bool)),
796  q, SLOT(updateProperty(QString,bool)) );
797  QObject::connect( m_model->mapTheme()->settings(), SIGNAL(valueChanged(QString,bool)),
798  m_model, SLOT(updateProperty(QString,bool)) );
799 
800  q->setPropertyValue( "clouds_data", m_viewParams.showClouds() );
801 
802  if ( !m_model->mapTheme()->map()->hasTextureLayers() ) {
803  m_groundLayer.setColor( m_model->mapTheme()->map()->backgroundColor() );
804  m_layerManager.addLayer( &m_groundLayer );
805  }
806 
807  // Check whether there is a texture layer and vectortile layer available:
808  if ( m_model->mapTheme()->map()->hasTextureLayers() ) {
809  const GeoSceneSettings *const settings = m_model->mapTheme()->settings();
810  const GeoSceneGroup *const textureLayerSettings = settings ? settings->group( "Texture Layers" ) : 0;
811  const GeoSceneGroup *const vectorTileLayerSettings = settings ? settings->group( "VectorTile Layers" ) : 0;
812 
813  bool textureLayersOk = true;
814  bool vectorTileLayersOk = true;
815 
816  // textures will contain texture layers and
817  // vectorTiles vectortile layers
818  QVector<const GeoSceneTextureTile *> textures;
819  QVector<const GeoSceneVectorTile *> vectorTiles;
820 
821  foreach( GeoSceneLayer* layer, m_model->mapTheme()->map()->layers() ){
822  if ( layer->backend() == dgml::dgmlValue_texture ){
823 
824  foreach ( const GeoSceneAbstractDataset *pos, layer->datasets() ) {
825  const GeoSceneTextureTile *const texture = dynamic_cast<GeoSceneTextureTile const *>( pos );
826  if ( !texture )
827  continue;
828 
829  const QString sourceDir = texture->sourceDir();
830  const QString installMap = texture->installMap();
831  const QString role = layer->role();
832 
833  // If the tiles aren't already there, put up a progress dialog
834  // while creating them.
835  if ( !TileLoader::baseTilesAvailable( *texture )
836  && !installMap.isEmpty() )
837  {
838  mDebug() << "Base tiles not available. Creating Tiles ... \n"
839  << "SourceDir: " << sourceDir << "InstallMap:" << installMap;
840 
841  TileCreator *tileCreator = new TileCreator(
842  sourceDir,
843  installMap,
844  (role == "dem") ? "true" : "false" );
845  tileCreator->setTileFormat( texture->fileFormat().toLower() );
846 
847  QPointer<TileCreatorDialog> tileCreatorDlg = new TileCreatorDialog( tileCreator, 0 );
848  tileCreatorDlg->setSummary( m_model->mapTheme()->head()->name(),
849  m_model->mapTheme()->head()->description() );
850  tileCreatorDlg->exec();
851  if ( TileLoader::baseTilesAvailable( *texture ) ) {
852  mDebug() << "Base tiles for" << sourceDir << "successfully created.";
853  } else {
854  qWarning() << "Some or all base tiles for" << sourceDir << "could not be created.";
855  }
856 
857  delete tileCreatorDlg;
858  }
859 
860  if ( TileLoader::baseTilesAvailable( *texture ) ) {
861  textures.append( texture );
862  } else {
863  qWarning() << "Base tiles for" << sourceDir << "not available. Skipping all texture layers.";
864  textureLayersOk = false;
865  }
866  }
867  }
868  else if ( layer->backend() == dgml::dgmlValue_vectortile ){
869 
870  foreach ( const GeoSceneAbstractDataset *pos, layer->datasets() ) {
871  const GeoSceneVectorTile *const vectorTile = dynamic_cast<GeoSceneVectorTile const *>( pos );
872  if ( !vectorTile )
873  continue;
874 
875  const QString sourceDir = vectorTile->sourceDir();
876  const QString installMap = vectorTile->installMap();
877  const QString role = layer->role();
878 
879  // If the tiles aren't already there, put up a progress dialog
880  // while creating them.
881  if ( !TileLoader::baseTilesAvailable( *vectorTile )
882  && !installMap.isEmpty() )
883  {
884  mDebug() << "Base tiles not available. Creating Tiles ... \n"
885  << "SourceDir: " << sourceDir << "InstallMap:" << installMap;
886 
887  TileCreator *tileCreator = new TileCreator(
888  sourceDir,
889  installMap,
890  (role == "dem") ? "true" : "false" );
891  tileCreator->setTileFormat( vectorTile->fileFormat().toLower() );
892 
893  QPointer<TileCreatorDialog> tileCreatorDlg = new TileCreatorDialog( tileCreator, 0 );
894  tileCreatorDlg->setSummary( m_model->mapTheme()->head()->name(),
895  m_model->mapTheme()->head()->description() );
896  tileCreatorDlg->exec();
897  if ( TileLoader::baseTilesAvailable( *vectorTile ) ) {
898  qDebug() << "Base tiles for" << sourceDir << "successfully created.";
899  } else {
900  qDebug() << "Some or all base tiles for" << sourceDir << "could not be created.";
901  }
902 
903  delete tileCreatorDlg;
904  }
905 
906  if ( TileLoader::baseTilesAvailable( *vectorTile ) ) {
907  vectorTiles.append( vectorTile );
908  } else {
909  qWarning() << "Base tiles for" << sourceDir << "not available. Skipping all texture layers.";
910  vectorTileLayersOk = false;
911  }
912  }
913  }
914  }
915 
916  QString seafile, landfile;
917  if( !m_model->mapTheme()->map()->filters().isEmpty() ) {
918  const GeoSceneFilter *filter= m_model->mapTheme()->map()->filters().first();
919 
920  if( filter->type() == "colorize" ) {
921  //no need to look up with MarbleDirs twice so they are left null for now
922  QList<const GeoScenePalette*> palette = filter->palette();
923  foreach (const GeoScenePalette *curPalette, palette ) {
924 
925  if( curPalette->type() == "sea" ) {
926  seafile = MarbleDirs::path( curPalette->file() );
927  } else if( curPalette->type() == "land" ) {
928  landfile = MarbleDirs::path( curPalette->file() );
929  }
930  }
931  //look up locations if they are empty
932  if( seafile.isEmpty() )
933  seafile = MarbleDirs::path( "seacolors.leg" );
934  if( landfile.isEmpty() )
935  landfile = MarbleDirs::path( "landcolors.leg" );
936  }
937  }
938 
939  m_textureLayer.setMapTheme( textures, textureLayerSettings, seafile, landfile );
940  m_textureLayer.setProjection( m_viewport.projection() );
941  m_textureLayer.setShowRelief( q->showRelief() );
942 
943  m_vectorTileLayer.setMapTheme( vectorTiles, vectorTileLayerSettings );
944 
945  if ( textureLayersOk )
946  m_layerManager.addLayer( &m_textureLayer );
947  if ( vectorTileLayersOk )
948  m_layerManager.addLayer( &m_vectorTileLayer );
949  }
950  else {
951  m_textureLayer.setMapTheme( QVector<const GeoSceneTextureTile *>(), 0, "", "" );
952  m_vectorTileLayer.setMapTheme( QVector<const GeoSceneVectorTile *>(), 0 );
953  }
954 
955  // earth
956  m_placemarkLayer.setShowPlaces( q->showPlaces() );
957 
958  m_placemarkLayer.setShowCities( q->showCities() );
959  m_placemarkLayer.setShowTerrain( q->showTerrain() );
960  m_placemarkLayer.setShowOtherPlaces( q->showOtherPlaces() );
961  m_placemarkLayer.setShowLandingSites( q->propertyValue("landingsites") );
962  m_placemarkLayer.setShowCraters( q->propertyValue("craters") );
963  m_placemarkLayer.setShowMaria( q->propertyValue("maria") );
964 
965  GeoDataFeature::setDefaultLabelColor( m_model->mapTheme()->map()->labelColor() );
966  m_placemarkLayer.requestStyleReset();
967 
968  foreach( RenderPlugin *renderPlugin, m_layerManager.renderPlugins() ) {
969  bool propertyAvailable = false;
970  m_model->mapTheme()->settings()->propertyAvailable( renderPlugin->nameId(), propertyAvailable );
971  bool propertyValue = false;
972  m_model->mapTheme()->settings()->propertyValue( renderPlugin->nameId(), propertyValue );
973 
974  if ( propertyAvailable ) {
975  renderPlugin->setVisible( propertyValue );
976  }
977  }
978 
979  emit q->themeChanged( m_model->mapTheme()->head()->mapThemeId() );
980 }
981 
982 void MarbleMap::setPropertyValue( const QString& name, bool value )
983 {
984  mDebug() << "In MarbleMap the property " << name << "was set to " << value;
985  if ( d->m_model->mapTheme() ) {
986  d->m_model->mapTheme()->settings()->setPropertyValue( name, value );
987  d->m_textureLayer.setNeedsUpdate();
988  }
989  else {
990  mDebug() << "WARNING: Failed to access a map theme! Property: " << name;
991  }
992 }
993 
994 void MarbleMap::setShowOverviewMap( bool visible )
995 {
996  setPropertyValue( "overviewmap", visible );
997 }
998 
999 void MarbleMap::setShowScaleBar( bool visible )
1000 {
1001  setPropertyValue( "scalebar", visible );
1002 }
1003 
1004 void MarbleMap::setShowCompass( bool visible )
1005 {
1006  setPropertyValue( "compass", visible );
1007 }
1008 
1009 void MarbleMap::setShowAtmosphere( bool visible )
1010 {
1011  foreach ( RenderPlugin *plugin, renderPlugins() ) {
1012  if ( plugin->nameId() == "atmosphere" ) {
1013  plugin->setVisible( visible );
1014  }
1015  }
1016 
1017  d->m_viewParams.setShowAtmosphere( visible );
1018 }
1019 
1020 void MarbleMap::setShowCrosshairs( bool visible )
1021 {
1022  QList<RenderPlugin *> pluginList = renderPlugins();
1023  QList<RenderPlugin *>::const_iterator i = pluginList.constBegin();
1024  QList<RenderPlugin *>::const_iterator const end = pluginList.constEnd();
1025  for (; i != end; ++i ) {
1026  if ( (*i)->nameId() == "crosshairs" ) {
1027  (*i)->setVisible( visible );
1028  }
1029  }
1030 }
1031 
1032 void MarbleMap::setShowClouds( bool visible )
1033 {
1034  d->m_viewParams.setShowClouds( visible );
1035 
1036  setPropertyValue( "clouds_data", visible );
1037 }
1038 
1039 void MarbleMap::setShowSunShading( bool visible )
1040 {
1041  d->m_textureLayer.setShowSunShading( visible );
1042 }
1043 
1044 void MarbleMap::setShowCityLights( bool visible )
1045 {
1046  d->m_textureLayer.setShowCityLights( visible );
1047  setPropertyValue( "citylights", visible );
1048 }
1049 
1050 void MarbleMap::setLockToSubSolarPoint( bool visible )
1051 {
1052  disconnect( d->m_model->sunLocator(), SIGNAL(positionChanged(qreal,qreal)),
1053  this, SLOT(centerOn(qreal,qreal)) );
1054 
1055  if( isLockedToSubSolarPoint() != visible ) {
1056  d->m_isLockedToSubSolarPoint = visible;
1057  }
1058 
1059  if ( isLockedToSubSolarPoint() ) {
1060  connect( d->m_model->sunLocator(), SIGNAL(positionChanged(qreal,qreal)),
1061  this, SLOT(centerOn(qreal,qreal)) );
1062 
1063  centerOn( d->m_model->sunLocator()->getLon(), d->m_model->sunLocator()->getLat() );
1064  } else if ( visible ) {
1065  mDebug() << "Ignoring centering on sun, since the sun plugin is not loaded.";
1066  }
1067 }
1068 
1069 void MarbleMap::setSubSolarPointIconVisible( bool visible )
1070 {
1071  if ( isSubSolarPointIconVisible() != visible ) {
1072  d->m_isSubSolarPointIconVisible = visible;
1073  }
1074 }
1075 
1076 void MarbleMap::setShowTileId( bool visible )
1077 {
1078  d->m_textureLayer.setShowTileId( visible );
1079 }
1080 
1081 void MarbleMap::setShowGrid( bool visible )
1082 {
1083  setPropertyValue( "coordinate-grid", visible );
1084 }
1085 
1086 void MarbleMap::setShowPlaces( bool visible )
1087 {
1088  setPropertyValue( "places", visible );
1089 }
1090 
1091 void MarbleMap::setShowCities( bool visible )
1092 {
1093  setPropertyValue( "cities", visible );
1094 }
1095 
1096 void MarbleMap::setShowTerrain( bool visible )
1097 {
1098  setPropertyValue( "terrain", visible );
1099 }
1100 
1101 void MarbleMap::setShowOtherPlaces( bool visible )
1102 {
1103  setPropertyValue( "otherplaces", visible );
1104 }
1105 
1106 void MarbleMap::setShowRelief( bool visible )
1107 {
1108  setPropertyValue( "relief", visible );
1109 }
1110 
1111 void MarbleMap::setShowIceLayer( bool visible )
1112 {
1113  setPropertyValue( "ice", visible );
1114 }
1115 
1116 void MarbleMap::setShowBorders( bool visible )
1117 {
1118  setPropertyValue( "borders", visible );
1119 }
1120 
1121 void MarbleMap::setShowRivers( bool visible )
1122 {
1123  setPropertyValue( "rivers", visible );
1124 }
1125 
1126 void MarbleMap::setShowLakes( bool visible )
1127 {
1128  setPropertyValue( "lakes", visible );
1129 }
1130 
1131 void MarbleMap::setShowFrameRate( bool visible )
1132 {
1133  d->m_showFrameRate = visible;
1134 }
1135 
1136 void MarbleMap::setShowRuntimeTrace( bool visible )
1137 {
1138  d->m_layerManager.setShowRuntimeTrace( visible );
1139 }
1140 
1141 void MarbleMap::setShowBackground( bool visible )
1142 {
1143  d->m_layerManager.setShowBackground( visible );
1144 }
1145 
1146 void MarbleMap::notifyMouseClick( int x, int y )
1147 {
1148  qreal lon = 0;
1149  qreal lat = 0;
1150 
1151  const bool valid = geoCoordinates( x, y, lon, lat, GeoDataCoordinates::Radian );
1152 
1153  if ( valid ) {
1154  emit mouseClickGeoPosition( lon, lat, GeoDataCoordinates::Radian );
1155  }
1156 }
1157 
1158 void MarbleMap::clearVolatileTileCache()
1159 {
1160  d->m_vectorTileLayer.reset();
1161  d->m_textureLayer.reset();
1162  mDebug() << "Cleared Volatile Cache!";
1163 }
1164 
1165 void MarbleMap::setVolatileTileCacheLimit( quint64 kilobytes )
1166 {
1167  mDebug() << "kiloBytes" << kilobytes;
1168  d->m_textureLayer.setVolatileCacheLimit( kilobytes );
1169 }
1170 
1171 AngleUnit MarbleMap::defaultAngleUnit() const
1172 {
1173  if ( GeoDataCoordinates::defaultNotation() == GeoDataCoordinates::Decimal ) {
1174  return DecimalDegree;
1175  } else if ( GeoDataCoordinates::defaultNotation() == GeoDataCoordinates::UTM ) {
1176  return UTM;
1177  }
1178 
1179  return DMSDegree;
1180 }
1181 
1182 void MarbleMap::setDefaultAngleUnit( AngleUnit angleUnit )
1183 {
1184  if ( angleUnit == DecimalDegree ) {
1185  GeoDataCoordinates::setDefaultNotation( GeoDataCoordinates::Decimal );
1186  return;
1187  } else if ( angleUnit == UTM ) {
1188  GeoDataCoordinates::setDefaultNotation( GeoDataCoordinates::UTM );
1189  return;
1190  }
1191 
1192  GeoDataCoordinates::setDefaultNotation( GeoDataCoordinates::DMS );
1193 }
1194 
1195 QFont MarbleMap::defaultFont() const
1196 {
1197  return GeoDataFeature::defaultFont();
1198 }
1199 
1200 void MarbleMap::setDefaultFont( const QFont& font )
1201 {
1202  GeoDataFeature::setDefaultFont( font );
1203  d->m_placemarkLayer.requestStyleReset();
1204 }
1205 
1206 QList<RenderPlugin *> MarbleMap::renderPlugins() const
1207 {
1208  return d->m_layerManager.renderPlugins();
1209 }
1210 
1211 QList<AbstractFloatItem *> MarbleMap::floatItems() const
1212 {
1213  return d->m_layerManager.floatItems();
1214 }
1215 
1216 AbstractFloatItem * MarbleMap::floatItem( const QString &nameId ) const
1217 {
1218  foreach ( AbstractFloatItem * floatItem, floatItems() ) {
1219  if ( floatItem && floatItem->nameId() == nameId ) {
1220  return floatItem;
1221  }
1222  }
1223 
1224  return 0; // No item found
1225 }
1226 
1227 QList<AbstractDataPlugin *> MarbleMap::dataPlugins() const
1228 {
1229  return d->m_layerManager.dataPlugins();
1230 }
1231 
1232 QList<AbstractDataPluginItem *> MarbleMap::whichItemAt( const QPoint& curpos ) const
1233 {
1234  return d->m_layerManager.whichItemAt( curpos );
1235 }
1236 
1237 void MarbleMap::addLayer( LayerInterface *layer )
1238 {
1239  d->m_layerManager.addLayer(layer);
1240 }
1241 
1242 void MarbleMap::removeLayer( LayerInterface *layer )
1243 {
1244  d->m_layerManager.removeLayer(layer);
1245 }
1246 
1247 RenderStatus MarbleMap::renderStatus() const
1248 {
1249  return d->m_layerManager.renderState().status();
1250 }
1251 
1252 RenderState MarbleMap::renderState() const
1253 {
1254  return d->m_layerManager.renderState();
1255 }
1256 
1257 // this method will only temporarily "pollute" the MarbleModel class
1258 TextureLayer *MarbleMap::textureLayer() const
1259 {
1260  return &d->m_textureLayer;
1261 }
1262 
1263 }
1264 
1265 #include "MarbleMap.moc"
Marble::GeoDataCoordinates::Unit
Unit
enum used constructor to specify the units used
Definition: GeoDataCoordinates.h:64
Marble::FpsLayer::paint
void paint(QPainter *painter) const
Definition: FpsLayer.cpp:28
GeoSceneHead.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:680
Marble::MarbleMap::showCityLights
bool showCityLights() const
Return whether the city lights are shown instead of the night shadow.
Definition: MarbleMap.cpp:539
TileLoader.h
FpsLayer.h
Marble::MarbleMap::showGrid
bool showGrid() const
Return whether the coordinate grid is visible.
Definition: MarbleMap.cpp:524
Marble::MarbleMap::renderState
RenderState renderState() const
Definition: MarbleMap.cpp:1252
Marble::WaitingForData
Rendering is based on no or partial data, more data was requested (e.g. pending network queries) ...
Definition: MarbleGlobal.h:194
Marble::RAD2DEG
const qreal RAD2DEG
Definition: MarbleGlobal.h:220
Marble::MarbleMap::defaultAngleUnit
AngleUnit defaultAngleUnit() const
Definition: MarbleMap.cpp:1171
QGraphicsItem::x
qreal x() const
Marble::GeoDataCoordinates::UTM
Definition: GeoDataCoordinates.h:83
QGraphicsItem::y
qreal y() const
Marble::MarbleMap::showSunShading
bool showSunShading() const
Return whether the night shadow is visible.
Definition: MarbleMap.cpp:534
Marble::MarbleMap::setCenterLongitude
void setCenterLongitude(qreal lon)
Set the longitude for the center point.
Definition: MarbleMap.cpp:655
GeoScenePalette.h
Marble::MarbleMap::defaultFont
QFont defaultFont() const
Definition: MarbleMap.cpp:1195
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:509
Marble::MarbleMap::setDefaultFont
void setDefaultFont(const QFont &font)
Definition: MarbleMap.cpp:1200
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:1050
Marble::MarbleMap::volatileTileCacheLimit
quint64 volatileTileCacheLimit() const
Returns the limit in kilobytes of the volatile (in RAM) tile cache.
Definition: MarbleMap.cpp:630
GeoSceneGeodata.h
Marble::MarbleMap::radiusChanged
void radiusChanged(int radius)
Marble::MarbleDirs::path
static QString path(const QString &relativePath)
Definition: MarbleDirs.cpp:59
Marble::MarbleMap::setShowBorders
void setShowBorders(bool visible)
Set whether the borders visible.
Definition: MarbleMap.cpp:1116
Marble::MarbleMap::setPropertyValue
void setPropertyValue(const QString &name, bool value)
Sets the value of a map theme property.
Definition: MarbleMap.cpp:982
QVector::append
void append(const T &value)
Marble::MarbleMap::centerLatitude
qreal centerLatitude() const
Return the latitude of the center point.
Definition: MarbleMap.cpp:406
TileCreator.h
Marble::MarbleMap::addLayer
void addLayer(LayerInterface *layer)
Add a layer to be included in rendering.
Definition: MarbleMap.cpp:1237
QGraphicsWidget::palette
QPalette palette() const
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:1136
Marble::MarbleMap::radius
int radius() const
Return the radius of the globe in pixels.
Definition: MarbleMap.cpp:364
Marble::MarbleMap::setShowCrosshairs
void setShowCrosshairs(bool visible)
Set whether the crosshairs are visible.
Definition: MarbleMap.cpp:1020
MarbleModel.h
This file contains the headers for MarbleModel.
QRect::getCoords
void getCoords(int *x1, int *y1, int *x2, int *y2) const
QFont
Marble::MarbleMap::reload
void reload()
Reload the currently displayed map by reloading texture tiles from the Internet.
Definition: MarbleMap.cpp:443
Marble::ViewContext
ViewContext
This enum is used to choose context in which map quality gets used.
Definition: MarbleGlobal.h:74
AbstractFloatItem.h
QPointer
QDBusConnection::registerObject
bool registerObject(const QString &path, QObject *object, QFlags< QDBusConnection::RegisterOption > options)
QGraphicsObject::visible
visible
Marble::MarbleMap::preferredRadiusFloor
int preferredRadiusFloor(int radius)
Definition: MarbleMap.cpp:391
Marble::MarbleMap::setShowRivers
void setShowRivers(bool visible)
Set whether the rivers are visible.
Definition: MarbleMap.cpp:1121
Marble::MarbleMap::showClouds
bool showClouds() const
Return whether the cloud cover is visible.
Definition: MarbleMap.cpp:529
Marble::MarbleMap::whichFeatureAt
QVector< const GeoDataPlacemark * > whichFeatureAt(const QPoint &) const
Definition: MarbleMap.cpp:438
Marble::MarbleMap::setSubSolarPointIconVisible
void setSubSolarPointIconVisible(bool visible)
Set whether the sun icon is shown in the sub solar point.
Definition: MarbleMap.cpp:1069
Marble::DecimalDegree
Degrees in decimal notation.
Definition: MarbleGlobal.h:67
Marble::UTM
UTM.
Definition: MarbleGlobal.h:68
PlacemarkLayer.h
Marble::GeoDataCoordinates::Decimal
"Decimal" notation (base-10)
Definition: GeoDataCoordinates.h:80
Marble::LayerInterface
Definition: LayerInterface.h:26
GeoSceneDocument.h
QDBusConnection::sessionBus
QDBusConnection sessionBus()
Marble::MapQuality
MapQuality
This enum is used to choose the map quality shown in the view.
Definition: MarbleGlobal.h:82
SunLocator.h
QPoint
Marble::MarbleMap::showBorders
bool showBorders() const
Return whether the borders are visible.
Definition: MarbleMap.cpp:605
QSet::insert
const_iterator insert(const T &value)
Marble::MarbleMap::setMapQualityForViewContext
void setMapQualityForViewContext(MapQuality qualityForViewContext, ViewContext viewContext)
Definition: MarbleMap.cpp:299
Marble::MarbleMap::size
QSize size() const
Definition: MarbleMap.cpp:349
QObject::disconnect
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QTime
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:317
QList::const_iterator
Marble::MarbleMap::viewport
ViewportParams * viewport()
Definition: MarbleMap.cpp:288
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:1076
Marble::MarbleMap::CustomPaintLayer
friend class CustomPaintLayer
Definition: MarbleMap.h:718
Marble::MarbleMap::mapQuality
MapQuality mapQuality() const
Return the current map quality.
Definition: MarbleMap.cpp:312
Marble::MarbleMap::renderStateChanged
void renderStateChanged(const RenderState &state)
Marble::MarbleMap::model
MarbleModel * model() const
Return the model that this view shows.
Definition: MarbleMap.cpp:283
Marble::MarbleMap::setMapThemeId
void setMapThemeId(const QString &maptheme)
Set a new map theme.
Definition: MarbleMap.cpp:782
Marble::MarbleMap::setShowFrameRate
void setShowFrameRate(bool visible)
Set whether the frame rate gets shown.
Definition: MarbleMap.cpp:1131
QGraphicsWidget::size
QSizeF size() const
Marble::MarbleMap::tileZoomLevel
int tileZoomLevel() const
Definition: MarbleMap.cpp:400
ViewParams.h
This file contains the headers for ViewParameters.
Marble::MarbleMap::~MarbleMap
virtual ~MarbleMap()
Definition: MarbleMap.cpp:268
QGraphicsWidget::font
QFont font() const
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:354
MarbleWidget::renderPlugin
Marble::RenderPlugin * renderPlugin(const QString &name)
Definition: MarbleDeclarativeWidget.cpp:394
QObject::name
const char * name() const
Marble::MarbleMap::setShowRelief
void setShowRelief(bool visible)
Set whether the relief is visible.
Definition: MarbleMap.cpp:1106
TextureLayer.h
QRect
Marble::MarbleMap::setShowAtmosphere
void setShowAtmosphere(bool visible)
Set whether the atmospheric glow is visible.
Definition: MarbleMap.cpp:1009
QGraphicsItem::pos
QPointF pos() const
QTime::elapsed
int elapsed() const
MarbleMap.h
This file contains the headers for MarbleMap.
Marble::MarbleMap::setSize
void setSize(int width, int height)
Definition: MarbleMap.cpp:337
MarbleSplashLayer.h
Marble::MarbleMap::maximumZoom
int maximumZoom() const
return the minimum zoom value for the current map theme.
Definition: MarbleMap.cpp:430
MarbleWidget::visibleLatLonAltBoxChanged
void visibleLatLonAltBoxChanged()
Forwarded from MarbleWidget.
GroundLayer.h
Marble::MarbleMap::floatItems
QList< AbstractFloatItem * > floatItems() const
Definition: MarbleMap.cpp:1211
QSetIterator::hasNext
bool hasNext() const
Marble::MarbleMap::rotateBy
void rotateBy(const qreal &deltaLon, const qreal &deltaLat)
Rotate the view by the two angles phi and theta.
Definition: MarbleMap.cpp:636
Marble::MarbleMap::showRivers
bool showRivers() const
Return whether the rivers are visible.
Definition: MarbleMap.cpp:610
Marble::MarbleMap::setShowCompass
void setShowCompass(bool visible)
Set whether the compass overlay is visible.
Definition: MarbleMap.cpp:1004
GeoSceneZoom.h
Marble::MarbleMap::setShowPlaces
void setShowPlaces(bool visible)
Set whether the place mark overlay is visible.
Definition: MarbleMap.cpp:1086
GeoSceneFilter.h
Marble::AbstractFloatItem
The abstract class for float item plugins.
Definition: AbstractFloatItem.h:45
Marble::MarbleMap::customPaint
virtual void customPaint(GeoPainter *painter)
Enables custom drawing onto the MarbleMap straight after.
Definition: MarbleMap.cpp:772
MarbleDirs.h
Marble::radius
static qreal radius(qreal zoom)
Definition: thumbnailer.cpp:99
QString::isEmpty
bool isEmpty() const
Marble::MarbleMap::setRadius
void setRadius(int radius)
Set the radius of the globe in pixels.
Definition: MarbleMap.cpp:369
GeoSceneVector.h
Marble::TextureLayer
Definition: TextureLayer.h:38
Marble::MarbleMap::removeLayer
void removeLayer(LayerInterface *layer)
Remove a layer from being included in rendering.
Definition: MarbleMap.cpp:1242
Marble::MarbleMap::setShowOverviewMap
void setShowOverviewMap(bool visible)
Set whether the overview map overlay is visible.
Definition: MarbleMap.cpp:994
Marble::MarbleMap::showOtherPlaces
bool showOtherPlaces() const
Return whether other places are visible.
Definition: MarbleMap.cpp:590
Marble::MarbleMap::setShowBackground
void setShowBackground(bool visible)
Definition: MarbleMap.cpp:1141
Marble::MarbleMap::showCompass
bool showCompass() const
Return whether the compass bar is visible.
Definition: MarbleMap.cpp:519
Marble::MarbleMap::showCrosshairs
bool showCrosshairs() const
Return whether the crosshairs are visible.
Definition: MarbleMap.cpp:559
Marble::GeoDataFeature::setDefaultLabelColor
static void setDefaultLabelColor(const QColor &color)
Definition: GeoDataFeature.cpp:538
QSet
Marble::RenderPlugin::setVisible
void setVisible(bool visible)
settting visible
Definition: RenderPlugin.cpp:151
QString
QList
Marble::MarbleMap::showBackground
bool showBackground() const
Definition: MarbleMap.cpp:625
Marble::RenderStatus
RenderStatus
Definition: MarbleGlobal.h:191
Marble::MarbleMap::paint
void paint(GeoPainter &painter, const QRect &dirtyRect)
Paint the map using a give painter.
Definition: MarbleMap.cpp:739
GeoPainter.h
QSet::count
int count() const
Marble::MarbleMap::clearVolatileTileCache
void clearVolatileTileCache()
Definition: MarbleMap.cpp:1158
Marble::MarbleMap::setShowSunShading
void setShowSunShading(bool visible)
Set whether the night shadow is visible.
Definition: MarbleMap.cpp:1039
Marble::DEG2RAD
const qreal DEG2RAD
Definition: MarbleGlobal.h:219
Marble::RenderState
Definition: RenderState.h:22
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:422
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:1206
QSetIterator
QStringList
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:686
Marble::MarbleMap::textureLayer
TextureLayer * textureLayer() const
Definition: MarbleMap.cpp:1258
Marble::GeoDataFeature::setDefaultFont
static void setDefaultFont(const QFont &font)
Definition: GeoDataFeature.cpp:527
Marble::MarbleMap::setProjection
void setProjection(Projection projection)
Set the Projection used for the map.
Definition: MarbleMap.cpp:665
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:1096
GeoSceneVectorTile.h
QSize
Marble::MarbleMap::height
int height() const
Definition: MarbleMap.cpp:359
ViewportParams.h
This file contains the headers for ViewportParams.
Marble::Complete
All data is there and up to date.
Definition: MarbleGlobal.h:192
Marble::MarbleMap::setCenterLatitude
void setCenterLatitude(qreal lat)
Set the latitude for the center point.
Definition: MarbleMap.cpp:650
Marble::MarbleMap::setShowClouds
void setShowClouds(bool visible)
Set whether the cloud cover is visible.
Definition: MarbleMap.cpp:1032
Marble::MarbleMap::setShowGrid
void setShowGrid(bool visible)
Set whether the coordinate grid overlay is visible.
Definition: MarbleMap.cpp:1081
Marble::MarbleMap::MarbleMap
MarbleMap()
Construct a new MarbleMap.
Definition: MarbleMap.cpp:244
Marble::MarbleMap::showScaleBar
bool showScaleBar() const
Return whether the scale bar is visible.
Definition: MarbleMap.cpp:514
Marble::MarbleMap::renderStatus
RenderStatus renderStatus() const
Definition: MarbleMap.cpp:1247
Marble::MarbleMap::setVolatileTileCacheLimit
void setVolatileTileCacheLimit(quint64 kiloBytes)
Set the limit of the volatile (in RAM) tile cache.
Definition: MarbleMap.cpp:1165
VectorTileLayer.h
Marble::MarbleModel
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition: MarbleModel.h:97
Marble::MarbleMap::showLakes
bool showLakes() const
Return whether the lakes are visible.
Definition: MarbleMap.cpp:615
QGraphicsItem::data
QVariant data(int key) const
Marble::MarbleMap::centerLongitude
qreal centerLongitude() const
Return the longitude of the center point.
Definition: MarbleMap.cpp:414
Marble::TileId
Definition: TileId.h:27
Marble::MarbleMap::showFrameRate
bool showFrameRate() const
Return whether the frame rate gets displayed.
Definition: MarbleMap.cpp:620
GeoSceneSettings.h
QSetIterator::next
const T & next()
Marble::MarbleMap::propertyValue
bool propertyValue(const QString &name) const
Return the property value by name.
Definition: MarbleMap.cpp:496
QVector
Marble::MarbleMap::isSubSolarPointIconVisible
bool isSubSolarPointIconVisible() const
Return whether the sun icon is shown in the sub solar point.
Definition: MarbleMap.cpp:549
Marble::DMSDegree
Degrees in DMS notation.
Definition: MarbleGlobal.h:66
Marble::MarbleMap::showAtmosphere
bool showAtmosphere() const
Return whether the atmospheric glow is visible.
Definition: MarbleMap.cpp:554
Marble::AngleUnit
AngleUnit
This enum is used to choose the unit chosen to measure angles.
Definition: MarbleGlobal.h:65
Marble::MarbleMap::downloadRegion
void downloadRegion(QVector< TileCoordsPyramid > const &)
Definition: MarbleMap.cpp:448
Marble::MarbleMap::showPlaces
bool showPlaces() const
Return whether the place marks are visible.
Definition: MarbleMap.cpp:575
QVector::isEmpty
bool isEmpty() const
Marble::MarbleMap::setShowOtherPlaces
void setShowOtherPlaces(bool visible)
Set whether the other places overlay is visible.
Definition: MarbleMap.cpp:1101
RenderPlugin.h
Marble::MarbleMap::dataPlugins
QList< AbstractDataPlugin * > dataPlugins() const
Returns a list of all DataPlugins on the layer.
Definition: MarbleMap.cpp:1227
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:1232
Marble::MarbleMap::setShowIceLayer
void setShowIceLayer(bool visible)
Set whether the ice layer is visible.
Definition: MarbleMap.cpp:1111
Marble::MarbleMap::showRelief
bool showRelief() const
Return whether the relief is visible.
Definition: MarbleMap.cpp:595
Marble::MarbleMap::projection
Projection projection() const
Get the Projection used for the map.
Definition: MarbleMap.cpp:660
Marble::MarbleMap::isLockedToSubSolarPoint
bool isLockedToSubSolarPoint() const
Return whether the globe is locked to the sub solar point.
Definition: MarbleMap.cpp:544
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
QTime::start
void start()
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:777
QtConcurrent::filter
QFuture< void > filter(Sequence &sequence, FilterFunction filterFunction)
Marble::MarbleMap::showCities
bool showCities() const
Return whether the city place marks are visible.
Definition: MarbleMap.cpp:580
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:643
QGraphicsItem::show
void show()
QList::constEnd
const_iterator constEnd() const
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:1216
QList::constBegin
const_iterator constBegin() const
LayerManager.h
Marble::MarbleMap::setShowCityLights
void setShowCityLights(bool visible)
Set whether city lights instead of night shadow are visible.
Definition: MarbleMap.cpp:1044
MarbleWidget::model
Marble::MarbleModel * model()
Definition: MarbleDeclarativeWidget.cpp:86
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Marble::MarbleMap::viewContext
ViewContext viewContext() const
Definition: MarbleMap.cpp:331
QObject::parent
QObject * parent() const
QVector::size
int size() const
Marble::MarbleMap::showIceLayer
bool showIceLayer() const
Return whether the ice layer is visible.
Definition: MarbleMap.cpp:600
Marble::GeoDataFeature::defaultFont
static QFont defaultFont()
Definition: GeoDataFeature.cpp:522
Marble::MarbleMap::setDefaultAngleUnit
void setDefaultAngleUnit(AngleUnit angleUnit)
Definition: MarbleMap.cpp:1182
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:1126
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:36
Marble::MarbleMap::showTerrain
bool showTerrain() const
Return whether the terrain place marks are visible.
Definition: MarbleMap.cpp:585
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:1091
GeoSceneMap.h
Marble::dgml::dgmlValue_vector
const char * dgmlValue_vector
Definition: DgmlAuxillaryDictionary.cpp:39
Marble::MarbleMap::preferredRadiusCeil
int preferredRadiusCeil(int radius)
Definition: MarbleMap.cpp:382
MapThemeManager.h
TileCreatorDialog.h
Marble::MarbleMap::renderStatusChanged
void renderStatusChanged(RenderStatus status)
Emitted when the layer rendering status has changed.
QRegion
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:999
Marble::MarbleMap::notifyMouseClick
void notifyMouseClick(int x, int y)
used to notify about the position of the mouse click
Definition: MarbleMap.cpp:1146
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:40 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
  • 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