Marble

MarbleWidget.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2006-2008 Torsten Rahn <[email protected]>
4 // SPDX-FileCopyrightText: 2007 Inge Wallin <[email protected]>
5 //
6 
7 #ifndef MARBLE_MARBLEWIDGET_H
8 #define MARBLE_MARBLEWIDGET_H
9 
10 
11 /** @file
12  * This file contains the headers for MarbleWidget.
13  *
14  * @author Torsten Rahn <[email protected]>
15  * @author Inge Wallin <[email protected]>
16  */
17 
18 #include <QWidget>
19 
20 #include "GeoDataCoordinates.h"
21 #include "MarbleGlobal.h" // types needed in all of marble.
22 #include "marble_export.h"
23 
24 // Qt
25 class QSettings;
26 class QPixmap;
27 
28 namespace Marble
29 {
30 
31 class AbstractDataPluginItem;
32 class AbstractFloatItem;
33 class GeoDataLatLonAltBox;
34 class GeoDataLatLonBox;
35 class GeoDataFeature;
36 class GeoDataPlacemark;
37 class GeoDataLookAt;
38 class GeoPainter;
39 class GeoSceneDocument;
40 class LayerInterface;
41 class MarbleModel;
42 class MarbleWidgetPopupMenu;
43 class MarbleWidgetInputHandler;
44 class MarbleWidgetPrivate;
45 class RenderPlugin;
46 class RenderState;
47 class RoutingLayer;
48 class TextureLayer;
49 class TileCoordsPyramid;
50 class TileCreator;
51 class ViewportParams;
52 class PopupLayer;
53 class StyleBuilder;
54 
55 /**
56  * @short A widget class that displays a view of the earth.
57  *
58  * This widget displays a view of the earth or any other globe,
59  * depending on which dataset is used. The user can navigate the
60  * globe using either a control widget, e.g. the MarbleNavigator, or
61  * the mouse. The mouse and keyboard control is done through a
62  * MarbleWidgetInputHandler. Only some aspects of the widget can be
63  * controlled by the mouse and/or keyboard.
64  *
65  * By clicking on the globe and moving the mouse, the position can be
66  * changed. The user can also zoom by using the scroll wheel of the
67  * mouse in the widget. The zoom value is not tied to any units, but
68  * is an abstract value without any physical meaning. A value around
69  * 1000 shows the full globe in a normal-sized window. Higher zoom
70  * values give a more zoomed-in view.
71  *
72  * The MarbleWidget owns a data model to work. This model is contained
73  * in the MarbleModel class, and it is painted by using a MarbleMap.
74  * The widget takes care of creating the map and model. A MarbleModel
75  * contains several datatypes, among them <b>tiles</b> which provide the
76  * background, <b>vectors</b> which provide things like country
77  * borders and coastlines and <b>placemarks</b> which can show points
78  * of interest, such as cities, mountain tops or the poles.
79  *
80  * In addition to navigating with the mouse, you can also use it to
81  * get information about items on the map. You can either click on a
82  * placemark with the left mouse button or with the right mouse button
83  * anywhere on the map.
84  *
85  * The left mouse button opens up a menu with all the placemarks
86  * within a certain distance from the mouse pointer. When you choose
87  * one item from the menu, Marble will open up a dialog window with
88  * some information about the placemark and also try to connect to
89  * Wikipedia to retrieve an article about it. If there is such an
90  * article, you will get a mini-browser window with the article in a tab.
91  *
92  * @see MarbleNavigator
93  * @see MarbleMap
94  * @see MarbleModel
95  */
96 
97 class MARBLE_EXPORT MarbleWidget : public QWidget
98 {
99  Q_OBJECT
100 #ifdef MARBLE_DBUS
101  Q_CLASSINFO("D-Bus Interface", "org.kde.MarbleWidget")
102 #endif
103 
104  Q_PROPERTY(int zoom READ zoom WRITE setZoom)
105 
106  Q_PROPERTY(QString mapThemeId READ mapThemeId WRITE setMapThemeId)
107  Q_PROPERTY(int projection READ projection WRITE setProjection)
108 
109  Q_PROPERTY(qreal longitude READ centerLongitude WRITE setCenterLongitude)
110  Q_PROPERTY(qreal latitude READ centerLatitude WRITE setCenterLatitude)
111 
112  Q_PROPERTY(bool showOverviewMap READ showOverviewMap WRITE setShowOverviewMap)
113  Q_PROPERTY(bool showScaleBar READ showScaleBar WRITE setShowScaleBar)
114  Q_PROPERTY(bool showCompass READ showCompass WRITE setShowCompass)
115  Q_PROPERTY(bool showGrid READ showGrid WRITE setShowGrid)
116 
117  Q_PROPERTY(bool showClouds READ showClouds WRITE setShowClouds)
118  Q_PROPERTY(bool showSunShading READ showSunShading WRITE setShowSunShading)
119  Q_PROPERTY(bool showCityLights READ showCityLights WRITE setShowCityLights)
120  Q_PROPERTY(bool isLockedToSubSolarPoint READ isLockedToSubSolarPoint WRITE setLockToSubSolarPoint)
121  Q_PROPERTY(bool isSubSolarPointIconVisible READ isSubSolarPointIconVisible WRITE setSubSolarPointIconVisible)
122  Q_PROPERTY(bool showAtmosphere READ showAtmosphere WRITE setShowAtmosphere)
123  Q_PROPERTY(bool showCrosshairs READ showCrosshairs WRITE setShowCrosshairs)
124 
125  Q_PROPERTY(bool showPlaces READ showPlaces WRITE setShowPlaces)
126  Q_PROPERTY(bool showCities READ showCities WRITE setShowCities)
127  Q_PROPERTY(bool showTerrain READ showTerrain WRITE setShowTerrain)
128  Q_PROPERTY(bool showOtherPlaces READ showOtherPlaces WRITE setShowOtherPlaces)
129 
130  Q_PROPERTY(bool showRelief READ showRelief WRITE setShowRelief)
131 
132  Q_PROPERTY(bool showIceLayer READ showIceLayer WRITE setShowIceLayer)
133  Q_PROPERTY(bool showBorders READ showBorders WRITE setShowBorders)
134  Q_PROPERTY(bool showRivers READ showRivers WRITE setShowRivers)
135  Q_PROPERTY(bool showLakes READ showLakes WRITE setShowLakes)
136 
137  Q_PROPERTY(ViewContext viewContext READ viewContext WRITE setViewContext NOTIFY viewContextChanged)
138 
139  Q_PROPERTY( RenderStatus renderStatus READ renderStatus NOTIFY renderStatusChanged )
140 
141  Q_PROPERTY(quint64 volatileTileCacheLimit READ volatileTileCacheLimit WRITE setVolatileTileCacheLimit)
142 
143  public:
144 
145  /**
146  * @brief Construct a new MarbleWidget.
147  * @param parent the parent widget
148  *
149  * This constructor should be used when you will only use one
150  * MarbleWidget. The widget will create its own MarbleModel when
151  * created.
152  */
153  explicit MarbleWidget( QWidget *parent = nullptr );
154 
155  ~MarbleWidget() override;
156 
157  /// @name Access to helper objects
158  //@{
159 
160  /**
161  * @brief Return the model that this view shows.
162  */
163  MarbleModel *model();
164  const MarbleModel *model() const;
165 
166  ViewportParams *viewport();
167  const ViewportParams *viewport() const;
168 
169  MarbleWidgetPopupMenu *popupMenu();
170 
171  /**
172  * Returns the current input handler
173  */
174  MarbleWidgetInputHandler *inputHandler() const;
175 
176  /**
177  * @brief Set the input handler
178  */
179  void setInputHandler( MarbleWidgetInputHandler *handler );
180 
181  /**
182  * @brief Returns a list of all RenderPlugins on the widget, this includes float items
183  * @return the list of RenderPlugins
184  */
185  QList<RenderPlugin *> renderPlugins() const;
186 
187  /**
188  * @brief Returns a list of all FloatItems on the widget
189  * @return the list of the floatItems
190  */
191  QList<AbstractFloatItem *> floatItems() const;
192 
193  /**
194  * @brief Returns the FloatItem with the given id
195  * @return The pointer to the requested floatItem,
196  *
197  * If no item is found the null pointer is returned.
198  */
199  AbstractFloatItem * floatItem( const QString &nameId ) const;
200 
201  /**
202  * Reads the plugin settings from the passed QSettings.
203  * You shouldn't use this in a KDE application as these use KConfig. Here you could
204  * use MarblePart which is handling this automatically.
205  * @param settings The QSettings object to be used.
206  */
207  void readPluginSettings( QSettings& settings );
208 
209  /**
210  * Writes the plugin settings in the passed QSettings.
211  * You shouldn't use this in a KDE application as these use KConfig. Here you could
212  * use MarblePart which is handling this automatically.
213  * @param settings The QSettings object to be used.
214  */
215  void writePluginSettings( QSettings& settings ) const;
216 
217  /**
218  * @brief Retrieve the view context (i.e. still or animated map)
219  */
220  ViewContext viewContext() const;
221 
222  /**
223  * @brief Get the GeoSceneDocument object of the current map theme
224  */
225  GeoSceneDocument * mapTheme() const;
226 
227  /**
228  * @brief Returns all widgets of dataPlugins on the position curpos
229  */
230  QList<AbstractDataPluginItem *> whichItemAt( const QPoint& curpos ) const;
231 
232  /**
233  * @brief Add a layer to be included in rendering.
234  */
235  void addLayer( LayerInterface *layer );
236 
237  /**
238  * @brief Remove a layer from being included in rendering.
239  */
240  void removeLayer( LayerInterface *layer );
241 
242  RoutingLayer* routingLayer();
243 
244  PopupLayer* popupLayer();
245 
246  /**
247  * @since 0.26.0
248  */
249  const StyleBuilder* styleBuilder() const;
250 
251  /**
252  * @brief Get the Projection used for the map
253  * @return @c Spherical a Globe
254  * @return @c Equirectangular a flat map
255  * @return @c Mercator another flat map
256  */
257  Projection projection() const;
258 // int projection() const;
259 
260  //@}
261 
262  /// @name Visible map area
263  //@{
264 
265  /**
266  * @brief Get the ID of the current map theme
267  * To ensure that a unique identifier is being used the theme does NOT
268  * get represented by its name but the by relative location of the file
269  * that specifies the theme:
270  *
271  * Example:
272  * mapThemeId = "earth/bluemarble/bluemarble.dgml"
273  */
274  QString mapThemeId() const;
275 
276  /**
277  * @brief Return the projected region which describes the (shape of the) projected surface.
278  */
279  QRegion mapRegion() const;
280 
281  /**
282  * @brief Return the radius of the globe in pixels.
283  */
284  int radius() const;
285 
286  /**
287  * @brief Return the current zoom amount.
288  */
289  int zoom() const;
290 
291  int tileZoomLevel() const;
292 
293  /**
294  * @brief Return the current distance.
295  */
296  qreal distance() const;
297 
298  /**
299  * @brief Return the current distance string.
300  */
301  QString distanceString() const;
302 
303  /**
304  * @brief Return the minimum zoom value for the current map theme.
305  */
306  int minimumZoom() const;
307 
308  /**
309  * @brief Return the minimum zoom value for the current map theme.
310  */
311  int maximumZoom() const;
312 
313  //@}
314 
315  /// @name Position management
316  //@{
317 
318  /**
319  * @brief Get the screen coordinates corresponding to geographical coordinates in the widget.
320  * @param lon the lon coordinate of the requested pixel position
321  * @param lat the lat coordinate of the requested pixel position
322  * @param x the x coordinate of the pixel is returned through this parameter
323  * @param y the y coordinate of the pixel is returned through this parameter
324  * @return @c true if the geographical coordinates are visible on the screen
325  * @c false if the geographical coordinates are not visible on the screen
326  */
327  bool screenCoordinates( qreal lon, qreal lat,
328  qreal& x, qreal& y ) const;
329 
330  /**
331  * @brief Get the earth coordinates corresponding to a pixel in the widget.
332  * @param x the x coordinate of the pixel
333  * @param y the y coordinate of the pixel
334  * @param lon the longitude angle is returned through this parameter
335  * @param lat the latitude angle is returned through this parameter
336  * @param unit the angle unit
337  * @return @c true if the pixel (x, y) is within the globe
338  * @c false if the pixel (x, y) is outside the globe, i.e. in space.
339  */
340  bool geoCoordinates( int x, int y,
341  qreal& lon, qreal& lat,
342  GeoDataCoordinates::Unit = GeoDataCoordinates::Degree ) const;
343 
344  /**
345  * @brief Return the longitude of the center point.
346  * @return The longitude of the center point in degree.
347  */
348  qreal centerLongitude() const;
349 
350  /**
351  * @brief Return the latitude of the center point.
352  * @return The latitude of the center point in degree.
353  */
354  qreal centerLatitude() const;
355 
356  qreal heading() const;
357 
358  /**
359  * @brief Return how much the map will move if one of the move slots are called.
360  * @return The move step.
361  */
362  qreal moveStep() const;
363 
364  /**
365  * @brief Return the lookAt
366  */
367  GeoDataLookAt lookAt() const;
368 
369  /**
370  * @return The current point of focus, e.g. the point that is not moved
371  * when changing the zoom level. If not set, it defaults to the
372  * center point.
373  * @see centerLongitude centerLatitude setFocusPoint resetFocusPoint
374  */
375  GeoDataCoordinates focusPoint() const;
376 
377  /**
378  * @brief Change the point of focus, overridding any previously set focus point.
379  * @param focusPoint New focus point
380  * @see focusPoint resetFocusPoint
381  */
382  void setFocusPoint( const GeoDataCoordinates &focusPoint );
383 
384  /**
385  * @brief Invalidate any focus point set with @ref setFocusPoint.
386  * @see focusPoint setFocusPoint
387  */
388  void resetFocusPoint();
389 
390  /**
391  * @brief Return the globe radius (pixel) for the given distance (km)
392  */
393  qreal radiusFromDistance( qreal distance ) const;
394 
395  /**
396  * @brief Return the distance (km) at the given globe radius (pixel)
397  */
398  qreal distanceFromRadius( qreal radius ) const;
399 
400  /**
401  * Returns the zoom value (no unit) corresponding to the given camera distance (km)
402  */
403  qreal zoomFromDistance( qreal distance ) const;
404 
405  /**
406  * Returns the distance (km) corresponding to the given zoom value
407  */
408  qreal distanceFromZoom( qreal zoom ) const;
409 
410  //@}
411 
412  /// @name Placemark management
413  //@{
414 
415  QVector<const GeoDataFeature *> whichFeatureAt( const QPoint& ) const;
416 
417  //@}
418 
419  /// @name Float items and map appearance
420  //@{
421 
422  /**
423  * @brief Return whether the overview map is visible.
424  * @return The overview map visibility.
425  */
426  bool showOverviewMap() const;
427 
428  /**
429  * @brief Return whether the scale bar is visible.
430  * @return The scale bar visibility.
431  */
432  bool showScaleBar() const;
433 
434  /**
435  * @brief Return whether the compass bar is visible.
436  * @return The compass visibility.
437  */
438  bool showCompass() const;
439 
440  /**
441  * @brief Return whether the cloud cover is visible.
442  * @return The cloud cover visibility.
443  */
444  bool showClouds() const;
445 
446  /**
447  * @brief Return whether the night shadow is visible.
448  * @return visibility of night shadow
449  */
450  bool showSunShading() const;
451 
452  /**
453  * @brief Return whether the city lights are shown instead of the night shadow.
454  * @return visibility of city lights
455  */
456  bool showCityLights() const;
457 
458  /**
459  * @brief Return whether the globe is locked to the sub solar point
460  * @return if globe is locked to sub solar point
461  */
462  bool isLockedToSubSolarPoint() const;
463 
464  /**
465  * @brief Return whether the sun icon is shown in the sub solar point.
466  * @return visibility of the sun icon in the sub solar point
467  */
468  bool isSubSolarPointIconVisible() const;
469 
470  /**
471  * @brief Return whether the atmospheric glow is visible.
472  * @return The cloud cover visibility.
473  */
474  bool showAtmosphere() const;
475 
476  /**
477  * @brief Return whether the crosshairs are visible.
478  * @return The crosshairs' visibility.
479  */
480  bool showCrosshairs() const;
481 
482  /**
483  * @brief Return whether the coordinate grid is visible.
484  * @return The coordinate grid visibility.
485  */
486  bool showGrid() const;
487 
488  /**
489  * @brief Return whether the place marks are visible.
490  * @return The place mark visibility.
491  */
492  bool showPlaces() const;
493 
494  /**
495  * @brief Return whether the city place marks are visible.
496  * @return The city place mark visibility.
497  */
498  bool showCities() const;
499 
500  /**
501  * @brief Return whether the terrain place marks are visible.
502  * @return The terrain place mark visibility.
503  */
504  bool showTerrain() const;
505 
506  /**
507  * @brief Return whether other places are visible.
508  * @return The visibility of other places.
509  */
510  bool showOtherPlaces() const;
511 
512  /**
513  * @brief Return whether the relief is visible.
514  * @return The relief visibility.
515  */
516  bool showRelief() const;
517 
518  /**
519  * @brief Return whether the ice layer is visible.
520  * @return The ice layer visibility.
521  */
522  bool showIceLayer() const;
523 
524  /**
525  * @brief Return whether the borders are visible.
526  * @return The border visibility.
527  */
528  bool showBorders() const;
529 
530  /**
531  * @brief Return whether the rivers are visible.
532  * @return The rivers' visibility.
533  */
534  bool showRivers() const;
535 
536  /**
537  * @brief Return whether the lakes are visible.
538  * @return The lakes' visibility.
539  */
540  bool showLakes() const;
541 
542  /**
543  * @brief Return whether the frame rate gets displayed.
544  * @return the frame rates visibility
545  */
546  bool showFrameRate() const;
547 
548  bool showBackground() const;
549 
550  /**
551  * @brief Retrieve the map quality depending on the view context
552  */
553  MapQuality mapQuality( ViewContext = Still ) const;
554 
555  /**
556  * @brief Retrieve whether travels to a point should get animated
557  */
558  bool animationsEnabled() const;
559 
560  AngleUnit defaultAngleUnit() const;
561  void setDefaultAngleUnit( AngleUnit angleUnit );
562 
563  QFont defaultFont() const;
564  void setDefaultFont( const QFont& font );
565 
566  //@}
567 
568  /// @name Tile management
569  //@{
570 
571  /**
572  * @brief Returns the limit in kilobytes of the volatile (in RAM) tile cache.
573  * @return the limit of volatile tile cache
574  */
575  quint64 volatileTileCacheLimit() const;
576 
577  //@}
578 
579  /// @name Miscellaneous
580  //@{
581 
582  /**
583  * @brief Return a QPixmap with the current contents of the widget.
584  */
585  QPixmap mapScreenShot();
586 
587  //@}
588 
589  /// @todo Enable this instead of the zoomView slot below for proper deprecation warnings
590  /// around Marble 1.8
591  // @deprecated Please use setZoom
592  //MARBLE_DEPRECATED( void zoomView( int zoom, FlyToMode mode = Instant ) );
593 
594  /**
595  * Summarized render status of the current map view
596  * @see renderState
597  */
598  RenderStatus renderStatus() const;
599 
600  /**
601  * Detailed render status of the current map view
602  */
603  RenderState renderState() const;
604 
605  /**
606  * Toggle whether regions are highlighted when user selects them
607  */
608  void setHighlightEnabled( bool enabled );
609 
610  public Q_SLOTS:
611 
612  /// @name Position management slots
613  //@{
614 
615  /**
616  * @brief Set the radius of the globe in pixels.
617  * @param radius The new globe radius value in pixels.
618  */
619  void setRadius( int radius );
620 
621  /**
622  * @brief Zoom the view to a certain zoomlevel
623  * @param zoom the new zoom level.
624  * @param mode the FlyToMode that will be used.
625  *
626  * The zoom level is an abstract value without physical
627  * interpretation. A zoom value around 1000 lets the viewer see
628  * all of the earth in the default window.
629  */
630  void setZoom( int zoom, FlyToMode mode = Instant );
631 
632  /**
633  * @deprecated To be removed soon. Please use setZoom instead. Same parameters.
634  */
635  void zoomView( int zoom, FlyToMode mode = Instant );
636 
637  /**
638  * @brief Zoom the view by a certain step
639  * @param zoomStep the difference between the old zoom and the new
640  * @param mode the FlyToMode that will be used.
641  */
642  void zoomViewBy( int zoomStep, FlyToMode mode = Instant );
643 
644  /**
645  * @brief Zoom in by the amount zoomStep.
646  */
647  void zoomIn( FlyToMode mode = Automatic );
648  /**
649  * @brief Zoom out by the amount zoomStep.
650  */
651  void zoomOut( FlyToMode mode = Automatic );
652 
653  /**
654  * @brief Set the distance of the observer to the globe in km.
655  * @param distance The new distance in km.
656  */
657  void setDistance( qreal distance );
658 
659  /**
660  * @brief Rotate the view by the two angles phi and theta.
661  * @param deltaLon an angle that specifies the change in terms of longitude
662  * @param deltaLat an angle that specifies the change in terms of latitude
663  * @param mode the FlyToMode that will be used
664  *
665  * This function rotates the view by two angles,
666  * deltaLon ("theta") and deltaLat ("phi").
667  * If we start at (0, 0), the result will be the exact equivalent
668  * of (lon, lat), otherwise the resulting angle will be the sum of
669  * the previous position and the two offsets.
670  */
671  void rotateBy( const qreal deltaLon, const qreal deltaLat, FlyToMode mode = Instant );
672 
673  /**
674  * @brief Center the view on a geographical point
675  * @param lat an angle in degrees parallel to the latitude lines
676  * +90(N) - -90(S)
677  * @param lon an angle in degrees parallel to the longitude lines
678  * +180(W) - -180(E)
679  * @param animated whether to use animation
680  */
681  void centerOn( const qreal lon, const qreal lat, bool animated = false );
682 
683  /**
684  * @brief Center the view on a point
685  * This method centers the Marble map on the point described by the latitude
686  * and longitude in the GeoDataCoordinate parameter @c point. It also zooms
687  * the map to be at the elevation described by the altitude. If this is
688  * not the desired functionality or you do not have an accurate altitude
689  * then use @see centerOn(qreal, qreal, bool)
690  * @param point the point in 3 dimensions above the globe to move the view
691  * to. It will always be looking vertically down.
692  * @param animated whether to use animation
693  */
694  void centerOn( const GeoDataCoordinates &point, bool animated = false );
695 
696  /**
697  * @brief Center the view on a bounding box so that it completely fills the viewport
698  * This method not only centers on the center of the GeoDataLatLon box but it also
699  * adjusts the zoom of the marble widget so that the LatLon box provided fills
700  * the viewport.
701  * @param box The GeoDataLatLonBox to zoom and move the MarbleWidget to.
702  * @param animated whether to use animation.
703  */
704  void centerOn( const GeoDataLatLonBox& box, bool animated = false );
705 
706  /**
707  * @brief Center the view on a placemark according to the following logic:
708  * - if the placemark has a lookAt, zoom and center on that lookAt
709  * - otherwise use the placemark geometry's latLonAltBox
710  * @param placemark The GeoDataPlacemark to zoom and move the MarbleWidget to.
711  * @param animated Whether the centering is animated.
712  */
713  void centerOn( const GeoDataPlacemark& placemark, bool animated = false );
714 
715  /**
716  * @brief Set the latitude for the center point
717  * @param lat the new value for the latitude in degree.
718  * @param mode the FlyToMode that will be used.
719  */
720  void setCenterLatitude( qreal lat, FlyToMode mode = Instant );
721 
722  /**
723  * @brief Set the longitude for the center point
724  * @param lon the new value for the longitude in degree.
725  * @param mode the FlyToMode that will be used.
726  */
727  void setCenterLongitude( qreal lon, FlyToMode mode = Instant );
728 
729  void setHeading( qreal heading );
730 
731  /**
732  * @brief Move left by the moveStep.
733  */
734  void moveLeft( FlyToMode mode = Automatic );
735 
736  /**
737  * @brief Move right by the moveStep.
738  */
739  void moveRight( FlyToMode mode = Automatic );
740 
741  /**
742  * @brief Move up by the moveStep.
743  */
744  void moveUp( FlyToMode mode = Automatic );
745 
746  /**
747  * @brief Move down by the moveStep.
748  */
749  void moveDown( FlyToMode mode = Automatic );
750 
751  /**
752  * @brief Center the view on the default start point with the default zoom.
753  */
754  void goHome( FlyToMode mode = Automatic );
755 
756  /**
757  * @brief Change the camera position to the given position.
758  * @param lookAt New camera position. Changing the camera position means
759  * that both the current center position as well as the zoom value may change
760  * @param mode Interpolation type for intermediate camera positions. Automatic
761  * (default) chooses a suitable interpolation among Instant, Lenar and Jump.
762  * Instant will directly set the new zoom and position values, while
763  * Linear results in a linear interpolation of intermediate center coordinates
764  * along the sphere and a linear interpolation of changes in the camera distance
765  * to the ground. Finally, Jump will behave the same as Linear with regard to
766  * the center position interpolation, but use a parabolic height increase
767  * towards the middle point of the intermediate positions. This appears
768  * like a jump of the camera.
769  */
770  void flyTo( const GeoDataLookAt &lookAt, FlyToMode mode = Automatic );
771 
772  //@}
773 
774  /// @name Float items and map appearance slots
775  //@{
776 
777  /**
778  * @brief Set the Projection used for the map
779  * @param projection projection type (e.g. Spherical, Equirectangular, Mercator)
780  */
781  void setProjection( int projection );
782  void setProjection( Projection projection );
783 
784  /**
785  * @brief Set a new map theme
786  * @param maptheme The ID of the new maptheme. To ensure that a unique
787  * identifier is being used the theme does NOT get represented by its
788  * name but the by relative location of the file that specifies the theme:
789  *
790  * Example:
791  * maptheme = "earth/bluemarble/bluemarble.dgml"
792  */
793  void setMapThemeId( const QString& maptheme );
794 
795  /**
796  * @brief Sets the value of a map theme property
797  * @param name name of the property
798  * @param value value of the property (usually: visibility)
799  *
800  * Later on we might add a setPropertyType and a QVariant
801  * if needed.
802  */
803  void setPropertyValue( const QString& name, bool value );
804 
805  /**
806  * @brief Set whether the overview map overlay is visible
807  * @param visible visibility of the overview map
808  */
809  void setShowOverviewMap( bool visible );
810 
811  /**
812  * @brief Set whether the scale bar overlay is visible
813  * @param visible visibility of the scale bar
814  */
815  void setShowScaleBar( bool visible );
816 
817  /**
818  * @brief Set whether the compass overlay is visible
819  * @param visible visibility of the compass
820  */
821  void setShowCompass( bool visible );
822 
823  /**
824  * @brief Set whether the cloud cover is visible
825  * @param visible visibility of the cloud cover
826  */
827  void setShowClouds( bool visible );
828 
829  /**
830  * @brief Set whether the night shadow is visible.
831  * @param visible visibility of shadow
832  */
833  void setShowSunShading( bool visible );
834 
835  /**
836  * @brief Set whether city lights instead of night shadow are visible.
837  * @param visible visibility of city lights
838  */
839  void setShowCityLights( bool visible );
840 
841  /**
842  * @brief Set the globe locked to the sub solar point
843  * @param visible if globe is locked to the sub solar point
844  */
845  void setLockToSubSolarPoint( bool visible );
846 
847  /**
848  * @brief Set whether the sun icon is shown in the sub solar point
849  * @param visible if the sun icon is shown in the sub solar point
850  */
851  void setSubSolarPointIconVisible( bool visible );
852 
853  /**
854  * @brief Set whether the atmospheric glow is visible
855  * @param visible visibility of the atmospheric glow
856  */
857  void setShowAtmosphere( bool visible );
858 
859  /**
860  * @brief Set whether the crosshairs are visible
861  * @param visible visibility of the crosshairs
862  */
863  void setShowCrosshairs( bool visible );
864 
865  /**
866  * @brief Set whether the coordinate grid overlay is visible
867  * @param visible visibility of the coordinate grid
868  */
869  void setShowGrid( bool visible );
870 
871  /**
872  * @brief Set whether the place mark overlay is visible
873  * @param visible visibility of the place marks
874  */
875  void setShowPlaces( bool visible );
876 
877  /**
878  * @brief Set whether the city place mark overlay is visible
879  * @param visible visibility of the city place marks
880  */
881  void setShowCities( bool visible );
882 
883  /**
884  * @brief Set whether the terrain place mark overlay is visible
885  * @param visible visibility of the terrain place marks
886  */
887  void setShowTerrain( bool visible );
888 
889  /**
890  * @brief Set whether the other places overlay is visible
891  * @param visible visibility of other places
892  */
893  void setShowOtherPlaces( bool visible );
894 
895  /**
896  * @brief Set whether the relief is visible
897  * @param visible visibility of the relief
898  */
899  void setShowRelief( bool visible );
900 
901  /**
902  * @brief Set whether the ice layer is visible
903  * @param visible visibility of the ice layer
904  */
905  void setShowIceLayer( bool visible );
906 
907  /**
908  * @brief Set whether the borders visible
909  * @param visible visibility of the borders
910  */
911  void setShowBorders( bool visible );
912 
913  /**
914  * @brief Set whether the rivers are visible
915  * @param visible visibility of the rivers
916  */
917  void setShowRivers( bool visible );
918 
919  /**
920  * @brief Set whether the lakes are visible
921  * @param visible visibility of the lakes
922  */
923  void setShowLakes( bool visible );
924 
925  /**
926  * @brief Set whether the frame rate gets shown
927  * @param visible visibility of the frame rate
928  */
929  void setShowFrameRate( bool visible );
930 
931  void setShowBackground( bool visible );
932 
933  /**
934  * @brief Set whether the is tile is visible
935  * NOTE: This is part of the transitional debug API
936  * and might be subject to changes until Marble 0.8
937  * @param visible visibility of the tile
938  */
939  void setShowTileId( bool visible );
940 
941  /**
942  * @brief Set whether the runtime tracing for layers gets shown
943  * @param visible visibility of the runtime tracing
944  */
945  void setShowRuntimeTrace( bool visible );
946 
947  bool showRuntimeTrace() const;
948 
949  /**
950  * @brief Set whether to enter the debug mode for
951  * polygon node drawing
952  * @param visible visibility of the node debug mode
953  */
954  void setShowDebugPolygons( bool visible);
955 
956  bool showDebugPolygons() const;
957 
958  /**
959  * @brief Set whether to enter the debug mode for
960  * batch rendering
961  * @param visible visibility of the batch rendering
962  */
963  void setShowDebugBatchRender( bool visible);
964 
965  bool showDebugBatchRender() const;
966 
967  /**
968  * @brief Set whether to enter the debug mode for
969  * placemark drawing
970  * @param visible visibility of the node debug mode
971  */
972  void setShowDebugPlacemarks(bool visible);
973 
974  bool showDebugPlacemarks() const;
975 
976  /**
977  * @brief Set whether to render according to OSM indoor level tags
978  * @param visible visibility of entities (placemarks, buildings etc.) level-wise
979  */
980  void setDebugLevelTags(bool visible);
981 
982  bool debugLevelTags() const;
983 
984  /**
985  * @brief Set the level to debug
986  * @param level the level to debug
987  */
988  void setLevelToDebug(int level);
989 
990  int levelToDebug() const;
991 
992  /**
993  * @brief Set the map quality for the specified view context.
994  *
995  * @param quality map quality for the specified view context
996  * @param viewContext view context whose map quality should be set
997  */
998  void setMapQualityForViewContext( MapQuality quality, ViewContext viewContext );
999 
1000  /**
1001  * @brief Set the view context (i.e. still or animated map)
1002  */
1003  void setViewContext( ViewContext viewContext );
1004 
1005  /**
1006  * @brief Set whether travels to a point should get animated
1007  */
1008  void setAnimationsEnabled( bool enabled );
1009 
1010  //@}
1011 
1012  /// @name Tile management slots
1013  //@{
1014 
1015  void clearVolatileTileCache();
1016  /**
1017  * @brief Set the limit of the volatile (in RAM) tile cache.
1018  * @param kiloBytes The limit in kilobytes.
1019  */
1020  void setVolatileTileCacheLimit( quint64 kiloBytes );
1021 
1022  /**
1023  * @brief A slot that is called when the model starts to create new tiles.
1024  * @param creator the tile creator object.
1025  * @param name the name of the created theme.
1026  * @param description a descriptive text that can be shown in a dialog.
1027  * @see creatingTilesProgress
1028  *
1029  * This function is connected to the models signal with the same
1030  * name. When the model needs to create a cache of tiles in
1031  * several different resolutions, it will emit creatingTilesStart
1032  * once with a name of the theme and a descriptive text. The
1033  * widget can then pop up a dialog to explain why there is a
1034  * delay. The model will then call creatingTilesProgress several
1035  * times until the parameter reaches 100 (100%), after which the
1036  * creation process is finished. After this there will be no more
1037  * calls to creatingTilesProgress, and the poup dialog can then be
1038  * closed.
1039  */
1040  void creatingTilesStart( TileCreator *creator, const QString& name, const QString& description );
1041 
1042  /**
1043  * @brief Re-download all visible tiles.
1044  */
1045  void reloadMap();
1046 
1047  void downloadRegion( QVector<TileCoordsPyramid> const & );
1048 
1049  //@}
1050 
1051  /// @name Miscellaneous slots
1052  //@{
1053 
1054  /**
1055  * @brief Used to notify about the position of the mouse click
1056  */
1057  void notifyMouseClick( int x, int y );
1058 
1059  void setSelection( const QRect& region );
1060 
1061  void setInputEnabled( bool );
1062 
1063  TextureLayer *textureLayer() const;
1064 
1065  //@}
1066 
1067  Q_SIGNALS:
1068  /**
1069  * @brief Signal that the zoom has changed, and to what.
1070  * @param zoom The new zoom value.
1071  * @see setZoom()
1072  */
1073  void zoomChanged( int zoom );
1074  void distanceChanged( const QString& distanceString );
1075 
1076  void tileLevelChanged( int level );
1077 
1078  void viewContextChanged(ViewContext newViewContext);
1079 
1080  /**
1081  * @brief Signal that the theme has changed
1082  * @param theme Name of the new theme.
1083  */
1084  void themeChanged( const QString& theme );
1085 
1086  void projectionChanged( Projection );
1087 
1088  void mouseMoveGeoPosition( const QString& );
1089 
1090  void mouseClickGeoPosition( qreal lon, qreal lat, GeoDataCoordinates::Unit );
1091 
1092  void framesPerSecond( qreal fps );
1093 
1094  /**
1095  * This signal is emit when a new rectangle region is selected over the map.
1096  *
1097  * @param boundingBox The geographical coordinates of the selected region
1098  */
1099  void regionSelected(const GeoDataLatLonBox &boundingBox);
1100 
1101  /**
1102  * This signal is emit when the settings of a plugin changed.
1103  */
1104  void pluginSettingsChanged();
1105 
1106  /**
1107  * @brief Signal that a render item has been initialized
1108  */
1109  void renderPluginInitialized( RenderPlugin *renderPlugin );
1110 
1111  /**
1112  * This signal is emitted when the visible region of the map changes. This typically happens
1113  * when the user moves the map around or zooms.
1114  */
1115  void visibleLatLonAltBoxChanged( const GeoDataLatLonAltBox& visibleLatLonAltBox );
1116 
1117  /**
1118  * @brief Emitted when the layer rendering status has changed
1119  * @param status New render status
1120  */
1121  void renderStatusChanged( RenderStatus status );
1122 
1123  void renderStateChanged( const RenderState &state );
1124 
1125  void highlightedPlacemarksChanged( qreal lon, qreal lat, GeoDataCoordinates::Unit unit );
1126 
1127  protected:
1128  /**
1129  * @brief Reimplementation of the leaveEvent() function in QWidget.
1130  */
1131  void leaveEvent( QEvent *event ) override;
1132 
1133  /**
1134  * @brief Reimplementation of the paintEvent() function in QWidget.
1135  */
1136  void paintEvent( QPaintEvent *event ) override;
1137 
1138  /**
1139  * @brief Reimplementation of the resizeEvent() function in QWidget.
1140  */
1141  void resizeEvent( QResizeEvent *event ) override;
1142 
1143  void connectNotify(const QMetaMethod &signal) override;
1144  void disconnectNotify(const QMetaMethod &signal) override;
1145 
1146  /**
1147  * @brief Reimplementation of the changeEvent() function in QWidget to
1148  * react to changes of the enabled state
1149  */
1150  void changeEvent( QEvent * event ) override;
1151 
1152  /**
1153  * @brief Enables custom drawing onto the MarbleWidget straight after
1154  * @brief the globe and before all other layers has been rendered.
1155  * @param painter
1156  *
1157  * @deprecated implement LayerInterface and add it using @p addLayer()
1158  */
1159  virtual void customPaint( GeoPainter *painter );
1160 
1161  private:
1162  Q_PRIVATE_SLOT( d, void updateMapTheme() )
1163  Q_PRIVATE_SLOT( d, void updateSystemBackgroundAttribute() )
1164 
1165  private:
1166  Q_DISABLE_COPY( MarbleWidget )
1167  MarbleWidgetPrivate * const d;
1168  friend class MarbleWidgetPrivate;
1169 
1170  class CustomPaintLayer;
1171  friend class CustomPaintLayer;
1172 
1173  friend class MarbleWidgetDefaultInputHandler;
1174  };
1175 
1176 }
1177 
1178 #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:158
A painter that allows to draw geometric primitives on the map.
Definition: GeoPainter.h:88
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:66
The PopupLayer class.
Definition: PopupLayer.h:31
MapQuality
This enum is used to choose the map quality shown in the view.
Definition: MarbleGlobal.h:74
const QLatin1String name
A paint layer that serves as a view on a route model.
Definition: RoutingLayer.h:29
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:97
The abstract class for float item plugins.
still image
Definition: MarbleGlobal.h:67
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:157
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition: MarbleModel.h:86
The MarbleWidgetPopupMenu handles context menus.
AngleUnit
This enum is used to choose the unit chosen to measure angles.
Definition: MarbleGlobal.h:57
Projection
This enum is used to choose the projection shown in the view.
Definition: MarbleGlobal.h:41
Change camera position immediately (no interpolation)
Definition: MarbleGlobal.h:159
a class representing a point of interest on the map
The abstract class that creates a renderable item.
Definition: RenderPlugin.h:38
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-2022 The KDE developers.
Generated on Thu Jan 27 2022 23:11:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.