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 private:
00214 template <MeshType _meshType> friend class MdLineCellExtract;
00215
00216 void clear();
00217
00218 template<typename _Tuple> std::vector<_Tuple>& buildIndexList();
00219
00220 std::vector<size_t>& buildIndexListI();
00221 std::vector<size_t> m_indexListI;
00222 std::vector<MiCellExtractIj::couple>& buildIndexListIj();
00223 std::vector<MiCellExtractIj::couple> m_indexListIj;
00224 std::vector<MiCellExtractIjk::triplet>& buildIndexListIjk();
00225 std::vector<MiCellExtractIjk::triplet> m_indexListIjk;
00226
00227 template< MeshType _meshType>
00228 void doExtract(SoState * state,const MiMesh* mesh);
00229
00230 const MiStringSetI* getCellNamesI(SoState* state, bool &isCellNamesModified);
00231 const MiStringSetIj* getCellNamesIj(SoState* state, bool &isCellNamesModified);
00232 const MiStringSetIjk* getCellNamesIjk(SoState* state, bool &isCellNamesModified);
00233 const MiStringSetI* getNodeNamesI(SoState* state, bool &isNodeNamesModified);
00234
00235 size_t m_timeStampOfLastCellNames;
00236 size_t m_timeStampOfLastNodeNames;
00237
00238 class DisplayName
00239 {
00240 public:
00241 DisplayName() {}
00242 DisplayName(std::string name,const MbVec3d& pos) : m_name(name), m_pos(pos) {}
00243 std::string m_name;
00244 MbVec3d m_pos;
00245 bool operator==(const DisplayName& c1) const {return m_name == c1.m_name && m_pos ==c1.m_pos;}
00246 };
00247 std::vector<DisplayName> m_cellNames;
00248 std::vector<DisplayName> m_nodeNames;
00249
00250 template <typename _Iterator, typename _Topology, typename _Tuple>
00251 void getDisplayCellList(const _Topology& topology, std::vector<_Tuple>& indexList, std::vector<_Tuple>& cellIds);
00252
00253 void buildDisplayNamesListI(SoState* state, const MiMeshUnstructuredI& mesh, const MiCellFilterI* cellFilter);
00254 void buildDisplayNamesListIj(SoState* state, const MiTopologyIj& topology, const MiGeometryI& geometry, const MiCellFilterIj* cellFilter);
00255 void buildDisplayNamesListIjk(SoState* state, const MiVolumeMeshHexahedronIjk& mesh, const MiCellFilterIjk* cellFilter, bool displayNodes = true);
00256
00257 void displayNames(std::vector<DisplayName>& newDisplayNames, std::vector<DisplayName>& currentDisplayNames, SoSeparator*& nameSep);
00258
00259 SoSeparator* m_nodeNamesSep;
00260 SoSeparator* m_cellNamesSep;
00261
00262 class CellFilter : public MiCellFilterI, public MiCellFilterIj, public MiCellFilterIjk
00263 {
00264 public:
00265 CellFilter();
00266 bool acceptCell(size_t cellIndex) const;
00267 bool acceptCell(size_t i, size_t j) const;
00268 bool acceptCell(size_t i, size_t j, size_t k) const;
00269 size_t getTimeStamp() const;
00270 void set(std::vector<size_t>& exclusionListI, const MiCellFilterI* userCellFilter);
00271 void set(std::vector<MiCellExtractIj::couple>& exclusionListIj, const MiCellFilterIj* userCellFilter);
00272 void set(std::vector<MiCellExtractIjk::triplet>& exclusionListIjk, const MiCellFilterIjk* userCellFilter);
00273 private:
00274 template < typename _vectorT > void copy( _vectorT& exclusionListI, _vectorT& newListI);
00275 std::vector<size_t> m_exclusionListI;
00276 std::vector<MiCellExtractIj::couple> m_exclusionListIj;
00277 std::vector<MiCellExtractIjk::triplet> m_exclusionListIjk;
00278 const MiCellFilterI* m_userCellFilterI;
00279 const MiCellFilterIj* m_userCellFilterIj;
00280 const MiCellFilterIjk* m_userCellFilterIjk;
00281 const MiCellFilter* m_currentCellFilter;
00282 mutable size_t m_userTS;
00283 mutable size_t m_timeStamp;
00284 };
00285 CellFilter m_excludedCellFilter;
00286
00287 static MxDefaultStreamStringSet* s_streamStringSet;
00288 } ;
00289
00290 template <>
00291 inline std::vector<size_t>& MoMeshCellShape::buildIndexList()
00292 {
00293 return buildIndexListI();
00294 }
00295
00296 template <>
00297 inline std::vector<MiCellExtractIj::couple>& MoMeshCellShape::buildIndexList()
00298 {
00299 return buildIndexListIj();
00300 }
00301
00302 template <>
00303 inline std::vector<MiCellExtractIjk::triplet>& MoMeshCellShape::buildIndexList()
00304 {
00305 return buildIndexListIjk();
00306 }
00307
00308
00309 #ifdef _WIN32
00310 #pragma warning(pop)
00311 #endif
00312
00313 #endif
00314
00315
00316
00317