VR-Forces 4.1 Class Documentation
viewDriver.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2001 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: viewDriver.h,v $ $Revision: 1.58 $ $State: Exp $
7 *******************************************************************************/
8 
11 
12 #ifndef VIEWDRIVER_H
13 #define VIEWDRIVER_H
14 
15 #include "symbolMapper/modelKey.h"
16 #include "symbolMapper/modelData.h"
19 
20 #include <QtCore/QObject>
21 
22 class DtTMArea;
23 class DtTMFactory;
24 class DtBaseSymbolMapper;
25 class DtSymbol;
26 class DtSymbolList;
27 class DtTMSymbolUpdater;
28 
30 class DtViewportExtents;
31 
32 class DtTMDisplayOptions;
33 
40 #include "tmqt/tmqtDefines.h"
42 {
43  Q_OBJECT
44 
45 public:
46  typedef QHash<QString, QVector<DtSymbol*> > DtViewDriverMappedSymbol;
47 
48  //Constructor
49  DtViewDriver();
50 
51  //Destructor
52  virtual ~DtViewDriver();
53 
55  DtViewDriver(const DtViewDriver& orig);
56 
58  virtual DtViewDriver& operator=(const DtViewDriver& orig);
59 
60  virtual void init(const DtTMFactory* f, DtTMArea* area);
61 
62  //Check if this symbol is in the database
63  virtual bool symbolExists(const DtModelKey& symbol) const;
64 
65  //Returns the symbol using a key. If it doesn't
66  //exists, return null;
67  virtual DtSymbol* getSymbol(const DtModelKey& symbol) const;
68 
69  //Symbol Updater resets the symbol locations
70  virtual void setSymbolUpdater(DtTMSymbolUpdater* updater);
71 
72  //Symbol Updater resets the symbol locations
73  virtual DtTMSymbolUpdater* getSymbolUpdater();
74 
75  //Symbol mapper creates new Symbols out of keys
76  virtual void setSymbolMapper(DtBaseSymbolMapper* mapper);
77 
78  //Symbol mapper creates new Symbols out of keys
79  virtual DtBaseSymbolMapper* getSymbolMapper();
80 
81  //Contains information on the database/window conversion
82  virtual const DtTMViewportExtents* getViewportExtents();
83 
84  //Pass the symbol list aroind
85  virtual DtSymbolList* getSymbolList();
86 
88  virtual const DtModelKey* getModelKey(DtSymbol* s) const;
89 
90  //The viewport extents alternate between screen and db coordinates
91  virtual void setViewportExtents(DtTMViewportExtents* ve);
92 
93  virtual void setPersistentModelData(const QStringList* s);
94 
96  virtual DtSymbol* createSymbol(const DtModelData& data);
97 
99  virtual void clear();
100 
102  virtual DtTMArea* area();
103 
106  virtual void getVisibleModelData(DtModelDataDict& iter);
107 
110  virtual void setHideOffScreenSymbols(bool);
111  virtual bool hideOffScreenSymbols() const;
112 
113  bool hasTerrainLoaded() const;
114  void setHasTerrainLoaded(bool);
115 
118  void addAllowedCreationType(DtModelDataType);
119  void removeAllowedCreationType(DtModelDataType);
120  bool allowCreationOf(DtModelDataType) const;
121  const QVector<DtModelDataType>& allowedCreationTypes() const;
122  void allowAllCreationTypes();
123 
124 public:
125 
127  static DtViewDriver* create();
128 
129 signals:
130  //Sent whenever the window is resized or moved or whatever
131  //changes the display area
132  void viewModified();
133 
135  void symbolRemoved(const DtModelKey& key);
136 
138  void symbolAboutToBeRemoved(const DtModelKey& key);
139 
141  void symbolAdded(const DtModelKey& key);
142  void symbolAdded(DtSymbol* symbol, const DtModelKey& key);
143 
144 public slots:
145 
146  virtual DtSymbol* addSymbol(const DtModelData& data, bool force = false);
147  virtual DtSymbol* addSymbol(const DtModelData& data, DtSymbol* symbol);
148 
149  virtual void removeSymbol(const DtModelData& data, bool force = false, bool keepSymbolSettings = true);
150  virtual void removeSymbol(const DtModelKey& key, bool force = false, bool keepSymbolSettings = true);
151  virtual void removeSymbolFromModelData(const DtModelKey& key);
152 
153  virtual void modifySymbol(const DtModelData& data);
154 
155  //virtual void removeSymbol(const DtModelKey& modelKey);
156 
157  virtual bool updateAllSymbols(DtModelDataIter* ModelDataIter);
158 
161  virtual bool updateAllSymbols();
162 
163  virtual void setDisplayOptions(const DtTMDisplayOptions* o);
164  virtual void updateDisplayOptions();
165 
167  virtual void removeSymbol(const DtSymbol* s);
168 
169 protected:
170 
171  virtual DtSymbol* internalAddSymbol(const DtModelData& data, bool force = false);
172  virtual DtSymbol* internalRemoveSymbol(const DtModelData& data, bool force = false, bool keepSymbolSettings = true);
173  virtual DtSymbol* internalRemoveSymbol(const DtModelKey& key, bool force = false, bool keepSymbolSettings = true);
174 
175  virtual DtSymbol* internalModifySymbol(const DtModelData& data);
176 
177  virtual bool checkDBOverlap(const DtModelData& data) const;
178 
179 protected:
180 
181  QHash<DtModelKey, DtSymbol*> myKeyToSymbolDict;
182  QHash<DtModelKey, DtSymbolDisplayOptions*> myKeyToDisplayOptionsDict;
183  QHash<DtSymbol*, DtModelKey> mySymbolToKeyDict;
184 
185  //The following items are passed into this class
186  //Thus they are not owned or deleted, but the class
187  //should be destroyed before these items are
188  const QStringList* myPersistentModelData;
194 
196 
199 
200  QVector<DtModelDataType> myAllowedCreationTypes;
201 };
202 
204 {
205  return myHasTerrainLoaded;
206 }
207 
209 {
210  myHasTerrainLoaded = b;
211 }
212 
214 {
215  if (myAllowedCreationTypes.indexOf(t) == -1)
216  {
217  myAllowedCreationTypes.push_back(t);
218  }
219 }
220 
222 {
223  int iIndex = myAllowedCreationTypes.indexOf(t);
224 
225  if (iIndex != -1)
226  {
227  myAllowedCreationTypes.remove(iIndex);
228  }
229 }
230 
231 inline const QVector<DtModelDataType>& DtViewDriver::allowedCreationTypes() const
232 {
233  return myAllowedCreationTypes;
234 }
235 
237 {
238  myAllowedCreationTypes.clear();
239 }
240 
242 {
243  if (myAllowedCreationTypes.count() && (myAllowedCreationTypes.indexOf(t) == -1))
244  {
245  return false;
246  }
247 
248  return true;
249 }
250 
251 #endif //VIEWDRIVER_H

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)