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

KDE's Doxygen guidelines are available online.