• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • plugins
  • declarative
MarbleDeclarativeWidget.h
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2010 Dennis Nienhüser <earthwings@gentoo.org>
9 //
10 
11 #ifndef DECLARATIVE_MARBLE_WIDGET_H
12 #define DECLARATIVE_MARBLE_WIDGET_H
13 
14 #include "Coordinate.h"
15 #include "Placemark.h"
16 
17 #include "MapThemeManager.h"
18 
19 #include <QGraphicsProxyWidget>
20 #include <QList>
21 #include <QPoint>
22 #include <QStandardItemModel>
23 #if QT_VERSION < 0x050000
24  #include <QtDeclarative/qdeclarative.h>
25 #else
26  #include <QtQml/qqml.h>
27 #endif
28 
29 using Marble::GeoDataCoordinates; // Ouch. For signal/slot connection across different namespaces
30 
31 namespace Marble
32 {
33 // Forward declarations
34 class AbstractFloatItem;
35 class MarbleModel;
36 class MarbleWidget;
37 class RenderPlugin;
38 class ViewportParams;
39 }
40 
41 class DeclarativeDataPlugin;
42 class ZoomButtonInterceptor;
50 class MarbleWidget : public QGraphicsProxyWidget
51 {
52  Q_OBJECT
53 
54  Q_PROPERTY( Coordinate* center READ center WRITE setCenter NOTIFY visibleLatLonAltBoxChanged )
55  Q_PROPERTY( int radius READ radius WRITE setRadius NOTIFY radiusChanged )
56  Q_PROPERTY( QString mapThemeId READ mapThemeId WRITE setMapThemeId NOTIFY mapThemeChanged )
57  Q_PROPERTY( QString projection READ projection WRITE setProjection NOTIFY projectionChanged )
58  Q_PROPERTY( bool inputEnabled READ inputEnabled WRITE setInputEnabled )
59  Q_PROPERTY( bool workOffline READ workOffline WRITE setWorkOffline NOTIFY workOfflineChanged )
60  Q_PROPERTY( QStringList activeFloatItems READ activeFloatItems WRITE setActiveFloatItems )
61  Q_PROPERTY( QStringList activeRenderPlugins READ activeRenderPlugins WRITE setActiveRenderPlugins )
62  Q_PROPERTY( QStandardItemModel* mapThemeModel READ mapThemeModel NOTIFY mapThemeModelChanged )
63  Q_PROPERTY( QList<QObject*> renderPlugins READ renderPlugins CONSTANT )
64  Q_PROPERTY( QList<QObject*> floatItems READ floatItems CONSTANT )
65 
66 #if QT_VERSION < 0x050000
67  Q_PROPERTY( QDeclarativeListProperty<DeclarativeDataPlugin> dataLayers READ dataLayers )
68  Q_PROPERTY( QDeclarativeListProperty<QObject> children READ childList )
69 #else
70  Q_PROPERTY( QQmlListProperty<DeclarativeDataPlugin> dataLayers READ dataLayers )
71  Q_PROPERTY( QQmlListProperty<QObject> children READ childList )
72 #endif
73 
74  Q_CLASSINFO("DefaultProperty", "children")
75 
76 public:
78  explicit MarbleWidget( QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0 );
79 
80  ~MarbleWidget();
81 
82  Marble::MarbleModel *model();
83 
84  const Marble::ViewportParams *viewport() const;
85 
86  bool workOffline() const;
87 
88  void setWorkOffline( bool workOffline );
89 
90  int radius() const;
91 
92  void setRadius( int radius );
93 
94  void setActiveRenderPlugins( const QStringList &items );
95 
96  QStringList activeRenderPlugins() const;
97 
98 #if QT_VERSION < 0x050000
99  QDeclarativeListProperty<QObject> childList();
100 
101  QDeclarativeListProperty<DeclarativeDataPlugin> dataLayers();
102 #else
103  QQmlListProperty<QObject> childList();
104 
105  QQmlListProperty<DeclarativeDataPlugin> dataLayers();
106 #endif
107 
108 Q_SIGNALS:
110  void visibleLatLonAltBoxChanged();
111 
112  void workOfflineChanged();
113 
114  void radiusChanged();
115 
116  void mouseClickGeoPosition( qreal longitude, qreal latitude );
117 
118  void mapThemeModelChanged();
119 
120  void mapThemeChanged();
121 
122  void placemarkSelected( Placemark* placemark );
123 
124  void projectionChanged();
125 
126 public Q_SLOTS:
127  Coordinate* center();
128 
129  void setCenter( Coordinate* center );
130 
131  void centerOn( const Marble::GeoDataLatLonBox &bbox );
132 
133  void centerOn( const GeoDataCoordinates &coordinates );
134 
135  QList<QObject*> renderPlugins() const;
136 
137  Marble::RenderPlugin* renderPlugin( const QString & name );
138 
139  bool containsRenderPlugin( const QString & name );
140 
141  QList<QObject*> floatItems() const;
142 
143  Marble::AbstractFloatItem* floatItem( const QString & name );
144 
145  bool containsFloatItem( const QString & name );
146 
148  QStringList activeFloatItems() const;
149 
151  void setActiveFloatItems( const QStringList &items );
152 
154  bool inputEnabled() const;
155 
157  void setInputEnabled( bool enabled );
158 
163  QString mapThemeId() const;
164 
170  void setMapThemeId( const QString &mapThemeId );
171 
176  QString projection( ) const;
177 
182  void setProjection( const QString &projection );
183 
185  void zoomIn();
186 
188  void zoomOut();
189 
194  QPoint pixel( qreal longitude, qreal latitude ) const;
195 
199  Coordinate *coordinate( int x, int y );
200 
201  QStandardItemModel* mapThemeModel();
202 
203  void setGeoSceneProperty( const QString &key, bool value );
204 
205  void downloadRoute( qreal offset, int topTileLevel, int bottomTileLevel );
206 
207  void downloadArea( int topTileLevel, int bottomTileLevel );
208 
209 #if QT_VERSION < 0x050000
210  void setDataPluginDelegate( const QString &plugin, QDeclarativeComponent* delegate );
211 #else
212  void setDataPluginDelegate( const QString &plugin, QQmlComponent* delegate );
213 #endif
214 
215 protected:
216  virtual bool event ( QEvent * event );
217 
218  virtual bool sceneEvent ( QEvent * event );
219 
220 private Q_SLOTS:
221  void updateCenterPosition();
222 
223  void forwardMouseClick( qreal lon, qreal lat, GeoDataCoordinates::Unit );
224 
225 private:
226 #if QT_VERSION < 0x050000
227  static void addLayer( QDeclarativeListProperty<DeclarativeDataPlugin> *list, DeclarativeDataPlugin *layer );
228 #else
229  static void addLayer( QQmlListProperty<DeclarativeDataPlugin> *list, DeclarativeDataPlugin *layer );
230 #endif
231 
233  Marble::MarbleWidget *const m_marbleWidget;
234 
235  Marble::MapThemeManager m_mapThemeManager;
236 
237  bool m_inputEnabled;
238 
239  Coordinate m_center;
240 
241  ZoomButtonInterceptor *const m_interceptor;
242 
243  QList<DeclarativeDataPlugin*> m_dataLayers;
244 
245  QList<QObject*> m_children;
246 };
247 
248 #endif
MarbleWidget::radius
int radius() const
QEvent
QStandardItemModel
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
QGraphicsItem::x
qreal x() const
QGraphicsItem::y
qreal y() const
ZoomButtonInterceptor
Definition: ZoomButtonInterceptor.h:20
MarbleWidget::zoomOut
void zoomOut()
Zoom out by a fixed amount.
Definition: MarbleDeclarativeWidget.cpp:219
MarbleWidget::mapThemeId
QString mapThemeId() const
Returns the currently active map theme id, if any, in the form of e.g.
MarbleWidget::setDataPluginDelegate
void setDataPluginDelegate(const QString &plugin, QDeclarativeComponent *delegate)
Definition: MarbleDeclarativeWidget.cpp:344
MarbleWidget::downloadRoute
void downloadRoute(qreal offset, int topTileLevel, int bottomTileLevel)
Definition: MarbleDeclarativeWidget.cpp:319
MarbleWidget::setActiveRenderPlugins
void setActiveRenderPlugins(const QStringList &items)
Definition: MarbleDeclarativeWidget.cpp:159
MarbleWidget::dataLayers
QDeclarativeListProperty< DeclarativeDataPlugin > dataLayers()
MarbleWidget::workOfflineChanged
void workOfflineChanged()
MarbleWidget::viewport
const Marble::ViewportParams * viewport() const
Definition: MarbleDeclarativeWidget.cpp:91
QObject::children
const QObjectList & children() const
QGraphicsObject::enabled
enabled
QGraphicsProxyWidget
MarbleWidget::pixel
QPoint pixel(qreal longitude, qreal latitude) const
Returns the screen position of the given coordinate (can be out of the screen borders) ...
Definition: MarbleDeclarativeWidget.cpp:224
MarbleWidget::mapThemeModel
QStandardItemModel * mapThemeModel()
MarbleWidget::workOffline
bool workOffline() const
QGraphicsItem
QPoint
MarbleWidget::centerOn
void centerOn(const Marble::GeoDataLatLonBox &bbox)
Definition: MarbleDeclarativeWidget.cpp:262
MarbleWidget::activeFloatItems
QStringList activeFloatItems() const
Returns a list of active (!) float items.
MarbleWidget::setProjection
void setProjection(const QString &projection)
Change the active projection.
Definition: MarbleDeclarativeWidget.cpp:203
MarbleWidget::projection
QString projection() const
Returns the active projection which can be either "Equirectangular", "Mercator" or "Spherical"...
MarbleWidget::inputEnabled
bool inputEnabled() const
Returns true if the map accepts keyboard/mouse input.
Coordinate
Represents a coordinate with the properties of a name and coordinates.
Definition: Coordinate.h:28
Marble::MarbleWidget
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:104
MarbleWidget::renderPlugin
Marble::RenderPlugin * renderPlugin(const QString &name)
Definition: MarbleDeclarativeWidget.cpp:394
QObject::name
const char * name() const
MarbleWidget::setGeoSceneProperty
void setGeoSceneProperty(const QString &key, bool value)
Definition: MarbleDeclarativeWidget.cpp:314
MarbleWidget::floatItem
Marble::AbstractFloatItem * floatItem(const QString &name)
Definition: MarbleDeclarativeWidget.cpp:426
MarbleWidget::visibleLatLonAltBoxChanged
void visibleLatLonAltBoxChanged()
Forwarded from MarbleWidget.
MarbleWidget::mouseClickGeoPosition
void mouseClickGeoPosition(qreal longitude, qreal latitude)
QObject
Marble::AbstractFloatItem
The abstract class for float item plugins.
Definition: AbstractFloatItem.h:45
MarbleWidget::radiusChanged
void radiusChanged()
MarbleWidget::mapThemeModelChanged
void mapThemeModelChanged()
MarbleWidget::coordinate
Coordinate * coordinate(int x, int y)
Returns the coordinate at the given screen position.
Definition: MarbleDeclarativeWidget.cpp:234
MarbleWidget::containsRenderPlugin
bool containsRenderPlugin(const QString &name)
Definition: MarbleDeclarativeWidget.cpp:405
DeclarativeDataPlugin
Definition: DeclarativeDataPlugin.h:25
QString
QList
QGraphicsItem::flags
GraphicsItemFlags flags() const
MarbleWidget::zoomIn
void zoomIn()
Zoom in by a fixed amount.
Definition: MarbleDeclarativeWidget.cpp:214
QStringList
MarbleWidget::event
virtual bool event(QEvent *event)
Definition: MarbleDeclarativeWidget.cpp:375
QDeclarativeComponent
MarbleWidget::setRadius
void setRadius(int radius)
Definition: MarbleDeclarativeWidget.cpp:370
MarbleWidget::projectionChanged
void projectionChanged()
MarbleWidget::childList
QDeclarativeListProperty< QObject > childList()
Definition: MarbleDeclarativeWidget.cpp:137
MarbleWidget::placemarkSelected
void placemarkSelected(Placemark *placemark)
MarbleWidget::setInputEnabled
void setInputEnabled(bool enabled)
Toggle keyboard/mouse input.
Definition: MarbleDeclarativeWidget.cpp:172
MarbleWidget::sceneEvent
virtual bool sceneEvent(QEvent *event)
Definition: MarbleDeclarativeWidget.cpp:384
MarbleWidget::setCenter
void setCenter(Coordinate *center)
Definition: MarbleDeclarativeWidget.cpp:250
Marble::MapThemeManager
The class that handles map themes that are locally available .
Definition: MapThemeManager.h:48
Placemark.h
MarbleWidget::center
Coordinate * center()
Coordinate.h
MarbleWidget::downloadArea
void downloadArea(int topTileLevel, int bottomTileLevel)
Definition: MarbleDeclarativeWidget.cpp:332
MarbleWidget::setMapThemeId
void setMapThemeId(const QString &mapThemeId)
Change the currently active map theme id.
Definition: MarbleDeclarativeWidget.cpp:183
MarbleWidget::floatItems
QList< QObject * > floatItems() const
Placemark
Wraps a GeoDataPlacemark for QML access.
Definition: Placemark.qml:11
MarbleWidget
Wraps a Marble::MarbleWidget, providing access to important properties and methods.
Definition: MarbleDeclarativeWidget.h:50
MarbleWidget::setWorkOffline
void setWorkOffline(bool workOffline)
Definition: MarbleDeclarativeWidget.cpp:360
MarbleWidget::model
Marble::MarbleModel * model()
Definition: MarbleDeclarativeWidget.cpp:86
QObject::parent
QObject * parent() const
MarbleWidget::mapThemeChanged
void mapThemeChanged()
QDeclarativeListProperty
Marble::RenderPlugin
The abstract class that creates a renderable item.
Definition: RenderPlugin.h:43
MarbleWidget::activeRenderPlugins
QStringList activeRenderPlugins() const
MarbleWidget::renderPlugins
QList< QObject * > renderPlugins() const
MapThemeManager.h
MarbleWidget::setActiveFloatItems
void setActiveFloatItems(const QStringList &items)
Activates all of the given float items and deactivates any others.
Definition: MarbleDeclarativeWidget.cpp:117
Marble::GeoDataLatLonBox
A class that defines a 2D bounding box for geographic data.
Definition: GeoDataLatLonBox.h:51
MarbleWidget::containsFloatItem
bool containsFloatItem(const QString &name)
Definition: MarbleDeclarativeWidget.cpp:437
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal