File: GoogleMapsView.h

package info (click to toggle)
tulip 4.8.0dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 179,264 kB
  • ctags: 64,517
  • sloc: cpp: 600,444; ansic: 36,311; makefile: 22,136; python: 1,304; sh: 946; yacc: 522; xml: 337; pascal: 157; php: 66; lex: 55
file content (189 lines) | stat: -rw-r--r-- 4,430 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/**
 *
 * This file is part of Tulip (www.tulip-software.org)
 *
 * Authors: David Auber and the Tulip development Team
 * from LaBRI, University of Bordeaux
 *
 * Tulip is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 *
 * Tulip is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 */

#ifndef GOOGLEMAPSVIEW_H_
#define GOOGLEMAPSVIEW_H_

#include <tulip/OcclusionTest.h>
#include <tulip/SceneConfigWidget.h>
#include <tulip/SceneLayersConfigWidget.h>
#include <tulip/Interactor.h>
#include <tulip/View.h>

#include <QGraphicsScene>
#include <QResizeEvent>
#include <QGraphicsItem>
#include <QDialog>
#include <QThread>

#include <map>

#include "GoogleMapsViewConfigWidget.h"
#include "GeolocalisationConfigWidget.h"
#include "GoogleMaps.h"
#include "GoogleMapsGraphicsView.h"

#include "../../utils/ViewNames.h"

namespace tlp {

/*@{*/
/** \file
 *  \brief  Tulip Geographic View

 * This view plugin allows to visualize a geolocated Tulip graph on top of Google Maps.
 * If geographic properties are attached to graph nodes (address or latitude/longitude), this
 * plugin uses them to layout the nodes on the map.
 *
 * An interactor for performing selection on graph elements is also bundled
 * with the view.
 *
 *
 */
class GoogleMapsView : public View {

  Q_OBJECT

  PLUGININFORMATION(ViewName::GoogleMapsViewName, "Antoine Lambert and Morgan Mathiaut", "06/2012",
                    "<p>The Geographic view allows to visualize a geolocated Tulip graph on top of Google Maps.</p>"
                    "<p>If geographic properties are attached to graph nodes (address or latitude/longitude), they are used to layout the nodes on the map.</p>"
                    "<p>An interactor for performing selection on graph elements is also bundled with the view.</p>", "2.1","View")

public :

  enum ViewType {
    GoogleRoadMap=0,
    GoogleSatellite,
    GoogleTerrain,
    GoogleHybrid,
    Polygon,
    Globe
  };

  GoogleMapsView(PluginContext *);
  ~GoogleMapsView();

  std::string icon() const {
    return ":/geographic_view.png";
  }

  void setupUi();

  QPixmap snapshot(const QSize&) const;

  void setState(const DataSet &dataSet);
  DataSet state() const;

  QGraphicsView *graphicsView() const {
    return googleMapsGraphicsView;
  }

  QList<QWidget *> configurationWidgets() const;

  QGraphicsItem* centralItem() const;

  GoogleMaps *getGoogleMap() {
    return googleMapsGraphicsView->getGoogleMapsPage();
  }

  GoogleMapsGraphicsView *getGoogleMapGraphicsView() {
    return googleMapsGraphicsView;
  }

  void registerTriggers();

  ViewType viewType() {
    return _viewType;
  }

  // inherited from View
  virtual void centerView(bool) {
    // call the Qt slot declared below
    centerView();
  }

public slots :

  void computeGeoLayout();

  void draw();

  void refresh();

  void graphChanged(Graph *) {
    setState(DataSet());
  }

  void graphDeleted(tlp::Graph*) {}

  void applySettings();

  void updateSharedProperties();

  void currentInteractorChanged(tlp::Interactor *i) {
    i->install(googleMapsGraphicsView->getGlMainWidget());
  }

  void mapToPolygon() {
    googleMapsGraphicsView->mapToPolygon();
  }

  void centerView();

  void viewTypeChanged(QString viewTypeName);

  void zoomIn();
  void zoomOut();
  void currentZoomChanged();

  void openSnapshotDialog();

protected slots:

  void fillContextMenu(QMenu *, const QPointF &);

private :

  void updatePoly(bool force=false);

  void loadStoredPolyInformations(const DataSet &dataset);

  void saveStoredPolyInformations(DataSet &dataset) const;

  GoogleMapsGraphicsView *googleMapsGraphicsView;
  GoogleMapsViewConfigWidget *googleMapsViewConfigWidget;
  GeolocalisationConfigWidget *geolocalisationConfigWidget;
  SceneConfigWidget* sceneConfigurationWidget;
  SceneLayersConfigWidget* sceneLayersConfigurationWidget;

  QAction *centerViewAction;
  QAction *showConfPanelAction;

  ViewType _viewType;

  bool useSharedLayoutProperty;
  bool useSharedSizeProperty;
  bool useSharedShapeProperty;

};

}


#endif /* GOOGLEMAPSVIEW_H_ */