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 <QtGui/QWidget>
00026 #include <QtGui/QImage>
00027 #include <QtGui/QPixmap>
00028 #include <QtDesigner/QDesignerExportWidget>
00029
00030
00031
00032 #include "GeoDataPoint.h"
00033 #include "marble_export.h"
00034 #include "MarbleModel.h"
00035 #include "CrossHairFloatItem.h"
00036 #include "CompassFloatItem.h"
00037 #include "MapScaleFloatItem.h"
00038
00039 class QStyleOptionGraphicsItem;
00040 class MarbleWidgetInputHandler;
00041 class MarbleWidgetPopupMenu;
00042 class TextureColorizer;
00043 class MeasureTool;
00044 class TileCreator;
00045 class MarbleWidgetPrivate;
00046 class GpsLayer;
00047 class GpxFileModel;
00048 class FileViewModel;
00049
00050
00099 class MARBLE_EXPORT MarbleWidget : public QWidget
00100 {
00101 Q_OBJECT
00102 Q_CLASSINFO("D-Bus Interface", "org.kde.marble")
00103
00104 Q_PROPERTY(int zoom READ zoom WRITE zoomView)
00105
00106 Q_PROPERTY(double longitude READ centerLongitude WRITE setCenterLongitude)
00107 Q_PROPERTY(double latitude READ centerLatitude WRITE setCenterLatitude)
00108
00109 Q_PROPERTY(bool showScaleBar READ showScaleBar WRITE setShowScaleBar)
00110 Q_PROPERTY(bool showCompass READ showCompass WRITE setShowCompass)
00111 Q_PROPERTY(bool showGrid READ showGrid WRITE setShowGrid)
00112 Q_PROPERTY(bool showPlaces READ showPlaces WRITE setShowPlaces)
00113 Q_PROPERTY(bool showCities READ showCities WRITE setShowCities)
00114 Q_PROPERTY(bool showTerrain READ showTerrain WRITE setShowTerrain)
00115 Q_PROPERTY(bool showOtherPlaces READ showOtherPlaces WRITE setShowOtherPlaces)
00116
00117 Q_PROPERTY(bool showRelief READ showRelief WRITE setShowRelief)
00118 Q_PROPERTY(bool showElevationModel READ showElevationModel WRITE setShowElevationModel)
00119
00120 Q_PROPERTY(bool showIceLayer READ showIceLayer WRITE setShowIceLayer)
00121 Q_PROPERTY(bool showBorders READ showBorders WRITE setShowBorders)
00122 Q_PROPERTY(bool showRivers READ showRivers WRITE setShowRivers)
00123 Q_PROPERTY(bool showLakes READ showLakes WRITE setShowLakes)
00124
00125 Q_PROPERTY(bool quickDirty READ quickDirty WRITE setQuickDirty)
00126
00127 public:
00128
00137 explicit MarbleWidget( QWidget *parent = 0);
00138
00148 explicit MarbleWidget(MarbleModel *model, QWidget *parent = 0);
00149
00150 virtual ~MarbleWidget();
00151
00155 MarbleModel *model() const;
00156
00160 void setInputHandler(MarbleWidgetInputHandler *handler);
00161
00169 void setDownloadManager(HttpDownloadManager *downloadManager);
00170
00171
00175 const QRegion activeRegion();
00176
00180 int radius() const;
00181
00186 void setRadius(const int radius);
00187
00191 int zoom() const;
00192
00196 QString distanceString() const;
00197
00201 int minimumZoom() const;
00202
00206 int maximumZoom() const;
00207
00211 bool needsUpdate() const;
00215 void setNeedsUpdate();
00216
00226 bool screenCoordinates( const double lon, const double lat,
00227 int& x, int& y );
00228
00233 int northPoleY();
00244 int northPoleZ();
00245
00255 bool geoCoordinates( const int x, const int y,
00256 double& lon, double& lat,
00257 GeoDataPoint::Unit=GeoDataPoint::Degree);
00258
00267 bool globalQuaternion( int x, int y, Quaternion &q);
00268
00269
00270
00274 double centerLongitude() const;
00275
00279 double centerLatitude() const;
00280
00284 QAbstractItemModel *placeMarkModel() const;
00285
00289 QItemSelectionModel *placeMarkSelectionModel() const;
00290
00295 double moveStep();
00296
00301 void addPlaceMarkFile( const QString &filename );
00302
00307 Quaternion planetAxis() const;
00308
00312 QPixmap mapScreenShot();
00313
00318 bool showScaleBar() const;
00319
00324 bool showCompass() const;
00325
00330 bool showGrid() const;
00331
00336 bool showPlaces() const;
00337
00342 bool showCities() const;
00343
00348 bool showTerrain() const;
00349
00354 bool showOtherPlaces() const;
00355
00360 bool showRelief() const;
00361
00366 bool showElevationModel() const;
00367
00372 bool showIceLayer() const;
00373
00378 bool showBorders() const;
00379
00384 bool showRivers() const;
00385
00390 bool showLakes() const;
00391
00396 bool showGps() const;
00397
00402 bool showFrameRate() const;
00403
00408 bool quickDirty() const;
00409
00410 bool globeCoversImage() const;
00411
00412
00413 public Q_SLOTS:
00414
00421 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
00422 QWidget *widget);
00431 void zoomView(int zoom);
00432
00437 void zoomViewBy(int zoomStep);
00438
00442 void zoomIn();
00446 void zoomOut();
00447
00461 void rotateBy( const double &deltaLon, const double &deltaLat );
00462
00469 void rotateBy(const Quaternion& incRot);
00470
00480 void centerOn(const double &lon, const double &lat);
00481
00488 void centerOn(const QModelIndex& index);
00489
00496 void setCenterLatitude( double lat );
00497
00504 void setCenterLongitude( double lon );
00505
00516 void rotateTo(const double& lon, const double& lat);
00517
00530 void rotateTo( const double& lon, const double& lat, const double& psi);
00531
00539 void rotateTo(const Quaternion& quat);
00540
00547 Projection projection() const;
00548
00553 void setProjection( int projection );
00554
00561 void home(double &lon, double &lat, int& zoom);
00568 void setHome(const double lon, const double lat, const int zoom = 1050);
00574 void setHome(const GeoDataPoint& homePoint, int zoom = 1050);
00575
00579 void moveLeft();
00583 void moveRight();
00587 void moveUp();
00591 void moveDown();
00592
00596 void goHome();
00597
00607 QString mapTheme() const;
00617 void setMapTheme( const QString& maptheme );
00618
00623 void setShowScaleBar( bool visible );
00624
00629 void setShowCompass( bool visible );
00630
00635 void setShowGrid( bool visible );
00636
00641 void setShowPlaces( bool visible );
00642
00647 void setShowCities( bool visible );
00648
00653 void setShowTerrain( bool visible );
00654
00659 void setShowOtherPlaces( bool visible );
00660
00665 void setShowRelief( bool visible );
00666
00671 void setShowElevationModel( bool visible );
00672
00677 void setShowIceLayer( bool visible );
00678
00683 void setShowBorders( bool visible );
00684
00689 void setShowRivers( bool visible );
00690
00695 void setShowLakes( bool visible );
00696
00701 void setShowGps( bool visible );
00702
00707 void setShowFrameRate( bool visible );
00708
00714 void changeCurrentPosition( double lon, double lat );
00715
00719 void notifyMouseClick( int x, int y );
00720
00724 void updateGps();
00725
00729 void openGpxFile( QString &filename );
00730
00734 GpxFileModel *gpxFileModel();
00735
00739 FileViewModel* fileViewModel() const;
00740
00745 void setQuickDirty( bool enabled );
00746
00765 void creatingTilesStart( TileCreator *creator, const QString& name, const QString& description );
00766
00770 void updateChangedMap();
00771
00775 void updateRegion( BoundingBox );
00776
00781 void setDownloadUrl( const QString &url );
00782
00787 void setDownloadUrl( const QUrl &url );
00788
00789 Q_SIGNALS:
00795 void zoomChanged( int zoom );
00796 void distanceChanged( const QString& distanceString );
00797
00802 void themeChanged( QString theme );
00803
00804 void projectionChanged( int );
00805
00806 void mouseMoveGeoPosition( QString );
00807
00808 void mouseClickGeoPosition( double lon, double lat, GeoDataPoint::Unit );
00809
00810 void timeout();
00811
00812 void framesPerSecond( double fps );
00813
00814 protected:
00818 void leaveEvent( QEvent *event );
00819
00823 void paintEvent( QPaintEvent *event );
00824
00830 virtual void customPaint( ClipPainter *painter );
00831
00835 void resizeEvent( QResizeEvent* );
00836
00837 void connectNotify ( const char * signal );
00838 void disconnectNotify ( const char * signal );
00839
00840 private:
00841 void construct( QWidget *parent );
00842
00843 int toLogScale(int);
00844 int fromLogScale(int);
00845
00846 void drawAtmosphere();
00847
00848 void setActiveRegion();
00849
00850 void setBoundingBox();
00851
00852 private:
00853 MarbleWidgetPrivate * const d;
00854 };
00855
00856
00857 #endif // MARBLEWIDGET_H