Marble

MarbleWidget.h
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-2008 Torsten Rahn <[email protected]>
9 // Copyright 2007 Inge Wallin <[email protected]>
10 //
11 
12 #ifndef MARBLE_MARBLEWIDGET_H
13 #define MARBLE_MARBLEWIDGET_H
14 
15 
23 #include <QWidget>
24 
25 #include "GeoDataCoordinates.h"
26 #include "MarbleGlobal.h" // types needed in all of marble.
27 #include "marble_export.h"
28 
29 // Qt
30 class QSettings;
31 class QPixmap;
32 
33 namespace Marble
34 {
35 
36 class AbstractDataPluginItem;
37 class AbstractFloatItem;
38 class GeoDataLatLonAltBox;
39 class GeoDataLatLonBox;
40 class GeoDataFeature;
41 class GeoDataPlacemark;
42 class GeoDataLookAt;
43 class GeoPainter;
44 class GeoSceneDocument;
45 class LayerInterface;
46 class MarbleModel;
47 class MarbleWidgetPopupMenu;
48 class MarbleWidgetInputHandler;
49 class MarbleWidgetPrivate;
50 class RenderPlugin;
51 class RenderState;
52 class RoutingLayer;
53 class TextureLayer;
54 class TileCoordsPyramid;
55 class TileCreator;
56 class ViewportParams;
57 class PopupLayer;
58 class StyleBuilder;
59 
102 class MARBLE_EXPORT MarbleWidget : public QWidget
103 {
104  Q_OBJECT
105 #ifdef MARBLE_DBUS
106  Q_CLASSINFO("D-Bus Interface", "org.kde.MarbleWidget")
107 #endif
108 
109  Q_PROPERTY(int zoom READ zoom WRITE setZoom)
110 
111  Q_PROPERTY(QString mapThemeId READ mapThemeId WRITE setMapThemeId)
112  Q_PROPERTY(int projection READ projection WRITE setProjection)
113 
114  Q_PROPERTY(qreal longitude READ centerLongitude WRITE setCenterLongitude)
115  Q_PROPERTY(qreal latitude READ centerLatitude WRITE setCenterLatitude)
116 
117  Q_PROPERTY(bool showOverviewMap READ showOverviewMap WRITE setShowOverviewMap)
118  Q_PROPERTY(bool showScaleBar READ showScaleBar WRITE setShowScaleBar)
119  Q_PROPERTY(bool showCompass READ showCompass WRITE setShowCompass)
120  Q_PROPERTY(bool showGrid READ showGrid WRITE setShowGrid)
121 
122  Q_PROPERTY(bool showClouds READ showClouds WRITE setShowClouds)
123  Q_PROPERTY(bool showSunShading READ showSunShading WRITE setShowSunShading)
124  Q_PROPERTY(bool showCityLights READ showCityLights WRITE setShowCityLights)
125  Q_PROPERTY(bool isLockedToSubSolarPoint READ isLockedToSubSolarPoint WRITE setLockToSubSolarPoint)
126  Q_PROPERTY(bool isSubSolarPointIconVisible READ isSubSolarPointIconVisible WRITE setSubSolarPointIconVisible)
127  Q_PROPERTY(bool showAtmosphere READ showAtmosphere WRITE setShowAtmosphere)
128  Q_PROPERTY(bool showCrosshairs READ showCrosshairs WRITE setShowCrosshairs)
129 
130  Q_PROPERTY(bool showPlaces READ showPlaces WRITE setShowPlaces)
131  Q_PROPERTY(bool showCities READ showCities WRITE setShowCities)
132  Q_PROPERTY(bool showTerrain READ showTerrain WRITE setShowTerrain)
133  Q_PROPERTY(bool showOtherPlaces READ showOtherPlaces WRITE setShowOtherPlaces)
134 
135  Q_PROPERTY(bool showRelief READ showRelief WRITE setShowRelief)
136 
137  Q_PROPERTY(bool showIceLayer READ showIceLayer WRITE setShowIceLayer)
138  Q_PROPERTY(bool showBorders READ showBorders WRITE setShowBorders)
139  Q_PROPERTY(bool showRivers READ showRivers WRITE setShowRivers)
140  Q_PROPERTY(bool showLakes READ showLakes WRITE setShowLakes)
141 
142  Q_PROPERTY(ViewContext viewContext READ viewContext WRITE setViewContext NOTIFY viewContextChanged)
143 
144  Q_PROPERTY( RenderStatus renderStatus READ renderStatus NOTIFY renderStatusChanged )
145 
146  Q_PROPERTY(quint64 volatileTileCacheLimit READ volatileTileCacheLimit WRITE setVolatileTileCacheLimit)
147 
148  public:
149 
158  explicit MarbleWidget( QWidget *parent = nullptr );
159 
160  ~MarbleWidget() override;
161 
163 
164 
168  MarbleModel *model();
169  const MarbleModel *model() const;
170 
171  ViewportParams *viewport();
172  const ViewportParams *viewport() const;
173 
174  MarbleWidgetPopupMenu *popupMenu();
175 
179  MarbleWidgetInputHandler *inputHandler() const;
180 
184  void setInputHandler( MarbleWidgetInputHandler *handler );
185 
190  QList<RenderPlugin *> renderPlugins() const;
191 
196  QList<AbstractFloatItem *> floatItems() const;
197 
204  AbstractFloatItem * floatItem( const QString &nameId ) const;
205 
212  void readPluginSettings( QSettings& settings );
213 
220  void writePluginSettings( QSettings& settings ) const;
221 
225  ViewContext viewContext() const;
226 
230  GeoSceneDocument * mapTheme() const;
231 
235  QList<AbstractDataPluginItem *> whichItemAt( const QPoint& curpos ) const;
236 
240  void addLayer( LayerInterface *layer );
241 
245  void removeLayer( LayerInterface *layer );
246 
247  RoutingLayer* routingLayer();
248 
249  PopupLayer* popupLayer();
250 
254  const StyleBuilder* styleBuilder() const;
255 
262  Projection projection() const;
263 // int projection() const;
264 
266 
268 
269 
279  QString mapThemeId() const;
280 
284  QRegion mapRegion() const;
285 
289  int radius() const;
290 
294  int zoom() const;
295 
296  int tileZoomLevel() const;
297 
301  qreal distance() const;
302 
306  QString distanceString() const;
307 
311  int minimumZoom() const;
312 
316  int maximumZoom() const;
317 
319 
321 
322 
332  bool screenCoordinates( qreal lon, qreal lat,
333  qreal& x, qreal& y ) const;
334 
345  bool geoCoordinates( int x, int y,
346  qreal& lon, qreal& lat,
347  GeoDataCoordinates::Unit = GeoDataCoordinates::Degree ) const;
348 
353  qreal centerLongitude() const;
354 
359  qreal centerLatitude() const;
360 
361  qreal heading() const;
362 
367  qreal moveStep() const;
368 
372  GeoDataLookAt lookAt() const;
373 
380  GeoDataCoordinates focusPoint() const;
381 
387  void setFocusPoint( const GeoDataCoordinates &focusPoint );
388 
393  void resetFocusPoint();
394 
398  qreal radiusFromDistance( qreal distance ) const;
399 
403  qreal distanceFromRadius( qreal radius ) const;
404 
408  qreal zoomFromDistance( qreal distance ) const;
409 
413  qreal distanceFromZoom( qreal zoom ) const;
414 
416 
418 
419 
420  QVector<const GeoDataFeature *> whichFeatureAt( const QPoint& ) const;
421 
423 
425 
426 
431  bool showOverviewMap() const;
432 
437  bool showScaleBar() const;
438 
443  bool showCompass() const;
444 
449  bool showClouds() const;
450 
455  bool showSunShading() const;
456 
461  bool showCityLights() const;
462 
467  bool isLockedToSubSolarPoint() const;
468 
473  bool isSubSolarPointIconVisible() const;
474 
479  bool showAtmosphere() const;
480 
485  bool showCrosshairs() const;
486 
491  bool showGrid() const;
492 
497  bool showPlaces() const;
498 
503  bool showCities() const;
504 
509  bool showTerrain() const;
510 
515  bool showOtherPlaces() const;
516 
521  bool showRelief() const;
522 
527  bool showIceLayer() const;
528 
533  bool showBorders() const;
534 
539  bool showRivers() const;
540 
545  bool showLakes() const;
546 
551  bool showFrameRate() const;
552 
553  bool showBackground() const;
554 
558  MapQuality mapQuality( ViewContext = Still ) const;
559 
563  bool animationsEnabled() const;
564 
565  AngleUnit defaultAngleUnit() const;
566  void setDefaultAngleUnit( AngleUnit angleUnit );
567 
568  QFont defaultFont() const;
569  void setDefaultFont( const QFont& font );
570 
572 
574 
575 
580  quint64 volatileTileCacheLimit() const;
581 
583 
585 
586 
590  QPixmap mapScreenShot();
591 
593 
596  // @deprecated Please use setZoom
597  //MARBLE_DEPRECATED( void zoomView( int zoom, FlyToMode mode = Instant ) );
598 
603  RenderStatus renderStatus() const;
604 
608  RenderState renderState() const;
609 
613  void setHighlightEnabled( bool enabled );
614 
615  public Q_SLOTS:
616 
618 
619 
624  void setRadius( int radius );
625 
635  void setZoom( int zoom, FlyToMode mode = Instant );
636 
640  void zoomView( int zoom, FlyToMode mode = Instant );
641 
647  void zoomViewBy( int zoomStep, FlyToMode mode = Instant );
648 
652  void zoomIn( FlyToMode mode = Automatic );
656  void zoomOut( FlyToMode mode = Automatic );
657 
662  void setDistance( qreal distance );
663 
676  void rotateBy( const qreal deltaLon, const qreal deltaLat, FlyToMode mode = Instant );
677 
686  void centerOn( const qreal lon, const qreal lat, bool animated = false );
687 
699  void centerOn( const GeoDataCoordinates &point, bool animated = false );
700 
709  void centerOn( const GeoDataLatLonBox& box, bool animated = false );
710 
718  void centerOn( const GeoDataPlacemark& placemark, bool animated = false );
719 
725  void setCenterLatitude( qreal lat, FlyToMode mode = Instant );
726 
732  void setCenterLongitude( qreal lon, FlyToMode mode = Instant );
733 
734  void setHeading( qreal heading );
735 
739  void moveLeft( FlyToMode mode = Automatic );
740 
744  void moveRight( FlyToMode mode = Automatic );
745 
749  void moveUp( FlyToMode mode = Automatic );
750 
754  void moveDown( FlyToMode mode = Automatic );
755 
759  void goHome( FlyToMode mode = Automatic );
760 
775  void flyTo( const GeoDataLookAt &lookAt, FlyToMode mode = Automatic );
776 
778 
780 
781 
786  void setProjection( int projection );
787  void setProjection( Projection projection );
788 
798  void setMapThemeId( const QString& maptheme );
799 
808  void setPropertyValue( const QString& name, bool value );
809 
814  void setShowOverviewMap( bool visible );
815 
820  void setShowScaleBar( bool visible );
821 
826  void setShowCompass( bool visible );
827 
832  void setShowClouds( bool visible );
833 
838  void setShowSunShading( bool visible );
839 
844  void setShowCityLights( bool visible );
845 
850  void setLockToSubSolarPoint( bool visible );
851 
856  void setSubSolarPointIconVisible( bool visible );
857 
862  void setShowAtmosphere( bool visible );
863 
868  void setShowCrosshairs( bool visible );
869 
874  void setShowGrid( bool visible );
875 
880  void setShowPlaces( bool visible );
881 
886  void setShowCities( bool visible );
887 
892  void setShowTerrain( bool visible );
893 
898  void setShowOtherPlaces( bool visible );
899 
904  void setShowRelief( bool visible );
905 
910  void setShowIceLayer( bool visible );
911 
916  void setShowBorders( bool visible );
917 
922  void setShowRivers( bool visible );
923 
928  void setShowLakes( bool visible );
929 
934  void setShowFrameRate( bool visible );
935 
936  void setShowBackground( bool visible );
937 
944  void setShowTileId( bool visible );
945 
950  void setShowRuntimeTrace( bool visible );
951 
952  bool showRuntimeTrace() const;
953 
959  void setShowDebugPolygons( bool visible);
960 
961  bool showDebugPolygons() const;
962 
968  void setShowDebugBatchRender( bool visible);
969 
970  bool showDebugBatchRender() const;
971 
977  void setShowDebugPlacemarks(bool visible);
978 
979  bool showDebugPlacemarks() const;
980 
985  void setDebugLevelTags(bool visible);
986 
987  bool debugLevelTags() const;
988 
993  void setLevelToDebug(int level);
994 
995  int levelToDebug() const;
996 
1003  void setMapQualityForViewContext( MapQuality quality, ViewContext viewContext );
1004 
1008  void setViewContext( ViewContext viewContext );
1009 
1013  void setAnimationsEnabled( bool enabled );
1014 
1016 
1018 
1019 
1020  void clearVolatileTileCache();
1025  void setVolatileTileCacheLimit( quint64 kiloBytes );
1026 
1045  void creatingTilesStart( TileCreator *creator, const QString& name, const QString& description );
1046 
1050  void reloadMap();
1051 
1052  void downloadRegion( QVector<TileCoordsPyramid> const & );
1053 
1055 
1057 
1058 
1062  void notifyMouseClick( int x, int y );
1063 
1064  void setSelection( const QRect& region );
1065 
1066  void setInputEnabled( bool );
1067 
1068  TextureLayer *textureLayer() const;
1069 
1071 
1072  Q_SIGNALS:
1078  void zoomChanged( int zoom );
1079  void distanceChanged( const QString& distanceString );
1080 
1081  void tileLevelChanged( int level );
1082 
1083  void viewContextChanged(ViewContext newViewContext);
1084 
1089  void themeChanged( const QString& theme );
1090 
1091  void projectionChanged( Projection );
1092 
1093  void mouseMoveGeoPosition( const QString& );
1094 
1095  void mouseClickGeoPosition( qreal lon, qreal lat, GeoDataCoordinates::Unit );
1096 
1097  void framesPerSecond( qreal fps );
1098 
1104  void regionSelected(const GeoDataLatLonBox &boundingBox);
1105 
1109  void pluginSettingsChanged();
1110 
1114  void renderPluginInitialized( RenderPlugin *renderPlugin );
1115 
1120  void visibleLatLonAltBoxChanged( const GeoDataLatLonAltBox& visibleLatLonAltBox );
1121 
1126  void renderStatusChanged( RenderStatus status );
1127 
1128  void renderStateChanged( const RenderState &state );
1129 
1130  void highlightedPlacemarksChanged( qreal lon, qreal lat, GeoDataCoordinates::Unit unit );
1131 
1132  protected:
1136  void leaveEvent( QEvent *event ) override;
1137 
1141  void paintEvent( QPaintEvent *event ) override;
1142 
1146  void resizeEvent( QResizeEvent *event ) override;
1147 
1148  void connectNotify(const QMetaMethod &signal) override;
1149  void disconnectNotify(const QMetaMethod &signal) override;
1150 
1155  void changeEvent( QEvent * event ) override;
1156 
1164  virtual void customPaint( GeoPainter *painter );
1165 
1166  private:
1167  Q_PRIVATE_SLOT( d, void updateMapTheme() )
1168  Q_PRIVATE_SLOT( d, void updateSystemBackgroundAttribute() )
1169 
1170  private:
1171  Q_DISABLE_COPY( MarbleWidget )
1172  MarbleWidgetPrivate * const d;
1173  friend class MarbleWidgetPrivate;
1174 
1175  class CustomPaintLayer;
1176  friend class CustomPaintLayer;
1177 
1178  friend class MarbleWidgetDefaultInputHandler;
1179  };
1180 
1181 }
1182 
1183 #endif
Unit
enum used constructor to specify the units used
A 3d point representation.
A sane value is chosen automatically depending on animation settings and the action.
Definition: MarbleGlobal.h:162
A painter that allows to draw geometric primitives on the map.
Definition: GeoPainter.h:93
Binds a QML item to a specific geodetic location in screen coordinates.
ViewContext
This enum is used to choose context in which map quality gets used.
Definition: MarbleGlobal.h:70
The PopupLayer class.
Definition: PopupLayer.h:36
MapQuality
This enum is used to choose the map quality shown in the view.
Definition: MarbleGlobal.h:78
A paint layer that serves as a view on a route model.
Definition: RoutingLayer.h:34
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:102
The abstract class for float item plugins.
still image
Definition: MarbleGlobal.h:71
A public class that controls what is visible in the viewport of a Marble map.
A container for features parsed from the DGML file.
FlyToMode
Describes possible flight mode (interpolation between source and target camera positions) ...
Definition: MarbleGlobal.h:161
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition: MarbleModel.h:91
The MarbleWidgetPopupMenu handles context menus.
AngleUnit
This enum is used to choose the unit chosen to measure angles.
Definition: MarbleGlobal.h:61
Projection
This enum is used to choose the projection shown in the view.
Definition: MarbleGlobal.h:45
Change camera position immediately (no interpolation)
Definition: MarbleGlobal.h:163
a class representing a point of interest on the map
The abstract class that creates a renderable item.
Definition: RenderPlugin.h:43
A class that defines a 3D bounding box for geographic data.
A class that defines a 2D bounding box for geographic data.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Jun 2 2020 22:32:38 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.