marble/src
MarbleWidget.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef MARBLEWIDGET_H
00014 #define MARBLEWIDGET_H
00015
00016
00025 #include <QtCore/QTimer>
00026 #include <QtGui/QWidget>
00027 #include <QtGui/QImage>
00028 #include <QtGui/QPixmap>
00029 #include <QtDesigner/QDesignerExportWidget>
00030
00031
00032
00033 #include "marble_export.h"
00034 #include "GeoDataCoordinates.h"
00035 #include "MarbleWidgetInputHandler.h"
00036 #include "global.h"
00037
00038
00039 class QAbstractItemModel;
00040 class QModelIndex;
00041 class QItemSelectionModel;
00042 class QStyleOptionGraphicsItem;
00043
00044 namespace Marble
00045 {
00046
00047
00048
00049 class MarbleWidgetPrivate;
00050
00051
00052 class BoundingBox;
00053 class MarbleMap;
00054 class MarbleModel;
00055 class HttpDownloadManager;
00056 class TileCreator;
00057 class SunLocator;
00058 class GpxFileModel;
00059 class FileViewModel;
00060 class GeoPainter;
00061 class MarbleRenderPlugin;
00062 class MarbleAbstractFloatItem;
00063 class GeoSceneDocument;
00064
00115 class MARBLE_EXPORT MarbleWidget : public QWidget
00116 {
00117 Q_OBJECT
00118 Q_CLASSINFO("D-Bus Interface", "org.kde.marble")
00119
00120 Q_PROPERTY(int zoom READ zoom WRITE zoomView)
00121
00122 Q_PROPERTY(QString mapThemeId READ mapThemeId WRITE setMapThemeId)
00123 Q_PROPERTY(int projection READ projection WRITE setProjection)
00124
00125 Q_PROPERTY(qreal longitude READ centerLongitude WRITE setCenterLongitude)
00126 Q_PROPERTY(qreal latitude READ centerLatitude WRITE setCenterLatitude)
00127
00128 Q_PROPERTY(bool showOverviewMap READ showOverviewMap WRITE setShowOverviewMap)
00129 Q_PROPERTY(bool showScaleBar READ showScaleBar WRITE setShowScaleBar)
00130 Q_PROPERTY(bool showCompass READ showCompass WRITE setShowCompass)
00131 Q_PROPERTY(bool showGrid READ showGrid WRITE setShowGrid)
00132
00133 Q_PROPERTY(bool showClouds READ showClouds WRITE setShowClouds)
00134 Q_PROPERTY(bool showAtmosphere READ showAtmosphere WRITE setShowAtmosphere)
00135
00136 Q_PROPERTY(bool showPlaces READ showPlaces WRITE setShowPlaces)
00137 Q_PROPERTY(bool showCities READ showCities WRITE setShowCities)
00138 Q_PROPERTY(bool showTerrain READ showTerrain WRITE setShowTerrain)
00139 Q_PROPERTY(bool showOtherPlaces READ showOtherPlaces WRITE setShowOtherPlaces)
00140
00141 Q_PROPERTY(bool showRelief READ showRelief WRITE setShowRelief)
00142 Q_PROPERTY(bool showElevationModel READ showElevationModel WRITE setShowElevationModel)
00143
00144 Q_PROPERTY(bool showIceLayer READ showIceLayer WRITE setShowIceLayer)
00145 Q_PROPERTY(bool showBorders READ showBorders WRITE setShowBorders)
00146 Q_PROPERTY(bool showRivers READ showRivers WRITE setShowRivers)
00147 Q_PROPERTY(bool showLakes READ showLakes WRITE setShowLakes)
00148
00149 Q_PROPERTY(quint64 persistentTileCacheLimit READ persistentTileCacheLimit WRITE setPersistentTileCacheLimit)
00150 Q_PROPERTY(quint64 volatileTileCacheLimit READ volatileTileCacheLimit WRITE setVolatileTileCacheLimit)
00151
00152 public:
00153
00162 explicit MarbleWidget( QWidget *parent = 0);
00163
00173 explicit MarbleWidget(MarbleMap *map, QWidget *parent = 0);
00174
00175 virtual ~MarbleWidget();
00176
00180 MarbleMap *map() const;
00181
00185 MarbleModel *model() const;
00186
00190 void setInputHandler(MarbleWidgetInputHandler *handler);
00191
00199 void setDownloadManager( HttpDownloadManager *downloadManager );
00200
00204 const QRegion activeRegion();
00205
00209 const QRegion projectedRegion();
00210
00214 int radius() const;
00215
00220 void setRadius(const int radius);
00221
00225 int zoom() const;
00226
00230 qreal distance() const;
00231
00236 void setDistance( qreal distance );
00237
00241 QString distanceString() const;
00242
00246 int minimumZoom() const;
00247
00251 int maximumZoom() const;
00252
00256 bool needsUpdate() const;
00260 void setNeedsUpdate();
00261
00271 bool screenCoordinates( const qreal lon, const qreal lat,
00272 int& x, int& y );
00273
00278 int northPoleY();
00279
00289 bool geoCoordinates( const int x, const int y,
00290 qreal& lon, qreal& lat,
00291 GeoDataCoordinates::Unit = GeoDataCoordinates::Degree );
00292
00301 bool globalQuaternion( int x, int y, Quaternion &q);
00302
00303
00304
00308 qreal centerLongitude() const;
00309
00313 qreal centerLatitude() const;
00314
00318 QAbstractItemModel *placeMarkModel() const;
00319
00323 QItemSelectionModel *placeMarkSelectionModel() const;
00324
00329 qreal moveStep();
00330
00335 void addPlaceMarkFile( const QString &filename );
00336
00341 void addPlaceMarkData( const QString &data );
00342
00347 Quaternion planetAxis() const;
00348
00352 QPixmap mapScreenShot();
00353
00358 bool showOverviewMap() const;
00359
00364 bool showScaleBar() const;
00365
00370 bool showCompass() const;
00371
00376 bool showClouds() const;
00377
00382 bool showAtmosphere() const;
00383
00388 bool showGrid() const;
00389
00394 bool showPlaces() const;
00395
00400 bool showCities() const;
00401
00406 bool showTerrain() const;
00407
00412 bool showOtherPlaces() const;
00413
00418 bool showRelief() const;
00419
00424 bool showElevationModel() const;
00425
00430 bool showIceLayer() const;
00431
00436 bool showBorders() const;
00437
00442 bool showRivers() const;
00443
00448 bool showLakes() const;
00449
00454 bool showGps() const;
00455
00460 bool showFrameRate() const;
00461
00466 quint64 persistentTileCacheLimit() const;
00467
00472 quint64 volatileTileCacheLimit() const;
00473
00474 SunLocator* sunLocator();
00475
00476 void setProxy( const QString& proxyHost, const quint16 proxyPort );
00477 QString proxyHost() const;
00478 quint16 proxyPort() const;
00479
00480 QList<MarbleRenderPlugin *> renderPlugins() const;
00481 QList<MarbleAbstractFloatItem *> floatItems() const;
00482
00483 public Q_SLOTS:
00484
00485 void updateSun();
00486 void centerSun();
00487 void enableInput();
00488 void disableInput();
00489
00490
00499 void zoomView(int zoom);
00500
00505 void zoomViewBy(int zoomStep);
00506
00510 void zoomIn();
00514 void zoomOut();
00515
00527 void rotateBy( const qreal &deltaLon, const qreal &deltaLat );
00528
00533 void rotateBy(const Quaternion& incRot);
00534
00542 void centerOn( const qreal &lon, const qreal &lat, bool animated = false );
00543
00548 void centerOn( const QModelIndex& index, bool animated = false );
00549
00555 void centerOn( const GeoDataCoordinates &point, bool animated = false );
00556
00561 void setCenterLatitude( qreal lat );
00562
00567 void setCenterLongitude( qreal lon );
00568
00575 Projection projection() const;
00576
00577
00582 void setProjection( int projection );
00583 void setProjection( Projection projection );
00584
00591 void home(qreal &lon, qreal &lat, int& zoom);
00598 void setHome(const qreal lon, const qreal lat, const int zoom = 1050);
00604 void setHome(const GeoDataCoordinates& homePoint, int zoom = 1050);
00605
00609 void moveLeft();
00613 void moveRight();
00617 void moveUp();
00621 void moveDown();
00622
00626 void goHome();
00627
00637 QString mapThemeId() const;
00638
00642 Marble::GeoSceneDocument *mapTheme() const;
00643
00653 void setMapThemeId( const QString& maptheme );
00654
00662 void setPropertyValue( const QString& name, bool value );
00663
00668 void setShowOverviewMap( bool visible );
00669
00674 void setShowScaleBar( bool visible );
00675
00680 void setShowCompass( bool visible );
00681
00686 void setShowClouds( bool visible );
00687
00692 void setShowAtmosphere( bool visible );
00693
00698 void setShowGrid( bool visible );
00699
00704 void setShowPlaces( bool visible );
00705
00710 void setShowCities( bool visible );
00711
00716 void setShowTerrain( bool visible );
00717
00722 void setShowOtherPlaces( bool visible );
00723
00728 void setShowRelief( bool visible );
00729
00734 void setShowElevationModel( bool visible );
00735
00740 void setShowIceLayer( bool visible );
00741
00746 void setShowBorders( bool visible );
00747
00752 void setShowRivers( bool visible );
00753
00758 void setShowLakes( bool visible );
00759
00764 void setShowGps( bool visible );
00765
00770 void setShowFrameRate( bool visible );
00771
00777 void changeCurrentPosition( qreal lon, qreal lat );
00778
00782 void notifyMouseClick( int x, int y );
00783
00787 void updateGps();
00788
00792 void openGpxFile( QString &filename );
00793
00797 GpxFileModel *gpxFileModel();
00798
00802 FileViewModel* fileViewModel() const;
00803
00804 void clearPersistentTileCache();
00809 void setPersistentTileCacheLimit( quint64 kiloBytes );
00810
00811 void clearVolatileTileCache();
00816 void setVolatileTileCacheLimit( quint64 kiloBytes );
00817
00836 void creatingTilesStart( TileCreator *creator, const QString& name, const QString& description );
00837
00841 void updateChangedMap();
00842
00846 void updateRegion( BoundingBox& );
00847
00852 void setDownloadUrl( const QString &url );
00853
00858 void setDownloadUrl( const QUrl &url );
00859
00863 Marble::MapQuality mapQuality( Marble::ViewContext = Marble::Still );
00864
00868 void setMapQuality( Marble::MapQuality, Marble::ViewContext = Marble::Still );
00869
00873 Marble::ViewContext viewContext( ) const;
00874
00878 void setViewContext( Marble::ViewContext viewContext );
00879
00883 bool animationsEnabled() const;
00884
00888 void setAnimationsEnabled( bool enabled );
00889
00890 Marble::AngleUnit defaultAngleUnit() const;
00891 void setDefaultAngleUnit( Marble::AngleUnit angleUnit );
00892
00893 QFont defaultFont() const;
00894 void setDefaultFont( const QFont& font );
00895
00896 private Q_SLOTS:
00897
00898 void updateAnimation( qreal currentValue );
00899
00900 Q_SIGNALS:
00906 void zoomChanged( int zoom );
00907 void distanceChanged( const QString& distanceString );
00908
00913 void themeChanged( QString theme );
00914
00915 void projectionChanged( Projection );
00916
00917 void mouseMoveGeoPosition( QString );
00918
00919 void mouseClickGeoPosition( qreal lon, qreal lat, GeoDataCoordinates::Unit );
00920
00921 void timeout();
00922
00923 void framesPerSecond( qreal fps );
00924
00925 protected:
00929 void leaveEvent( QEvent *event );
00930
00934 void paintEvent( QPaintEvent *event );
00935
00941 virtual void customPaint( GeoPainter *painter );
00942
00946 void resizeEvent( QResizeEvent* );
00947
00948 void connectNotify ( const char * signal );
00949 void disconnectNotify ( const char * signal );
00950
00951 private:
00952 Q_DISABLE_COPY( MarbleWidget )
00953 MarbleWidgetPrivate * const d;
00954 };
00955
00956 }
00957
00958 #endif // MARBLEWIDGET_H