File indexing completed on 2024-04-21 03:49:46

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2006-2008 Torsten Rahn <tackat@kde.org>
0004 // SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
0005 //
0006 
0007 #ifndef MARBLE_MARBLEWIDGET_H
0008 #define MARBLE_MARBLEWIDGET_H
0009 
0010 
0011 /** @file
0012  * This file contains the headers for MarbleWidget.
0013  *
0014  * @author Torsten Rahn <tackat@kde.org>
0015  * @author Inge Wallin  <inge@lysator.liu.se>
0016  */
0017 
0018 #include <QWidget>
0019 
0020 #include "GeoDataCoordinates.h"
0021 #include "MarbleGlobal.h"             // types needed in all of marble.
0022 #include "marble_export.h"
0023 
0024 // Qt
0025 class QSettings;
0026 class QPixmap;
0027 
0028 namespace Marble
0029 {
0030 
0031 class AbstractDataPluginItem;
0032 class AbstractFloatItem;
0033 class GeoDataLatLonAltBox;
0034 class GeoDataLatLonBox;
0035 class GeoDataFeature;
0036 class GeoDataPlacemark;
0037 class GeoDataLookAt;
0038 class GeoPainter;
0039 class GeoSceneDocument;
0040 class LayerInterface;
0041 class MarbleModel;
0042 class MarbleWidgetPopupMenu;
0043 class MarbleWidgetInputHandler;
0044 class MarbleWidgetPrivate;
0045 class RenderPlugin;
0046 class RenderState;
0047 class RoutingLayer;
0048 class TextureLayer;
0049 class VectorTileLayer;
0050 class TileCoordsPyramid;
0051 class TileCreator;
0052 class ViewportParams;
0053 class PopupLayer;
0054 class StyleBuilder;
0055 
0056 /**
0057  * @short A widget class that displays a view of the earth.
0058  *
0059  * This widget displays a view of the earth or any other globe,
0060  * depending on which dataset is used.  The user can navigate the
0061  * globe using either a control widget, e.g. the MarbleNavigator, or
0062  * the mouse.  The mouse and keyboard control is done through a
0063  * MarbleWidgetInputHandler. Only some aspects of the widget can be
0064  * controlled by the mouse and/or keyboard.
0065  *
0066  * By clicking on the globe and moving the mouse, the position can be
0067  * changed.  The user can also zoom by using the scroll wheel of the
0068  * mouse in the widget. The zoom value is not tied to any units, but
0069  * is an abstract value without any physical meaning. A value around
0070  * 1000 shows the full globe in a normal-sized window. Higher zoom
0071  * values give a more zoomed-in view.
0072  *
0073  * The MarbleWidget owns a data model to work. This model is contained
0074  * in the MarbleModel class, and it is painted by using a MarbleMap.
0075  * The widget takes care of creating the map and model. A MarbleModel
0076  * contains several datatypes, among them <b>tiles</b> which provide the
0077  * background, <b>vectors</b> which provide things like country
0078  * borders and coastlines and <b>placemarks</b> which can show points
0079  * of interest, such as cities, mountain tops or the poles.
0080  *
0081  * In addition to navigating with the mouse, you can also use it to
0082  * get information about items on the map. You can either click on a
0083  * placemark with the left mouse button or with the right mouse button
0084  * anywhere on the map.
0085  *
0086  * The left mouse button opens up a menu with all the placemarks
0087  * within a certain distance from the mouse pointer. When you choose
0088  * one item from the menu, Marble will open up a dialog window with
0089  * some information about the placemark and also try to connect to
0090  * Wikipedia to retrieve an article about it. If there is such an
0091  * article, you will get a mini-browser window with the article in a tab.
0092  *
0093  * @see MarbleNavigator
0094  * @see MarbleMap
0095  * @see MarbleModel
0096  */
0097 
0098 class MARBLE_EXPORT MarbleWidget : public QWidget
0099 {
0100     Q_OBJECT
0101 #ifdef MARBLE_DBUS
0102     Q_CLASSINFO("D-Bus Interface", "org.kde.MarbleWidget")
0103 #endif
0104 
0105     Q_PROPERTY(int zoom          READ zoom            WRITE setZoom)
0106 
0107     Q_PROPERTY(QString mapThemeId  READ mapThemeId    WRITE setMapThemeId)
0108     Q_PROPERTY(int projection    READ projection      WRITE setProjection)
0109 
0110     Q_PROPERTY(qreal longitude  READ centerLongitude WRITE setCenterLongitude)
0111     Q_PROPERTY(qreal latitude   READ centerLatitude  WRITE setCenterLatitude)
0112 
0113     Q_PROPERTY(bool showOverviewMap READ showOverviewMap    WRITE setShowOverviewMap)
0114     Q_PROPERTY(bool showScaleBar READ showScaleBar    WRITE setShowScaleBar)
0115     Q_PROPERTY(bool showCompass  READ showCompass     WRITE setShowCompass)
0116     Q_PROPERTY(bool showGrid     READ showGrid        WRITE setShowGrid)
0117 
0118     Q_PROPERTY(bool showClouds   READ showClouds      WRITE setShowClouds)
0119     Q_PROPERTY(bool showSunShading READ showSunShading WRITE setShowSunShading)
0120     Q_PROPERTY(bool showCityLights READ showCityLights WRITE setShowCityLights)
0121     Q_PROPERTY(bool isLockedToSubSolarPoint READ isLockedToSubSolarPoint WRITE setLockToSubSolarPoint)
0122     Q_PROPERTY(bool isSubSolarPointIconVisible READ isSubSolarPointIconVisible WRITE setSubSolarPointIconVisible)
0123     Q_PROPERTY(bool showAtmosphere READ showAtmosphere WRITE setShowAtmosphere)
0124     Q_PROPERTY(bool showCrosshairs READ showCrosshairs WRITE setShowCrosshairs)
0125 
0126     Q_PROPERTY(bool showPlaces   READ showPlaces      WRITE setShowPlaces)
0127     Q_PROPERTY(bool showCities   READ showCities      WRITE setShowCities)
0128     Q_PROPERTY(bool showTerrain  READ showTerrain     WRITE setShowTerrain)
0129     Q_PROPERTY(bool showOtherPlaces READ showOtherPlaces WRITE setShowOtherPlaces)
0130 
0131     Q_PROPERTY(bool showRelief   READ showRelief      WRITE setShowRelief)
0132 
0133     Q_PROPERTY(bool showIceLayer READ showIceLayer    WRITE setShowIceLayer)
0134     Q_PROPERTY(bool showBorders  READ showBorders     WRITE setShowBorders)
0135     Q_PROPERTY(bool showRivers   READ showRivers      WRITE setShowRivers)
0136     Q_PROPERTY(bool showLakes    READ showLakes       WRITE setShowLakes)
0137 
0138     Q_PROPERTY(ViewContext viewContext READ viewContext WRITE setViewContext NOTIFY viewContextChanged)
0139 
0140     Q_PROPERTY( RenderStatus renderStatus READ renderStatus NOTIFY renderStatusChanged )
0141 
0142     Q_PROPERTY(quint64 volatileTileCacheLimit    READ volatileTileCacheLimit    WRITE setVolatileTileCacheLimit)
0143 
0144  public:
0145 
0146     /**
0147      * @brief Construct a new MarbleWidget.
0148      * @param parent the parent widget
0149      *
0150      * This constructor should be used when you will only use one
0151      * MarbleWidget.  The widget will create its own MarbleModel when
0152      * created.
0153      */
0154     explicit MarbleWidget( QWidget *parent = nullptr );
0155 
0156     ~MarbleWidget() override;
0157 
0158     /// @name Access to helper objects
0159     //@{
0160 
0161     /**
0162      * @brief Return the model that this view shows.
0163      */
0164     MarbleModel *model();
0165     const MarbleModel *model() const;
0166 
0167     ViewportParams *viewport();
0168     const ViewportParams *viewport() const;
0169 
0170     MarbleWidgetPopupMenu *popupMenu();
0171 
0172     /**
0173      * Returns the current input handler
0174      */
0175     MarbleWidgetInputHandler *inputHandler() const;
0176 
0177     /**
0178      * @brief Set the input handler
0179      */
0180     void setInputHandler( MarbleWidgetInputHandler *handler );
0181 
0182     /**
0183      * @brief Returns a list of all RenderPlugins on the widget, this includes float items
0184      * @return the list of RenderPlugins
0185      */
0186     QList<RenderPlugin *> renderPlugins() const;
0187 
0188     /**
0189      * @brief Returns a list of all FloatItems on the widget
0190      * @return the list of the floatItems
0191      */
0192     QList<AbstractFloatItem *> floatItems() const;
0193 
0194     /**
0195      * @brief Returns the FloatItem with the given id
0196      * @return The pointer to the requested floatItem,
0197      *
0198      * If no item is found the null pointer is returned.
0199      */
0200     AbstractFloatItem * floatItem( const QString &nameId ) const;
0201 
0202     /**
0203      * Reads the plugin settings from the passed QSettings.
0204      * You shouldn't use this in a KDE application as these use KConfig. Here you could
0205      * use MarblePart which is handling this automatically.
0206      * @param settings The QSettings object to be used.
0207      */
0208     void readPluginSettings( QSettings& settings );
0209 
0210     /**
0211      * Writes the plugin settings in the passed QSettings.
0212      * You shouldn't use this in a KDE application as these use KConfig. Here you could
0213      * use MarblePart which is handling this automatically.
0214      * @param settings The QSettings object to be used.
0215      */
0216     void writePluginSettings( QSettings& settings ) const;
0217 
0218     /**
0219      * @brief Retrieve the view context (i.e. still or animated map)
0220      */
0221     ViewContext viewContext() const;
0222 
0223     /**
0224      * @brief Get the GeoSceneDocument object of the current map theme
0225      */
0226     GeoSceneDocument * mapTheme() const;
0227 
0228     /**
0229      * @brief Returns all widgets of dataPlugins on the position curpos
0230      */
0231     QList<AbstractDataPluginItem *> whichItemAt( const QPoint& curpos ) const;
0232 
0233     /**
0234      * @brief Add a layer to be included in rendering.
0235      */
0236     void addLayer( LayerInterface *layer );
0237 
0238     /**
0239      * @brief Remove a layer from being included in rendering.
0240      */
0241     void removeLayer( LayerInterface *layer );
0242 
0243     RoutingLayer* routingLayer();
0244 
0245     PopupLayer* popupLayer();
0246 
0247     /**
0248      * @since 0.26.0
0249      */
0250     const StyleBuilder* styleBuilder() const;
0251 
0252     /**
0253      * @brief  Get the Projection used for the map
0254      * @return @c Spherical         a Globe
0255      * @return @c Equirectangular   a flat map
0256      * @return @c Mercator          another flat map
0257      */
0258     Projection projection() const;
0259 //    int projection() const;
0260 
0261     //@}
0262 
0263     /// @name Visible map area
0264     //@{
0265 
0266     /**
0267      * @brief Get the ID of the current map theme
0268      * To ensure that a unique identifier is being used the theme does NOT
0269      * get represented by its name but the by relative location of the file
0270      * that specifies the theme:
0271      *
0272      * Example:
0273      *    mapThemeId = "earth/bluemarble/bluemarble.dgml"
0274      */
0275     QString mapThemeId() const;
0276 
0277     /**
0278      * @brief Return the projected region which describes the (shape of the) projected surface.
0279      */
0280     QRegion mapRegion() const;
0281 
0282     /**
0283      * @brief  Return the radius of the globe in pixels.
0284      */
0285     int radius() const;
0286 
0287     /**
0288      * @brief Return the current zoom amount.
0289      */
0290     int zoom() const;
0291 
0292     int tileZoomLevel() const;
0293 
0294     /**
0295      * @brief Return the current distance.
0296      */
0297     qreal distance() const;
0298 
0299     /**
0300      * @brief Return the current distance string.
0301      */
0302     QString distanceString() const;
0303 
0304     /**
0305      * @brief Return the minimum zoom value for the current map theme.
0306      */
0307     int minimumZoom() const;
0308 
0309     /**
0310      * @brief Return the minimum zoom value for the current map theme.
0311      */
0312     int maximumZoom() const;
0313 
0314     //@}
0315 
0316     /// @name Position management
0317     //@{
0318 
0319     /**
0320      * @brief Get the screen coordinates corresponding to geographical coordinates in the widget.
0321      * @param lon    the lon coordinate of the requested pixel position
0322      * @param lat    the lat coordinate of the requested pixel position
0323      * @param x      the x coordinate of the pixel is returned through this parameter
0324      * @param y      the y coordinate of the pixel is returned through this parameter
0325      * @return @c true  if the geographical coordinates are visible on the screen
0326      *         @c false if the geographical coordinates are not visible on the screen
0327      */
0328     bool screenCoordinates( qreal lon, qreal lat,
0329                             qreal& x, qreal& y ) const;
0330 
0331     /**
0332      * @brief Get the earth coordinates corresponding to a pixel in the widget.
0333      * @param x      the x coordinate of the pixel
0334      * @param y      the y coordinate of the pixel
0335      * @param lon    the longitude angle is returned through this parameter
0336      * @param lat    the latitude angle is returned through this parameter
0337      * @param unit   the angle unit
0338      * @return @c true  if the pixel (x, y) is within the globe
0339      *         @c false if the pixel (x, y) is outside the globe, i.e. in space.
0340      */
0341     bool geoCoordinates( int x, int y,
0342                          qreal& lon, qreal& lat,
0343                          GeoDataCoordinates::Unit = GeoDataCoordinates::Degree ) const;
0344 
0345     /**
0346      * @brief Return the longitude of the center point.
0347      * @return The longitude of the center point in degree.
0348      */
0349     qreal centerLongitude() const;
0350 
0351     /**
0352      * @brief Return the latitude of the center point.
0353      * @return The latitude of the center point in degree.
0354      */
0355     qreal centerLatitude() const;
0356 
0357     qreal heading() const;
0358 
0359     /**
0360      * @brief  Return how much the map will move if one of the move slots are called.
0361      * @return The move step.
0362      */
0363     qreal moveStep() const;
0364 
0365     /**
0366     * @brief Return the lookAt
0367     */
0368     GeoDataLookAt lookAt() const;
0369 
0370     /**
0371      * @return The current point of focus, e.g. the point that is not moved
0372      * when changing the zoom level. If not set, it defaults to the
0373      * center point.
0374      * @see centerLongitude centerLatitude setFocusPoint resetFocusPoint
0375      */
0376     GeoDataCoordinates focusPoint() const;
0377 
0378     /**
0379      * @brief Change the point of focus, overridding any previously set focus point.
0380      * @param focusPoint New focus point
0381      * @see focusPoint resetFocusPoint
0382      */
0383     void setFocusPoint( const GeoDataCoordinates &focusPoint );
0384 
0385     /**
0386      * @brief Invalidate any focus point set with @ref setFocusPoint.
0387      * @see focusPoint setFocusPoint
0388      */
0389     void resetFocusPoint();
0390 
0391     /**
0392       * @brief Return the globe radius (pixel) for the given distance (km)
0393       */
0394     qreal radiusFromDistance( qreal distance ) const;
0395 
0396     /**
0397       * @brief Return the distance (km) at the given globe radius (pixel)
0398       */
0399     qreal distanceFromRadius( qreal radius ) const;
0400 
0401     /**
0402       * Returns the zoom value (no unit) corresponding to the given camera distance (km)
0403       */
0404     qreal zoomFromDistance( qreal distance ) const;
0405 
0406     /**
0407       * Returns the distance (km) corresponding to the given zoom value
0408       */
0409     qreal distanceFromZoom( qreal zoom ) const;
0410 
0411     //@}
0412 
0413     /// @name Placemark management
0414     //@{
0415 
0416     QVector<const GeoDataFeature *> whichFeatureAt( const QPoint& ) const;
0417 
0418     //@}
0419 
0420     /// @name Float items and map appearance
0421     //@{
0422 
0423     /**
0424      * @brief  Return whether the overview map is visible.
0425      * @return The overview map visibility.
0426      */
0427     bool showOverviewMap() const;
0428 
0429     /**
0430      * @brief  Return whether the scale bar is visible.
0431      * @return The scale bar visibility.
0432      */
0433     bool showScaleBar() const;
0434 
0435     /**
0436      * @brief  Return whether the compass bar is visible.
0437      * @return The compass visibility.
0438      */
0439     bool showCompass() const;
0440 
0441     /**
0442      * @brief  Return whether the cloud cover is visible.
0443      * @return The cloud cover visibility.
0444      */
0445     bool showClouds() const;
0446 
0447     /**
0448      * @brief  Return whether the night shadow is visible.
0449      * @return visibility of night shadow
0450      */
0451     bool showSunShading() const;
0452 
0453     /**
0454      * @brief  Return whether the city lights are shown instead of the night shadow.
0455      * @return visibility of city lights
0456      */
0457     bool showCityLights() const;
0458 
0459     /**
0460      * @brief  Return whether the globe is locked to the sub solar point
0461      * @return if globe is locked to sub solar point
0462      */
0463     bool isLockedToSubSolarPoint() const;
0464 
0465     /**
0466      * @brief  Return whether the sun icon is shown in the sub solar point.
0467      * @return visibility of the sun icon in the sub solar point
0468      */
0469     bool isSubSolarPointIconVisible() const;
0470 
0471     /**
0472      * @brief  Return whether the atmospheric glow is visible.
0473      * @return The cloud cover visibility.
0474      */
0475     bool showAtmosphere() const;
0476 
0477     /**
0478      * @brief  Return whether the crosshairs are visible.
0479      * @return The crosshairs' visibility.
0480      */
0481     bool showCrosshairs() const;
0482 
0483     /**
0484      * @brief  Return whether the coordinate grid is visible.
0485      * @return The coordinate grid visibility.
0486      */
0487     bool showGrid() const;
0488 
0489     /**
0490      * @brief  Return whether the place marks are visible.
0491      * @return The place mark visibility.
0492      */
0493     bool showPlaces() const;
0494 
0495     /**
0496      * @brief  Return whether the city place marks are visible.
0497      * @return The city place mark visibility.
0498      */
0499     bool showCities() const;
0500 
0501     /**
0502      * @brief  Return whether the terrain place marks are visible.
0503      * @return The terrain place mark visibility.
0504      */
0505     bool showTerrain() const;
0506 
0507     /**
0508      * @brief  Return whether other places are visible.
0509      * @return The visibility of other places.
0510      */
0511     bool showOtherPlaces() const;
0512 
0513     /**
0514      * @brief  Return whether the relief is visible.
0515      * @return The relief visibility.
0516      */
0517     bool showRelief() const;
0518 
0519     /**
0520      * @brief  Return whether the ice layer is visible.
0521      * @return The ice layer visibility.
0522      */
0523     bool showIceLayer() const;
0524 
0525     /**
0526      * @brief  Return whether the borders are visible.
0527      * @return The border visibility.
0528      */
0529     bool showBorders() const;
0530 
0531     /**
0532      * @brief  Return whether the rivers are visible.
0533      * @return The rivers' visibility.
0534      */
0535     bool showRivers() const;
0536 
0537     /**
0538      * @brief  Return whether the lakes are visible.
0539      * @return The lakes' visibility.
0540      */
0541     bool showLakes() const;
0542 
0543     /**
0544      * @brief  Return whether the frame rate gets displayed.
0545      * @return the frame rates visibility
0546      */
0547     bool showFrameRate() const;
0548 
0549     bool showBackground() const;
0550 
0551     /**
0552      * @brief Retrieve the map quality depending on the view context
0553      */
0554     MapQuality mapQuality( ViewContext = Still ) const;
0555 
0556     /**
0557      * @brief Retrieve whether travels to a point should get animated
0558      */
0559     bool animationsEnabled() const;
0560 
0561     AngleUnit defaultAngleUnit() const;
0562     void setDefaultAngleUnit( AngleUnit angleUnit );
0563 
0564     QFont defaultFont() const;
0565     void setDefaultFont( const QFont& font );
0566 
0567     //@}
0568 
0569     /// @name Tile management
0570     //@{
0571 
0572     /**
0573      * @brief  Returns the limit in kilobytes of the volatile (in RAM) tile cache.
0574      * @return the limit of volatile tile cache
0575      */
0576     quint64 volatileTileCacheLimit() const;
0577 
0578     //@}
0579 
0580     /// @name Miscellaneous
0581     //@{
0582 
0583     /**
0584      * @brief  Return a QPixmap with the current contents of the widget.
0585      */
0586     QPixmap mapScreenShot();
0587 
0588     //@}
0589 
0590     /// @todo Enable this instead of the zoomView slot below for proper deprecation warnings
0591     /// around Marble 1.8
0592     // @deprecated Please use setZoom
0593     //MARBLE_DEPRECATED( void zoomView( int zoom, FlyToMode mode = Instant ) );
0594 
0595     /**
0596      * Summarized render status of the current map view
0597      * @see renderState
0598      */
0599     RenderStatus renderStatus() const;
0600 
0601     /**
0602      * Detailed render status of the current map view
0603      */
0604     RenderState renderState() const;
0605 
0606     /**
0607      * Toggle whether regions are highlighted when user selects them
0608      */
0609     void setHighlightEnabled( bool enabled );
0610 
0611  public Q_SLOTS:
0612 
0613     /// @name Position management slots
0614     //@{
0615 
0616     /**
0617      * @brief  Set the radius of the globe in pixels.
0618      * @param  radius  The new globe radius value in pixels.
0619      */
0620     void setRadius( int radius );
0621 
0622     /**
0623      * @brief  Zoom the view to a certain zoomlevel
0624      * @param  zoom  the new zoom level.
0625      * @param  mode  the FlyToMode that will be used.
0626      *
0627      * The zoom level is an abstract value without physical
0628      * interpretation.  A zoom value around 1000 lets the viewer see
0629      * all of the earth in the default window.
0630      */
0631     void setZoom( int zoom, FlyToMode mode = Instant );
0632 
0633     /**
0634      * @deprecated To be removed soon. Please use setZoom instead. Same parameters.
0635      */
0636     void zoomView( int zoom, FlyToMode mode = Instant );
0637 
0638     /**
0639      * @brief  Zoom the view by a certain step
0640      * @param  zoomStep  the difference between the old zoom and the new
0641      * @param  mode  the FlyToMode that will be used.
0642      */
0643     void zoomViewBy( int zoomStep, FlyToMode mode = Instant );
0644 
0645         /**
0646      * @brief  Zoom in by the amount zoomStep.
0647      */
0648     void zoomIn( FlyToMode mode = Automatic );
0649     /**
0650      * @brief  Zoom out by the amount zoomStep.
0651      */
0652     void zoomOut( FlyToMode mode = Automatic );
0653 
0654     /**
0655      * @brief  Set the distance of the observer to the globe in km.
0656      * @param  distance  The new distance in km.
0657      */
0658     void setDistance( qreal distance );
0659 
0660     /**
0661      * @brief  Rotate the view by the two angles phi and theta.
0662      * @param  deltaLon  an angle that specifies the change in terms of longitude
0663      * @param  deltaLat  an angle that specifies the change in terms of latitude
0664      * @param  mode  the FlyToMode that will be used
0665      *
0666      * This function rotates the view by two angles,
0667      * deltaLon ("theta") and deltaLat ("phi").
0668      * If we start at (0, 0), the result will be the exact equivalent
0669      * of (lon, lat), otherwise the resulting angle will be the sum of
0670      * the previous position and the two offsets.
0671      */
0672     void rotateBy( const qreal deltaLon, const qreal deltaLat, FlyToMode mode = Instant );
0673 
0674     /**
0675      * @brief  Center the view on a geographical point
0676      * @param  lat  an angle in degrees parallel to the latitude lines
0677      *              +90(N) - -90(S)
0678      * @param  lon  an angle in degrees parallel to the longitude lines
0679      *              +180(W) - -180(E)
0680      * @param  animated whether to use animation
0681      */
0682     void centerOn( const qreal lon, const qreal lat, bool animated = false );
0683 
0684     /**
0685      * @brief  Center the view on a point
0686      * This method centers the Marble map on the point described by the latitude
0687      * and longitude in the GeoDataCoordinate parameter @c point. It also zooms
0688      * the map to be at the elevation described by the altitude. If this is
0689      * not the desired functionality or you do not have an accurate altitude
0690      * then use @see centerOn(qreal, qreal, bool)
0691      * @param point the point in 3 dimensions above the globe to move the view
0692      *              to. It will always be looking vertically down.
0693      * @param  animated whether to use animation
0694      */
0695     void centerOn( const GeoDataCoordinates &point, bool animated = false );
0696 
0697     /**
0698      * @brief Center the view on a bounding box so that it completely fills the viewport
0699      * This method not only centers on the center of the GeoDataLatLon box but it also
0700      * adjusts the zoom of the marble widget so that the LatLon box provided fills
0701      * the viewport.
0702      * @param box The GeoDataLatLonBox to zoom and move the MarbleWidget to.
0703      * @param  animated whether to use animation.
0704      */
0705     void centerOn( const GeoDataLatLonBox& box, bool animated = false );
0706 
0707     /**
0708      * @brief Center the view on a placemark according to the following logic:
0709      * - if the placemark has a lookAt, zoom and center on that lookAt
0710      * - otherwise use the placemark geometry's latLonAltBox
0711      * @param placemark The GeoDataPlacemark to zoom and move the MarbleWidget to.
0712      * @param animated Whether the centering is animated.
0713      */
0714     void centerOn( const GeoDataPlacemark& placemark, bool animated = false );
0715 
0716     /**
0717      * @brief  Set the latitude for the center point
0718      * @param  lat  the new value for the latitude in degree.
0719      * @param  mode the FlyToMode that will be used.
0720      */
0721     void setCenterLatitude( qreal lat, FlyToMode mode = Instant );
0722 
0723     /**
0724      * @brief  Set the longitude for the center point
0725      * @param  lon  the new value for the longitude in degree.
0726      * @param  mode the FlyToMode that will be used.
0727      */
0728     void setCenterLongitude( qreal lon, FlyToMode mode = Instant );
0729 
0730     void setHeading( qreal heading );
0731 
0732     /**
0733      * @brief  Move left by the moveStep.
0734      */
0735     void moveLeft( FlyToMode mode = Automatic );
0736 
0737     /**
0738      * @brief  Move right by the moveStep.
0739      */
0740     void moveRight( FlyToMode mode = Automatic );
0741 
0742     /**
0743      * @brief  Move up by the moveStep.
0744      */
0745     void moveUp( FlyToMode mode = Automatic );
0746 
0747     /**
0748      * @brief  Move down by the moveStep.
0749      */
0750     void moveDown( FlyToMode mode = Automatic );
0751 
0752     /**
0753      * @brief Center the view on the default start point with the default zoom.
0754      */
0755     void goHome( FlyToMode mode = Automatic );
0756 
0757     /**
0758       * @brief Change the camera position to the given position.
0759       * @param lookAt New camera position. Changing the camera position means
0760       * that both the current center position as well as the zoom value may change
0761       * @param mode Interpolation type for intermediate camera positions. Automatic
0762       * (default) chooses a suitable interpolation among Instant, Lenar and Jump.
0763       * Instant will directly set the new zoom and position values, while
0764       * Linear results in a linear interpolation of intermediate center coordinates
0765       * along the sphere and a linear interpolation of changes in the camera distance
0766       * to the ground. Finally, Jump will behave the same as Linear with regard to
0767       * the center position interpolation, but use a parabolic height increase
0768       * towards the middle point of the intermediate positions. This appears
0769       * like a jump of the camera.
0770       */
0771     void flyTo( const GeoDataLookAt &lookAt, FlyToMode mode = Automatic );
0772 
0773     //@}
0774 
0775     /// @name Float items and map appearance slots
0776     //@{
0777 
0778     /**
0779      * @brief  Set the Projection used for the map
0780      * @param  projection projection type (e.g. Spherical, Equirectangular, Mercator)
0781      */
0782     void setProjection( int        projection );
0783     void setProjection( Projection projection );
0784 
0785     /**
0786      * @brief Set a new map theme
0787      * @param maptheme  The ID of the new maptheme. To ensure that a unique
0788      * identifier is being used the theme does NOT get represented by its
0789      * name but the by relative location of the file that specifies the theme:
0790      *
0791      * Example:
0792      *    maptheme = "earth/bluemarble/bluemarble.dgml"
0793      */ 
0794     void setMapThemeId( const QString& maptheme );
0795 
0796     /**
0797      * @brief  Sets the value of a map theme property
0798      * @param  name   name of the property
0799      * @param  value  value of the property (usually: visibility)
0800      * 
0801      * Later on we might add a setPropertyType and a QVariant
0802      * if needed.
0803      */
0804     void setPropertyValue( const QString& name, bool value );
0805 
0806     /**
0807      * @brief  Set whether the overview map overlay is visible
0808      * @param  visible  visibility of the overview map
0809      */
0810     void setShowOverviewMap( bool visible );
0811 
0812     /**
0813      * @brief  Set whether the scale bar overlay is visible
0814      * @param  visible  visibility of the scale bar
0815      */
0816     void setShowScaleBar( bool visible );
0817 
0818     /**
0819      * @brief  Set whether the compass overlay is visible
0820      * @param  visible  visibility of the compass
0821      */
0822     void setShowCompass( bool visible );
0823 
0824     /**
0825      * @brief  Set whether the cloud cover is visible
0826      * @param  visible  visibility of the cloud cover
0827      */
0828     void setShowClouds( bool visible );
0829 
0830     /**
0831      * @brief  Set whether the night shadow is visible.
0832      * @param  visible visibility of shadow
0833      */
0834     void setShowSunShading( bool visible );
0835 
0836     /**
0837      * @brief  Set whether city lights instead of night shadow are visible.
0838      * @param  visible visibility of city lights
0839      */
0840     void setShowCityLights( bool visible );
0841 
0842     /**
0843      * @brief  Set the globe locked to the sub solar point
0844      * @param  visible if globe is locked to the sub solar point
0845      */
0846     void setLockToSubSolarPoint( bool visible );
0847 
0848     /**
0849      * @brief  Set whether the sun icon is shown in the sub solar point
0850      * @param  visible if the sun icon is shown in the sub solar point
0851      */
0852     void setSubSolarPointIconVisible( bool visible );
0853 
0854     /**
0855      * @brief  Set whether the atmospheric glow is visible
0856      * @param  visible  visibility of the atmospheric glow
0857      */
0858     void setShowAtmosphere( bool visible );
0859 
0860     /**
0861      * @brief  Set whether the crosshairs are visible
0862      * @param  visible  visibility of the crosshairs
0863      */
0864     void setShowCrosshairs( bool visible );
0865 
0866     /**
0867      * @brief  Set whether the coordinate grid overlay is visible
0868      * @param  visible  visibility of the coordinate grid
0869      */
0870     void setShowGrid( bool visible );
0871 
0872     /**
0873      * @brief  Set whether the place mark overlay is visible
0874      * @param  visible  visibility of the place marks
0875      */
0876     void setShowPlaces( bool visible );
0877 
0878     /**
0879      * @brief  Set whether the city place mark overlay is visible
0880      * @param  visible  visibility of the city place marks
0881      */
0882     void setShowCities( bool visible );
0883 
0884     /**
0885      * @brief  Set whether the terrain place mark overlay is visible
0886      * @param  visible  visibility of the terrain place marks
0887      */
0888     void setShowTerrain( bool visible );
0889 
0890     /**
0891      * @brief  Set whether the other places overlay is visible
0892      * @param  visible  visibility of other places
0893      */
0894     void setShowOtherPlaces( bool visible );
0895 
0896     /**
0897      * @brief  Set whether the relief is visible
0898      * @param  visible  visibility of the relief
0899      */
0900     void setShowRelief( bool visible );
0901 
0902     /**
0903      * @brief  Set whether the ice layer is visible
0904      * @param  visible  visibility of the ice layer
0905      */
0906     void setShowIceLayer( bool visible );
0907 
0908     /**
0909      * @brief  Set whether the borders visible
0910      * @param  visible  visibility of the borders
0911      */
0912     void setShowBorders( bool visible );
0913 
0914     /**
0915      * @brief  Set whether the rivers are visible
0916      * @param  visible  visibility of the rivers
0917      */
0918     void setShowRivers( bool visible );
0919 
0920     /**
0921      * @brief  Set whether the lakes are visible
0922      * @param  visible  visibility of the lakes
0923      */
0924     void setShowLakes( bool visible );
0925 
0926     /**
0927      * @brief Set whether the frame rate gets shown
0928      * @param visible  visibility of the frame rate
0929      */
0930     void setShowFrameRate( bool visible );
0931 
0932     void setShowBackground( bool visible );
0933 
0934     /**
0935      * @brief Set whether the is tile is visible
0936      * NOTE: This is part of the transitional debug API
0937      *       and might be subject to changes until Marble 0.8
0938      * @param visible visibility of the tile
0939      */
0940     void setShowTileId( bool visible );
0941 
0942     /**
0943      * @brief Set whether the runtime tracing for layers gets shown
0944      * @param visible visibility of the runtime tracing
0945      */
0946     void setShowRuntimeTrace( bool visible );
0947 
0948     bool showRuntimeTrace() const;
0949 
0950     /**
0951      * @brief Set whether to enter the debug mode for
0952      * polygon node drawing
0953      * @param visible visibility of the node debug mode
0954      */
0955     void setShowDebugPolygons( bool visible);
0956 
0957     bool showDebugPolygons() const;
0958 
0959     /**
0960      * @brief Set whether to enter the debug mode for
0961      * batch rendering
0962      * @param visible visibility of the batch rendering
0963      */
0964     void setShowDebugBatchRender( bool visible);
0965 
0966     bool showDebugBatchRender() const;
0967 
0968     /**
0969      * @brief Set whether to enter the debug mode for
0970      * placemark drawing
0971      * @param visible visibility of the node debug mode
0972      */
0973     void setShowDebugPlacemarks(bool visible);
0974 
0975     bool showDebugPlacemarks() const;
0976 
0977     /**
0978      * @brief Set whether to render according to OSM indoor level tags
0979      * @param visible visibility of entities (placemarks, buildings etc.) level-wise
0980      */
0981     void setDebugLevelTags(bool visible);
0982 
0983     bool debugLevelTags() const;
0984 
0985     /**
0986      * @brief Set the level to debug
0987      * @param level the level to debug
0988      */
0989     void setLevelToDebug(int level);
0990 
0991     int levelToDebug() const;
0992 
0993         /**
0994      * @brief Set the map quality for the specified view context.
0995      *
0996      * @param quality map quality for the specified view context
0997      * @param viewContext view context whose map quality should be set
0998      */
0999     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      */
1107     void pluginSettingsChanged();
1108     
1109     /**
1110      * @brief Signal that a render item has been initialized
1111      */
1112     void renderPluginInitialized( RenderPlugin *renderPlugin );
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      */
1124     void renderStatusChanged( RenderStatus status );
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