MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00005 00010 //---------------------------------------------------------------------------------- 00011 00012 #ifndef __CSOGroup_H 00013 #define __CSOGroup_H 00014 00015 #include "MLCSOIncludes.h" 00016 #include "CSOAttributes.h" 00017 #include "CSOBoundingBox.h" 00018 #include "CSORules/CSOGroupRules.h" 00019 00020 00021 ML_START_NAMESPACE 00022 00023 00024 // forward declarations 00025 class CSO; 00026 class CSOList; 00027 00029 00034 class MLCSO_EXPORT CSOGroup 00035 { 00036 00037 public: 00038 00040 CSOGroup(); 00042 CSOGroup(CSOList* csoList); 00044 CSOGroup(const CSOGroup &group, int groupId=-1); 00046 ~CSOGroup(); 00047 00049 inline CSOGroupRules& getRules() { return _rules; } 00050 00055 00056 void addCSO(CSO* cso); 00058 void removeCSO(CSO* cso); 00060 void removeAllCSO(); 00062 bool contains(CSO* cso) const; 00064 inline unsigned int numCSOs() const { return static_cast<unsigned int>(_memberCSOIds.size()); } 00066 CSO* getCSOAt(unsigned int index) const; 00068 inline unsigned int getCSOIdAt(unsigned int index) const { return _memberCSOIds[index]; } 00070 00075 00076 inline unsigned int getId() const { return _uniqueId; } 00078 inline void setId(unsigned int id) { _uniqueId = id; } 00082 void setCSOList(CSOList* csoList); 00084 inline CSOList* getCSOList() const { return _csoList; } 00086 00089 bool isSelected() const; 00090 00095 00096 void setLabel(const std::string& label); 00098 inline const std::string& getLabel() const { return _attributes.label; } 00100 void setDescription(const std::string& description); 00102 inline const std::string& getDescription() const { return _attributes.description; } 00103 00105 inline int getTimePointIndex() const { return _attributes.timePointIndex; } 00107 void setTimePointIndex(int timePointIndex); 00109 void setShowState(bool state); 00111 inline bool getShowState() const { return _attributes.showState; } 00113 void setVoxelizeState(bool state); 00115 inline bool getVoxelizeState() const { return _attributes.voxelizeState; } 00117 void setEditableState(bool state); 00119 inline bool getEditableState() const { return _attributes.editableState; } 00121 inline CSOLineStyle getPathPointStyle() const { return static_cast<CSOLineStyle>(_attributes.pathPointStyle); } 00123 void setPathPointStyle(CSOLineStyle style); 00125 inline void setPathPointStyle(int style) { setPathPointStyle(static_cast<CSOLineStyle>(style)); } 00127 inline float getPathPointWidth() const { return _attributes.pathPointWidth; } 00129 void setPathPointWidth(float width); 00131 inline const Vector3& getPathPointColor() const { return _attributes.pathPointColor; } 00133 void setPathPointColor(const Vector3& color); 00135 inline float getPathPointAlpha() const { return _attributes.pathPointAlpha; } 00137 void setPathPointAlpha(float alpha); 00139 inline int getSeedPointStyle() const { return _attributes.seedPointStyle; } 00141 void setSeedPointStyle(int seedPointStyle); 00143 inline float getSeedPointSize() const { return _attributes.seedPointSize; } 00145 void setSeedPointSize(float size); 00147 inline const Vector3& getSeedPointColor() const { return _attributes.seedPointColor; } 00149 void setSeedPointColor(const Vector3& color); 00151 inline float getSeedPointAlpha() const { return _attributes.seedPointAlpha; } 00153 void setSeedPointAlpha(float alpha); 00155 inline int getVoxelWriteMode() const { return _attributes.voxelWriteMode; } 00157 void setVoxelWriteMode(int mode); 00159 inline float getVoxelWriteValue() const { return _attributes.voxelWriteValue; } 00161 void setVoxelWriteValue(float value); 00163 00168 00169 void setUserData(const std::string& name, Variant value) { _attributes.setUserData(name, value); } 00171 Variant getUserData(const std::string& name) const { return _attributes.getUserData(name); } 00173 void getUserDataNames(std::vector< std::string >& names) const { _attributes.getUserDataNames(names); } 00175 void removeUserData(const std::string& name) { _attributes.removeUserData(name); } 00177 00182 00183 inline bool getUseTimePointIndex() const { return _useTimePointIndex; } 00185 inline void setUseTimePointIndex(bool state) { _useTimePointIndex = state; } 00187 inline bool getUseShowState() const { return _useShowState; } 00189 inline void setUseShowState(bool state) { _useShowState = state; } 00191 inline bool getUseVoxelizeState() const { return _useVoxelizeState; } 00193 inline void setUseVoxelizeState(bool state) { _useVoxelizeState = state; } 00195 inline bool getUseEditableState() const { return _useEditableState; } 00197 inline void setUseEditableState(bool state) { _useEditableState = state; } 00199 inline bool getUseSeedPointStyle() const { return _useSeedPointStyle; } 00201 inline void setUseSeedPointStyle(bool state) { _useSeedPointStyle = state; } 00203 inline bool getUseSeedPointSize() const { return _useSeedPointSize; } 00205 inline void setUseSeedPointSize(bool state) { _useSeedPointSize = state; } 00207 inline bool getUseSeedPointColor() const { return _useSeedPointColor; } 00209 inline void setUseSeedPointColor(bool state) { _useSeedPointColor = state; } 00211 inline bool getUseSeedPointAlpha() const { return _useSeedPointAlpha; } 00213 inline void setUseSeedPointAlpha(bool state) { _useSeedPointAlpha = state; } 00215 inline bool getUsePathPointStyle() const { return _usePathPointStyle; } 00217 inline void setUsePathPointStyle(bool state) { _usePathPointStyle = state; } 00219 inline bool getUsePathPointWidth() const { return _usePathPointWidth; } 00221 inline void setUsePathPointWidth(bool state) { _usePathPointWidth = state; } 00223 inline bool getUsePathPointColor() const { return _usePathPointColor; } 00225 inline void setUsePathPointColor(bool state) { _usePathPointColor = state; } 00227 inline bool getUsePathPointAlpha() const { return _usePathPointAlpha; } 00229 inline void setUsePathPointAlpha(bool state) { _usePathPointAlpha = state; } 00231 inline bool getUseVoxelWriteMode() const { return _useVoxelWriteMode; } 00233 inline void setUseVoxelWriteMode(bool state) { _useVoxelWriteMode = state; } 00235 inline bool getUseVoxelWriteValue() const { return _useVoxelWriteValue; } 00237 inline void setUseVoxelWriteValue(bool state) { _useVoxelWriteValue = state; } 00239 00244 00245 const CSOBoundingBox& getBoundingBox(); 00247 const CSOBoundingBox& getVoxelBoundingBox(const Matrix4& worldToVoxelMatrix); 00249 00251 void groupChanged(); 00252 00254 bool saveAttributes(std::ostream& outStream, bool useAscii=false); 00256 void loadAttributes(std::istream& inStream, short version, bool swapBytes, bool useAscii=false); 00257 00258 00259 #ifdef ML_DEPRECATED 00260 00261 00262 00263 inline ML_DEPRECATED unsigned int numCSO() const { return numCSOs(); } 00266 inline ML_DEPRECATED CSOLineStyle getLineStyle() const { return getPathPointStyle(); } 00269 inline ML_DEPRECATED void setLineStyle(CSOLineStyle lineStyle) { setPathPointStyle(lineStyle); } 00272 inline ML_DEPRECATED const Vector3& getColor() const { return getPathPointColor(); } 00275 inline ML_DEPRECATED void setColor(const Vector3& color) { setPathPointColor(color); } 00278 inline ML_DEPRECATED float getAlpha() const { return getPathPointAlpha(); } 00281 inline ML_DEPRECATED void setAlpha(float alpha) { setPathPointAlpha(alpha); } 00284 inline ML_DEPRECATED float getLineWidth() const { return getPathPointWidth(); } 00287 inline ML_DEPRECATED void setLineWidth(float lineWidth) { setPathPointWidth(lineWidth); } 00290 inline ML_DEPRECATED int getMarkerMode() const { return getSeedPointStyle(); } 00293 inline ML_DEPRECATED void setMarkerMode(int markerMode) { setSeedPointStyle(markerMode); } 00296 inline ML_DEPRECATED const Vector3& getMarkerColor() const { return getSeedPointColor(); } 00299 inline ML_DEPRECATED void setMarkerColor(const Vector3& markerColor) { setSeedPointColor(markerColor); } 00302 inline ML_DEPRECATED float getMarkerAlpha() const { return getSeedPointAlpha(); } 00305 inline ML_DEPRECATED void setMarkerAlpha(float markerAlpha) { setSeedPointAlpha(markerAlpha); } 00308 inline ML_DEPRECATED float getMarkerSize() const { return getSeedPointSize(); } 00311 inline ML_DEPRECATED void setMarkerSize(float markerSize) { setSeedPointSize(markerSize);} 00314 inline ML_DEPRECATED bool getUseVisuals() const { 00315 return _usePathPointStyle || _usePathPointWidth || _usePathPointColor || _usePathPointAlpha; 00316 } 00319 inline ML_DEPRECATED void setUseVisuals(bool state) { 00320 _usePathPointAlpha = _usePathPointColor = _usePathPointStyle = _usePathPointWidth = state; 00321 } 00324 inline ML_DEPRECATED bool getUseVoxelWrite() const { 00325 return _useVoxelWriteValue || _useVoxelWriteMode; 00326 } 00329 inline ML_DEPRECATED void setUseVoxelWrite(bool state) { 00330 _useVoxelWriteMode = _useVoxelWriteValue = state; 00331 } 00334 inline ML_DEPRECATED bool getUseMarkerSettings() const { 00335 return _useSeedPointAlpha || _useSeedPointColor || _useSeedPointSize || _useSeedPointStyle; 00336 } 00339 inline ML_DEPRECATED void setUseMarkerSettings(bool state) { 00340 _useSeedPointAlpha = _useSeedPointColor = _useSeedPointSize = _useSeedPointStyle = state; 00341 } 00343 #endif 00344 00345 private: 00346 00348 unsigned int _uniqueId; 00349 00351 std::vector<unsigned int>_memberCSOIds; 00352 00354 CSOList* _csoList; 00355 00357 CSOAttributes _attributes; 00358 00360 CSOGroupRules _rules; 00361 00363 bool _useTimePointIndex; 00365 bool _useShowState; 00367 bool _useVoxelizeState; 00369 bool _useEditableState; 00370 00371 bool _useSeedPointStyle; 00372 bool _useSeedPointSize; 00373 bool _useSeedPointColor; 00374 bool _useSeedPointAlpha; 00375 00376 bool _usePathPointStyle; 00377 bool _usePathPointWidth; 00378 bool _usePathPointColor; 00379 bool _usePathPointAlpha; 00380 00381 bool _useVoxelWriteMode; 00382 bool _useVoxelWriteValue; 00383 00385 Matrix4 _lastRecentWorldToVoxelMatrix; 00386 00388 bool _hasValidWorldBoundingBox; 00390 bool _hasValidVoxelBoundingBox; 00391 00392 00394 CSOBoundingBox _worldBoundingBox; 00396 CSOBoundingBox _voxelBoundingBox; 00397 }; 00398 00399 00400 00401 ML_END_NAMESPACE 00402 00403 00404 00405 #endif // __CSOGroup_H 00406 00407 00408