• 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
  • render
  • annotate
AnnotatePlugin.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 2009 Andrew Manson <g.real.ate@gmail.com>
9 // Copyright 2013 Thibaut Gridel <tgridel@free.fr>
10 // Copyright 2014 Calin-Cristian Cruceru <crucerucalincristian@gmail.com>
11 //
12 
13 
14 #ifndef MARBLE_ANNOTATEPLUGIN_H
15 #define MARBLE_ANNOTATEPLUGIN_H
16 
17 #include "RenderPlugin.h"
18 #include "SceneGraphicsItem.h"
19 #include "GeoDataLatLonBox.h"
20 #include "GeoDataGroundOverlay.h"
21 #include "GeoDataPolygon.h"
22 #include "GroundOverlayFrame.h"
23 #include "AreaAnnotation.h"
24 
25 #include <QObject>
26 #include <QErrorMessage>
27 #include <QMenu>
28 #include <QSortFilterProxyModel>
29 
30 
31 class QNetworkAccessManager;
32 class QNetworkReply;
33 
34 namespace Marble
35 {
36 
37 class MarbleWidget;
38 class TextureLayer;
39 class PlacemarkTextAnnotation;
40 class GeoDataDocument;
41 class GeoDataLinearRing;
42 class GeoDataLineString;
43 
44 
49 class AnnotatePlugin : public RenderPlugin
50 {
51  Q_OBJECT
52  Q_PLUGIN_METADATA( IID "org.kde.edu.marble.AnnotatePlugin" )
53  Q_INTERFACES( Marble::RenderPluginInterface )
54  MARBLE_PLUGIN( AnnotatePlugin )
55 
56 public:
57  explicit AnnotatePlugin(const MarbleModel *model = 0);
58  virtual ~AnnotatePlugin();
59 
60  QStringList backendTypes() const;
61 
62  QString renderPolicy() const;
63 
64  QStringList renderPosition() const;
65 
66  QString name() const;
67 
68  QString guiString() const;
69 
70  QString nameId() const;
71 
72  QString version() const;
73 
74  QString description() const;
75 
76  QIcon icon () const;
77 
78  QString copyrightYears() const;
79 
80  QList<PluginAuthor> pluginAuthors() const;
81 
82  void initialize ();
83 
84  bool isInitialized () const;
85 
86  virtual QString runtimeTrace() const;
87 
88  virtual const QList<QActionGroup*> *actionGroups() const;
89  virtual const QList<QActionGroup*> *toolbarActionGroups() const;
90 
91  bool render( GeoPainter *painter, ViewportParams *viewport,
92  const QString &renderPos, GeoSceneLayer *layer = 0 );
93 
94 signals:
95  void placemarkAdded();
96  void overlayAdded();
97  void itemRemoved();
98 
99 public slots:
100  void enableModel( bool enabled );
101 
102  void setAddingPlacemark( bool );
103  void setDrawingPolygon( bool );
104  void setAddingPolygonHole( bool );
105  void setMergingNodes( bool );
106  void setAddingOverlay( bool );
107  void setRemovingItems( bool );
108 
109  void addOverlay();
110 
111  // void receiveNetworkReply( QNetworkReply* );
112  // void downloadOsmFile();
113 
114  void clearAnnotations();
115  void saveAnnotationFile();
116  void loadAnnotationFile();
117 
118 
119 private slots:
120  void editOverlay();
121  void removeOverlay();
122  void updateOverlayFrame( GeoDataGroundOverlay *overlay );
123 
124  void editPolygon();
125  void removePolygon();
126  void selectNode();
127  void deleteNode();
128  void unselectNodes();
129  void deleteSelectedNodes();
130 
131 
132 protected:
133  bool eventFilter( QObject *watched, QEvent *event );
134 
135 private:
136  void setupActions( MarbleWidget *marbleWidget );
137 
138  void setupGroundOverlayModel();
139  void setupOverlayRmbMenu();
140  void showOverlayRmbMenu( GeoDataGroundOverlay *overlay, qreal x, qreal y );
141  void displayOverlayEditDialog( GeoDataGroundOverlay *overlay );
142  void displayPolygonEditDialog( GeoDataPlacemark *placemark );
143  void displayOverlayFrame( GeoDataGroundOverlay *overlay );
144  void clearOverlayFrames();
145 
146  void setupPolygonRmbMenu();
147  void setupNodeRmbMenu();
148  void showPolygonRmbMenu( AreaAnnotation *selectedArea, qreal x, qreal y );
149  void showNodeRmbMenu( AreaAnnotation *area, qreal x, qreal y );
150 
151 
152  void handleUncaughtEvents( QMouseEvent *mouseEvent );
153  void handleReleaseOverlay( QMouseEvent *mouseEvent );
154 
155  bool handleAddingPlacemark( QMouseEvent *mouseEvent );
156  bool handleAddingPolygon( QMouseEvent *mouseEvent );
157  bool handleMovingSelectedItem( QMouseEvent *mouseEvent );
158 
159  bool handleMousePressEvent( QMouseEvent *mouseEvent, SceneGraphicsItem *item );
160  bool handleMouseReleaseEvent( QMouseEvent *mouseEvent, SceneGraphicsItem *item );
161 
162  bool handleRemovingItem( QMouseEvent *mouseEvent, SceneGraphicsItem *item );
163  bool handleAddingHole( QMouseEvent *mouseEvent, SceneGraphicsItem *item );
164  bool handleMergingNodes( QMouseEvent *mouseEvent, SceneGraphicsItem *item );
165  bool handleShowingRmbMenus( QMouseEvent *mouseEvent, SceneGraphicsItem *item );
166 
167 
168  // void readOsmFile( QIODevice* device, bool flyToFile );
169 
170  bool m_widgetInitialized;
171  MarbleWidget *m_marbleWidget;
172 
173  QMenu *m_overlayRmbMenu;
174  QMenu *m_polygonRmbMenu;
175  QMenu *m_nodeRmbMenu;
176 
177  QList<QActionGroup*> m_actions;
178  QList<QActionGroup*> m_toolbarActions;
179  QSortFilterProxyModel m_groundOverlayModel;
180  QMap<GeoDataGroundOverlay*, SceneGraphicsItem*> m_groundOverlayFrames;
181 
182  GeoDataDocument* m_annotationDocument;
183  QList<SceneGraphicsItem*> m_graphicsItems;
184 
185  GeoDataPlacemark *m_polygonPlacemark;
186  SceneGraphicsItem *m_movedItem;
187  GeoDataGroundOverlay *m_rmbOverlay;
188  AreaAnnotation *m_rmbSelectedArea;
189  GeoDataPolygon *m_holedPolygon;
190 
191  AreaAnnotation *m_mergedArea;
192  int m_mergedNodeIndex;
193 
194  // QNetworkAccessManager* m_networkAccessManager;
195  // QErrorMessage m_errorMessage;
196 
197  bool m_addingPlacemark;
198  bool m_drawingPolygon;
199  bool m_addingPolygonHole;
200  bool m_mergingNodes;
201  bool m_addingOverlay;
202  bool m_removingItem;
203  bool m_isInitialized;
204 };
205 
206 
207 }
208 
209 #endif // MARBLE_ANNOTATEPLUGIN_H
Marble::AnnotatePlugin::name
QString name() const
Returns the user-visible name of the plugin.
Definition: AnnotatePlugin.cpp:116
Marble::AnnotatePlugin::overlayAdded
void overlayAdded()
Marble::AnnotatePlugin::~AnnotatePlugin
virtual ~AnnotatePlugin()
Definition: AnnotatePlugin.cpp:91
Marble::AnnotatePlugin::itemRemoved
void itemRemoved()
QEvent
Marble::RenderPluginInterface
The class that specifies the Marble layer interface of a plugin.
Definition: RenderPluginInterface.h:30
Marble::GeoDataDocument
A container for Features, Styles and in the future Schemas.
Definition: GeoDataDocument.h:65
Marble::AnnotatePlugin::isInitialized
bool isInitialized() const
Definition: AnnotatePlugin.cpp:177
GroundOverlayFrame.h
GeoDataGroundOverlay.h
Marble::AnnotatePlugin::nameId
QString nameId() const
Returns the unique name of the plugin.
Definition: AnnotatePlugin.cpp:126
GeoDataPolygon.h
Marble::GeoPainter
A painter that allows to draw geometric primitives on the map.
Definition: GeoPainter.h:98
Marble::AnnotatePlugin::pluginAuthors
QList< PluginAuthor > pluginAuthors() const
Definition: AnnotatePlugin.cpp:146
QNetworkReply
QMap
Marble::AnnotatePlugin::setAddingOverlay
void setAddingOverlay(bool)
Definition: AnnotatePlugin.cpp:273
Marble::AnnotatePlugin::loadAnnotationFile
void loadAnnotationFile()
Definition: AnnotatePlugin.cpp:417
QMouseEvent
AreaAnnotation.h
Marble::MarbleWidget
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:104
QObject::event
virtual bool event(QEvent *e)
Marble::AnnotatePlugin::actionGroups
virtual const QList< QActionGroup * > * actionGroups() const
Getting all actions.
Definition: AnnotatePlugin.cpp:187
Marble::AnnotatePlugin::placemarkAdded
void placemarkAdded()
Marble::AnnotatePlugin::setRemovingItems
void setRemovingItems(bool)
Definition: AnnotatePlugin.cpp:289
Marble::AnnotatePlugin
This class specifies the Marble layer interface of a plugin which annotates maps with polygons and pl...
Definition: AnnotatePlugin.h:49
Marble::GeoSceneLayer
Layer of a GeoScene document.
Definition: GeoSceneLayer.h:43
QObject
Marble::AnnotatePlugin::setDrawingPolygon
void setDrawingPolygon(bool)
Definition: AnnotatePlugin.cpp:230
Marble::AreaAnnotation
Definition: AreaAnnotation.h:24
Marble::SceneGraphicsItem
This is the base class for all scene graphics included within the annotate plugin.
Definition: SceneGraphicsItem.h:34
Marble::GeoDataPolygon
A polygon that can have "holes".
Definition: GeoDataPolygon.h:81
Marble::AnnotatePlugin::eventFilter
bool eventFilter(QObject *watched, QEvent *event)
Definition: AnnotatePlugin.cpp:468
Marble::AnnotatePlugin::render
bool render(GeoPainter *painter, ViewportParams *viewport, const QString &renderPos, GeoSceneLayer *layer=0)
Renders the content provided by the layer on the viewport.
Definition: AnnotatePlugin.cpp:197
QString
QList
Marble::AnnotatePlugin::renderPolicy
QString renderPolicy() const
Return how the plugin settings should be used.
Definition: AnnotatePlugin.cpp:106
Marble::AnnotatePlugin::renderPosition
QStringList renderPosition() const
Preferred level in the layer stack for the rendering.
Definition: AnnotatePlugin.cpp:111
QStringList
Marble::ViewportParams
A public class that controls what is visible in the viewport of a Marble map.
Definition: ViewportParams.h:44
Marble::AnnotatePlugin::clearAnnotations
void clearAnnotations()
Definition: AnnotatePlugin.cpp:378
SceneGraphicsItem.h
Marble::AnnotatePlugin::copyrightYears
QString copyrightYears() const
Definition: AnnotatePlugin.cpp:141
QMenu
QSortFilterProxyModel
Marble::AnnotatePlugin::description
QString description() const
Returns a user description of the plugin.
Definition: AnnotatePlugin.cpp:131
Marble::AnnotatePlugin::setAddingPlacemark
void setAddingPlacemark(bool)
Definition: AnnotatePlugin.cpp:225
GeoDataLatLonBox.h
Marble::AnnotatePlugin::initialize
void initialize()
Definition: AnnotatePlugin.cpp:159
Marble::AnnotatePlugin::addOverlay
void addOverlay()
Definition: AnnotatePlugin.cpp:294
Marble::MarbleModel
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition: MarbleModel.h:97
QNetworkAccessManager
Marble::AnnotatePlugin::backendTypes
QStringList backendTypes() const
Returns the name(s) of the backend that the plugin can render This method should return the name of t...
Definition: AnnotatePlugin.cpp:101
RenderPlugin.h
Marble::AnnotatePlugin::setAddingPolygonHole
void setAddingPolygonHole(bool)
Definition: AnnotatePlugin.cpp:259
Marble::AnnotatePlugin::toolbarActionGroups
virtual const QList< QActionGroup * > * toolbarActionGroups() const
Getting all actions which should be placed in the toolbar.
Definition: AnnotatePlugin.cpp:192
Marble::AnnotatePlugin::enableModel
void enableModel(bool enabled)
Definition: AnnotatePlugin.cpp:210
Marble::AnnotatePlugin::setMergingNodes
void setMergingNodes(bool)
Definition: AnnotatePlugin.cpp:278
Marble::AnnotatePlugin::icon
QIcon icon() const
Returns an icon for the plugin.
Definition: AnnotatePlugin.cpp:153
Marble::AnnotatePlugin::saveAnnotationFile
void saveAnnotationFile()
Definition: AnnotatePlugin.cpp:400
Marble::GeoDataGroundOverlay
Definition: GeoDataGroundOverlay.h:24
Marble::AnnotatePlugin::AnnotatePlugin
AnnotatePlugin(const MarbleModel *model=0)
Definition: AnnotatePlugin.cpp:56
Marble::RenderPlugin::enabled
bool enabled() const
is enabled
MarbleWidget
Wraps a Marble::MarbleWidget, providing access to important properties and methods.
Definition: MarbleDeclarativeWidget.h:50
Marble::AnnotatePlugin::runtimeTrace
virtual QString runtimeTrace() const
Returns a debug line for perfo/tracing issues.
Definition: AnnotatePlugin.cpp:182
Marble::AnnotatePlugin::version
QString version() const
Definition: AnnotatePlugin.cpp:136
Marble::GeoDataPlacemark
a class representing a point of interest on the map
Definition: GeoDataPlacemark.h:54
Marble::RenderPlugin
The abstract class that creates a renderable item.
Definition: RenderPlugin.h:43
QIcon
Marble::AnnotatePlugin::guiString
QString guiString() const
String that should be displayed in GUI.
Definition: AnnotatePlugin.cpp:121
MARBLE_PLUGIN
#define MARBLE_PLUGIN(T)
Definition: RenderPlugin.h:340
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:38 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