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

KDE's Doxygen guidelines are available online.