VR-Forces 4.1.1 Class Documentation
tmMapArea.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2001 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: tmMapArea.h,v $ $Revision: 1.93 $ $State: Exp $
7 *********************************************************************/
8 
11 
12 #ifndef TMMAPAREA_H
13 #define TMMAPAREA_H
14 
15 #include "tmqt/tmArea.h"
16 #include "tmqt/symbolSelector.h"
17 #include "symbology/symbolList.h"
18 
19 #include <QtGui/QWidget>
20 #include <QtGui/QPixmap>
21 #include <QtCore/QTimer>
22 #include <QtCore/QStringList>
23 
24 class DtTMFactory;
25 class DtTMWindow;
26 class DtPoint;
27 class DtTMDisplayOptions;
28 class DtExtent;
29 class DtObjectSelector;
30 class DtFilter;
31 
37 
38 
39 #include "tmqt/tmqtDefines.h"
41 {
42  Q_OBJECT
43 
44 public:
45 
46  DtTMMapArea(QWidget * parent = 0, const Qt::WindowFlags& flags = 0);
47 
48  virtual ~DtTMMapArea();
49 
51  virtual bool init(const DtTMFactory* f);
52 
53  //Set the selection type to rectangle, point, or circle.
54  //The types themselves are defined in symbolSelector.h
55  virtual void setSelectorType(DtSymbolSelector::DtSelectorType type);
56 
57  virtual DtSymbolSelector& symbolSelector();
58  virtual DtSymbolList& selectedSymbols();
59 
63  virtual const QVector<DtModelKey>& selectedModelKeys() const;
64  virtual QVector<DtModelKey>& selectedModelKeys();
65 
66  virtual bool leftButtonClicked();
67 
68  virtual double getDatabaseHeight(double x, double y) const;
69 
71  virtual bool tick();
72 
74  virtual void setActivateMap();
75 
76  virtual void updateSelectedModelData();
77 
80  virtual void setResetLabelPositions(bool b);
81 
83  virtual void clear();
84 
85  virtual void removeFromPersistentData(const QString& key);
86 
89  virtual void applyOptions(DtSymbol* s);
90 
91  DtObjectSelector* objectSelector();
92 
93 public:
94 
96  static DtTMMapArea * create(QWidget * parent, const Qt::WindowFlags& flags);
97 
98 public:
101  virtual bool startNullSelectionMode(bool showHandCursor = false);
102 
104  virtual bool startNormalSelectionMode();
105 
106  virtual bool startSymbolPointSelectionMode(int selectionMode,
107  bool showHandCursor = false, bool reset = false, bool backup = true, bool force = false);
108 
109  virtual bool startSymbolRectangleSelectionMode(int selectionMode,
110  bool showHandCursor = false, bool reset = false, bool backup = true, bool force = false);
111 
114  virtual bool startSelectionMode(int selectionMode,
115  DtSymbolSelector::DtSelectorType type, bool showHandCursor = false,
116  bool reset = false, bool backup = true, bool force = false);
117 
118  virtual void swapModelKeys(QVector<DtModelKey>& orig, QVector<DtModelKey>& save, QVector<DtModelKey>& display);
119  virtual int symbolSelectionMode() const;
120  const DtPoint& lastSelectedPoint() const;
121 
124  virtual void removeSymbol(const DtModelData& data, bool force);
125 
127  virtual DtSymbolSelector* setCurrentSelector(DtSymbolSelector* s);
128  virtual DtSymbolSelector* currentSelector();
129 
133  virtual void setObjectSelectionMode(const DtFilter* f = NULL, bool swapKeys = false);
134 
136  virtual bool inObjectSelectionMode() const;
137 
140  virtual DtSymbol* symbolAtLocation(const DtPoint& pnt) const;
141 
143  virtual bool event(QEvent*);
144 
145 signals:
146 
147  void leftDoubleClick();
148 
149  void symbolsSelected(DtSymbolList*);
150  void selectionChanged(const QVector<DtModelKey>&);
151  void selectionUpdated(const QVector<DtModelKey>&);
152 
153  void databasePointSelected(const DtPoint&);
154 
155  void nullSelected();
156 
157  void rightMouseContext(DtSymbolList*,QPoint);
158  void middleMouseContext(DtSymbolList*,QPoint);
159 
163  void mouseSignal(QMouseEvent*,const DtPoint&);
164 
167  void keyboardSignal(QKeyEvent*);
168 
172  void focusEventSignal(QEvent*);
173  void enterEventSignal(QEvent*);
174  void leaveEventSignal(QEvent*);
175  void activateMap(DtTMMapArea*);
176  void dropEventSignal(QDropEvent*);
177  void dragEnterEventSignal(QDragEnterEvent*);
178  void dragLeaveEventSignal(QDragLeaveEvent*);
179  void dragMoveEventSignal(QDragMoveEvent*);
180 
182  void selectionInProgress(DtSymbolSelector& symbolSelector);
183 
185  void selectedModelDataUpdated();
186 
188  void aboutToDraw(QPainter* map);
189 
191  void selectionModeChanged(int iNewMode);
192 
194 
195  void frozenChanged(bool);
196 
197 public slots:
199  virtual void zoomIn();
200 
202  virtual void zoomOut();
203 
204  virtual void drawRubberBands(QPainter* p);
205 
206  virtual void clearSelection(bool signal = true);
207  virtual void changeSelection(const QVector<DtModelKey>& d);
208 
211  virtual bool addSelection(const QVector<DtModelKey>& d);
212 
215  virtual bool removeSelection(const QVector<DtModelKey>& d);
216 
217  virtual void setRightClickMaintainSelection(bool b);
218  virtual bool rightClickMaintainSelection();
219 
220  //manually forces a symbol to be persistent even if it exits
221  //the scopeof your view area
222  virtual void forcePersistentSymbol(DtSymbol* s);
223  virtual void stopForcePersistentSymbol(DtSymbol* s);
224 
225  virtual void catchViewportChange(const DtTMViewportExtents* v);
226 
229  virtual bool dragStart();
230 
233  virtual void dragComplete();
234 
238  virtual void setFreezeSelection(bool);
239  bool freezeSelection() const;
240 
241 protected:
242  virtual void setViewportExtents(const DtTMViewportExtents* v);
243  virtual void modifySymbol(const DtModelData& data);
244 
245 private:
246 
248  DtTMMapArea(const DtTMMapArea& orig);
249 
251  DtTMMapArea& operator=(const DtTMMapArea& rhs);
252 
253 protected:
254  virtual bool initViewDriver(const DtTMFactory* f);
255  virtual bool initObjectSelector(const DtTMFactory* f);
256 
257  virtual void updateSymbolSelection(Qt::KeyboardModifiers keyState, Qt::MouseButtons mouseState,
258  bool updateInternalSelection = true);
259  virtual void updateSelectedSymbols(const QVector<DtModelKey>& selectedKeys);
260  virtual void updatePersistentModelData();
261 
262  virtual void highlightNoSymbols();
263  virtual void highlightSymbols(QVector<DtModelKey>* display = NULL);
264 
266  virtual void mousePressEvent ( QMouseEvent * e );
267  virtual void mouseReleaseEvent ( QMouseEvent * e );
268  virtual void mouseMoveEvent ( QMouseEvent * e );
269  virtual void mouseDoubleClickEvent ( QMouseEvent * e );
270  virtual void keyPressEvent ( QKeyEvent * e );
271  virtual void keyReleaseEvent ( QKeyEvent * e );
272  virtual void wheelEvent ( QWheelEvent* e );
273  virtual void focusOutEvent ( QFocusEvent *e );
274  virtual void leaveEvent ( QEvent *e );
275  virtual void enterEvent ( QEvent *e );
276 
277  //Helper event functions
278  virtual void mouseSelect( QMouseEvent * e );
279  virtual void mousePressSelect( QMouseEvent * e );
280 
282 
283  virtual void dragEnterEvent( QDragEnterEvent* e);
284  virtual void dragLeaveEvent( QDragLeaveEvent* e);
285  virtual void dragMoveEvent( QDragMoveEvent* e);
286  virtual void dropEvent( QDropEvent* e);
287 
288 protected:
289 
292 
293  QVector<DtModelKey> myTemporarySelectedModelData;
294  QVector<DtModelKey> mySelectedModelKeys;
295 
298 
300 
301  QPoint myMouseBegin;
302  QPoint myMouseLast;
304 
307  Qt::MouseButtons myButtonState;
308  Qt::KeyboardModifiers myKeyState;
309 
311 
313 
315 };
316 
317 inline bool DtTMMapArea::freezeSelection() const
318 {
319  return myFreezeSelection;
320 }
321 
323 {
324  return myObjectSelector;
325 }
326 
327 #endif
328 

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)