00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MO_MESHCELLSHAPES_
00024 #define _MO_MESHCELLSHAPES_
00025
00026 #include <MeshVizXLM/MbVec3.h>
00027
00028 #include <MeshVizXLM/mapping/nodes/MoMeshSurfaceRepresentation.h>
00029
00030 #include <Inventor/fields/SoMFInt32.h>
00031 #include <MeshVizXLM/extractors/MiCellExtractIj.h>
00032 #include <MeshVizXLM/extractors/MiCellExtractIjk.h>
00033 #include <MeshVizXLM/mesh/cell/MiCellFilterI.h>
00034 #include <MeshVizXLM/mesh/cell/MiCellFilterIj.h>
00035 #include <MeshVizXLM/mesh/cell/MiCellFilterIjk.h>
00036
00037 #ifdef _WIN32
00038 #pragma warning(push)
00039 #pragma warning(disable:4251)
00040 #endif
00041
00042 class MiCellExtractUnstructured;
00043 class MiCellExtractHexahedronIjk;
00044
00045 class MdMeshRepresentation;
00046
00047 class MiVolumeMeshHexahedronIjk;
00048 class MiTopologyI;
00049 class MiGeometryI;
00050
00051 class MxDefaultStreamStringSet;
00052
00107 class MESHVIZXLM_DMAP_API MoMeshCellShape : public MoMeshSurfaceRepresentation {
00108
00109 SO_NODE_HEADER(MoMeshCellShape) ;
00110
00111 public:
00112
00116 MoMeshCellShape() ;
00117
00122 SoSFBool inclusiveList;
00123
00133 SoMFInt32 cellIndices;
00134
00140 SoSFFloat factor;
00141
00146 SoSFBool showCellName;
00147
00152 SoSFBool showNodeName;
00153
00163 SoSFFloat offset;
00164
00174 SoSFBool relativeOffset;
00175
00177
00184 const MiCellExtractUnstructured* getUnstructuredExtractor();
00185 const MiCellExtractHexahedronIjk* getHexahedronIjkExtractor();
00186 const MiCellExtractIjk* getIjkExtractor();
00187 const MiCellExtractIj* getIjExtractor();
00189
00190 #if 1 SoDEPRECATED
00192 const MiCellExtractHexahedronIjk* getUnstructuredIjkExtractor();
00193 #endif
00195 #if 1 SoDEPRECATED
00198 const MiCellExtractIjk* getRegularExtractor();
00199 SoDEPRECATED
00201 const MiCellExtractIj* getSurfaceRegularExtractor();
00202
00203 #endif
00205
00206 private:
00207 static void initClass() ;
00208 static void exitClass() ;
00209
00210 private:
00211 virtual void doExtract(SoAction *action);
00212
00213 virtual const MiMesh* getExtractedMesh(MeshType& meshType);
00214
00215 private:
00216 template <MeshType _meshType> friend class MdLineCellExtract;
00217
00218 void clear();
00219
00220 template<typename _Tuple> std::vector<_Tuple>& buildIndexList();
00221
00222 std::vector<size_t>& buildIndexListI();
00223 std::vector<size_t> m_indexListI;
00224 std::vector<MiCellExtractIj::couple>& buildIndexListIj();
00225 std::vector<MiCellExtractIj::couple> m_indexListIj;
00226 std::vector<MiCellExtractIjk::triplet>& buildIndexListIjk();
00227 std::vector<MiCellExtractIjk::triplet> m_indexListIjk;
00228
00229 template< MeshType _meshType>
00230 void doExtract(SoState * state,const MiMesh* mesh);
00231
00232 const MiStringSetI* getCellNamesI(SoState* state, bool &isCellNamesModified);
00233 const MiStringSetIj* getCellNamesIj(SoState* state, bool &isCellNamesModified);
00234 const MiStringSetIjk* getCellNamesIjk(SoState* state, bool &isCellNamesModified);
00235 const MiStringSetI* getNodeNamesI(SoState* state, bool &isNodeNamesModified);
00236
00237 size_t m_timeStampOfLastCellNames;
00238 size_t m_timeStampOfLastNodeNames;
00239
00240 class DisplayName
00241 {
00242 public:
00243 DisplayName() {}
00244 DisplayName(std::string name,const MbVec3d& pos) : m_name(name), m_pos(pos) {}
00245 std::string m_name;
00246 MbVec3d m_pos;
00247 bool operator==(const DisplayName& c1) const {return m_name == c1.m_name && m_pos ==c1.m_pos;}
00248 };
00249 std::vector<DisplayName> m_cellNames;
00250 std::vector<DisplayName> m_nodeNames;
00251
00252 template <typename _Iterator, typename _Topology, typename _Tuple>
00253 void getDisplayCellList(const _Topology& topology, std::vector<_Tuple>& indexList, std::vector<_Tuple>& cellIds);
00254
00255 void buildDisplayNamesListI(SoState* state, const MiMeshUnstructuredI& mesh, const MiCellFilterI* cellFilter);
00256 void buildDisplayNamesListIj(SoState* state, const MiTopologyIj& topology, const MiGeometryI& geometry, const MiCellFilterIj* cellFilter);
00257 void buildDisplayNamesListIjk(SoState* state, const MiVolumeMeshHexahedronIjk& mesh, const MiCellFilterIjk* cellFilter, bool displayNodes = true);
00258
00259 void displayNames(std::vector<DisplayName>& newDisplayNames, std::vector<DisplayName>& currentDisplayNames, SoSeparator*& nameSep);
00260
00261 SoSeparator* m_nodeNamesSep;
00262 SoSeparator* m_cellNamesSep;
00263
00264 class CellFilter : public MiCellFilterI, public MiCellFilterIj, public MiCellFilterIjk
00265 {
00266 public:
00267 CellFilter();
00268 bool acceptCell(size_t cellIndex) const;
00269 bool acceptCell(size_t i, size_t j) const;
00270 bool acceptCell(size_t i, size_t j, size_t k) const;
00271 size_t getTimeStamp() const;
00272 void set(std::vector<size_t>& exclusionListI, const MiCellFilterI* userCellFilter);
00273 void set(std::vector<MiCellExtractIj::couple>& exclusionListIj, const MiCellFilterIj* userCellFilter);
00274 void set(std::vector<MiCellExtractIjk::triplet>& exclusionListIjk, const MiCellFilterIjk* userCellFilter);
00275 private:
00276 template < typename _vectorT > void copy( _vectorT& exclusionListI, _vectorT& newListI);
00277 std::vector<size_t> m_exclusionListI;
00278 std::vector<MiCellExtractIj::couple> m_exclusionListIj;
00279 std::vector<MiCellExtractIjk::triplet> m_exclusionListIjk;
00280 const MiCellFilterI* m_userCellFilterI;
00281 const MiCellFilterIj* m_userCellFilterIj;
00282 const MiCellFilterIjk* m_userCellFilterIjk;
00283 const MiCellFilter* m_currentCellFilter;
00284 mutable size_t m_userTS;
00285 mutable size_t m_timeStamp;
00286 };
00287 CellFilter m_excludedCellFilter;
00288
00289 static MxDefaultStreamStringSet* s_streamStringSet;
00290 } ;
00291
00292 template <>
00293 inline std::vector<size_t>& MoMeshCellShape::buildIndexList()
00294 {
00295 return buildIndexListI();
00296 }
00297
00298 template <>
00299 inline std::vector<MiCellExtractIj::couple>& MoMeshCellShape::buildIndexList()
00300 {
00301 return buildIndexListIj();
00302 }
00303
00304 template <>
00305 inline std::vector<MiCellExtractIjk::triplet>& MoMeshCellShape::buildIndexList()
00306 {
00307 return buildIndexListIjk();
00308 }
00309
00310
00311 #ifdef _WIN32
00312 #pragma warning(pop)
00313 #endif
00314
00315 #endif
00316
00317
00318
00319