![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2001 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: viewDriver.h,v $ $Revision: 1.58 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00011 00012 #ifndef VIEWDRIVER_H 00013 #define VIEWDRIVER_H 00014 00015 #include "symbolMapper/modelKey.h" 00016 #include "symbolMapper/modelData.h" 00017 #include "symbology/symbolDisplayOptions.h" 00018 #include "symbolMapper/modelDataDict.h" 00019 00020 #include <QtCore/QObject> 00021 00022 class DtTMArea; 00023 class DtTMFactory; 00024 class DtBaseSymbolMapper; 00025 class DtSymbol; 00026 class DtSymbolList; 00027 class DtTMSymbolUpdater; 00028 00029 class DtTMViewportExtents; 00030 class DtViewportExtents; 00031 00032 class DtTMDisplayOptions; 00033 00040 #include "tmqt/tmqtDefines.h" 00041 class DT_DLL_tmqt DtViewDriver : public QObject 00042 { 00043 Q_OBJECT 00044 00045 public: 00046 typedef QHash<QString, QVector<DtSymbol*> > DtViewDriverMappedSymbol; 00047 00048 //Constructor 00049 DtViewDriver(); 00050 00051 //Destructor 00052 virtual ~DtViewDriver(); 00053 00055 DtViewDriver(const DtViewDriver& orig); 00056 00058 virtual DtViewDriver& operator=(const DtViewDriver& orig); 00059 00060 virtual void init(const DtTMFactory* f, DtTMArea* area); 00061 00062 //Check if this symbol is in the database 00063 virtual bool symbolExists(const DtModelKey& symbol) const; 00064 00065 //Returns the symbol using a key. If it doesn't 00066 //exists, return null; 00067 virtual DtSymbol* getSymbol(const DtModelKey& symbol) const; 00068 00069 //Symbol Updater resets the symbol locations 00070 virtual void setSymbolUpdater(DtTMSymbolUpdater* updater); 00071 00072 //Symbol Updater resets the symbol locations 00073 virtual DtTMSymbolUpdater* getSymbolUpdater(); 00074 00075 //Symbol mapper creates new Symbols out of keys 00076 virtual void setSymbolMapper(DtBaseSymbolMapper* mapper); 00077 00078 //Symbol mapper creates new Symbols out of keys 00079 virtual DtBaseSymbolMapper* getSymbolMapper(); 00080 00081 //Contains information on the database/window conversion 00082 virtual const DtTMViewportExtents* getViewportExtents(); 00083 00084 //Pass the symbol list aroind 00085 virtual DtSymbolList* getSymbolList(); 00086 00088 virtual const DtModelKey* getModelKey(DtSymbol* s) const; 00089 00090 //The viewport extents alternate between screen and db coordinates 00091 virtual void setViewportExtents(DtTMViewportExtents* ve); 00092 00093 virtual void setPersistentModelData(const QStringList* s); 00094 00096 virtual DtSymbol* createSymbol(const DtModelData& data); 00097 00099 virtual void clear(); 00100 00102 virtual DtTMArea* area(); 00103 00106 virtual void getVisibleModelData(DtModelDataDict& iter); 00107 00110 virtual void setHideOffScreenSymbols(bool); 00111 virtual bool hideOffScreenSymbols() const; 00112 00113 bool hasTerrainLoaded() const; 00114 void setHasTerrainLoaded(bool); 00115 00118 void addAllowedCreationType(DtModelDataType); 00119 void removeAllowedCreationType(DtModelDataType); 00120 bool allowCreationOf(DtModelDataType) const; 00121 const QVector<DtModelDataType>& allowedCreationTypes() const; 00122 void allowAllCreationTypes(); 00123 00124 public: 00125 00127 static DtViewDriver* create(); 00128 00129 signals: 00130 //Sent whenever the window is resized or moved or whatever 00131 //changes the display area 00132 void viewModified(); 00133 00135 void symbolRemoved(const DtModelKey& key); 00136 00138 void symbolAboutToBeRemoved(const DtModelKey& key); 00139 00141 void symbolAdded(const DtModelKey& key); 00142 void symbolAdded(DtSymbol* symbol, const DtModelKey& key); 00143 00144 public slots: 00145 00146 virtual DtSymbol* addSymbol(const DtModelData& data, bool force = false); 00147 virtual DtSymbol* addSymbol(const DtModelData& data, DtSymbol* symbol); 00148 00149 virtual void removeSymbol(const DtModelData& data, bool force = false, bool keepSymbolSettings = true); 00150 virtual void removeSymbol(const DtModelKey& key, bool force = false, bool keepSymbolSettings = true); 00151 virtual void removeSymbolFromModelData(const DtModelKey& key); 00152 00153 virtual void modifySymbol(const DtModelData& data); 00154 00155 //virtual void removeSymbol(const DtModelKey& modelKey); 00156 00157 virtual bool updateAllSymbols(DtModelDataIter* ModelDataIter); 00158 00161 virtual bool updateAllSymbols(); 00162 00163 virtual void setDisplayOptions(const DtTMDisplayOptions* o); 00164 virtual void updateDisplayOptions(); 00165 00167 virtual void removeSymbol(const DtSymbol* s); 00168 00169 protected: 00170 00171 virtual DtSymbol* internalAddSymbol(const DtModelData& data, bool force = false); 00172 virtual DtSymbol* internalRemoveSymbol(const DtModelData& data, bool force = false, bool keepSymbolSettings = true); 00173 virtual DtSymbol* internalRemoveSymbol(const DtModelKey& key, bool force = false, bool keepSymbolSettings = true); 00174 00175 virtual DtSymbol* internalModifySymbol(const DtModelData& data); 00176 00177 virtual bool checkDBOverlap(const DtModelData& data) const; 00178 00179 protected: 00180 00181 QHash<DtModelKey, DtSymbol*> myKeyToSymbolDict; 00182 QHash<DtModelKey, DtSymbolDisplayOptions*> myKeyToDisplayOptionsDict; 00183 QHash<DtSymbol*, DtModelKey> mySymbolToKeyDict; 00184 00185 //The following items are passed into this class 00186 //Thus they are not owned or deleted, but the class 00187 //should be destroyed before these items are 00188 const QStringList* myPersistentModelData; 00189 DtSymbolList* mySymbolList; 00190 DtBaseSymbolMapper* mySymbolMapper; 00191 DtTMSymbolUpdater* mySymbolUpdater; 00192 DtTMViewportExtents* myViewportExtents; 00193 const DtTMDisplayOptions* myTMDisplayOptions; 00194 00195 DtTMArea* myArea; 00196 00197 bool myHideOffScreenSymbols; 00198 bool myHasTerrainLoaded; 00199 00200 QVector<DtModelDataType> myAllowedCreationTypes; 00201 }; 00202 00203 inline bool DtViewDriver::hasTerrainLoaded() const 00204 { 00205 return myHasTerrainLoaded; 00206 } 00207 00208 inline void DtViewDriver::setHasTerrainLoaded(bool b) 00209 { 00210 myHasTerrainLoaded = b; 00211 } 00212 00213 inline void DtViewDriver::addAllowedCreationType(DtModelDataType t) 00214 { 00215 if (myAllowedCreationTypes.indexOf(t) == -1) 00216 { 00217 myAllowedCreationTypes.push_back(t); 00218 } 00219 } 00220 00221 inline void DtViewDriver::removeAllowedCreationType(DtModelDataType t) 00222 { 00223 int iIndex = myAllowedCreationTypes.indexOf(t); 00224 00225 if (iIndex != -1) 00226 { 00227 myAllowedCreationTypes.remove(iIndex); 00228 } 00229 } 00230 00231 inline const QVector<DtModelDataType>& DtViewDriver::allowedCreationTypes() const 00232 { 00233 return myAllowedCreationTypes; 00234 } 00235 00236 inline void DtViewDriver::allowAllCreationTypes() 00237 { 00238 myAllowedCreationTypes.clear(); 00239 } 00240 00241 inline bool DtViewDriver::allowCreationOf(DtModelDataType t) const 00242 { 00243 if (myAllowedCreationTypes.count() && (myAllowedCreationTypes.indexOf(t) == -1)) 00244 { 00245 return false; 00246 } 00247 00248 return true; 00249 } 00250 00251 #endif //VIEWDRIVER_H