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 MiCellExtractUnstructuredIjk;
00044
00045 class MdMeshRepresentation;
00046
00047 class MiTopologyI;
00048 class MiVolumeTopologyExplicitIjk;
00049 class MiGeometryI;
00050
00085 class MESHIVIZDM_API MoMeshCellShape : public MoMeshSurfaceRepresentation {
00086
00087 SO_NODE_HEADER(MoMeshCellShape) ;
00088
00089 public:
00090
00094 MoMeshCellShape() ;
00095
00100 SoSFBool inclusiveList;
00101
00111 SoMFInt32 cellIndices;
00112
00118 SoSFFloat factor;
00119
00125 SoSFBool showCellName;
00126
00133 SoSFBool showNodeName;
00134
00144 SoSFFloat offset;
00145
00155 SoSFBool relativeOffset;
00156
00158
00165 const MiCellExtractUnstructured* getUnstructuredExtractor();
00166 const MiCellExtractUnstructuredIjk* getUnstructuredIjkExtractor();
00167 const MiCellExtractIjk* getIjkExtractor();
00168 const MiCellExtractIj* getIjExtractor();
00170
00171 #if 1 SoDEPRECATED
00174 const MiCellExtractIjk* getRegularExtractor();
00175 SoDEPRECATED
00177 const MiCellExtractIj* getSurfaceRegularExtractor();
00178
00179 #endif
00181
00182 private:
00183 static void initClass() ;
00184 static void exitClass() ;
00185
00186 private:
00187 virtual void doExtract(SoAction *action);
00188
00189 virtual const MiMesh* getExtractedMesh(MeshType& meshType);
00190
00191 private:
00192 template <MeshType _meshType> friend class MdLineCellExtract;
00193
00194 void clear();
00195
00196 template<typename _Tuple> std::vector<_Tuple>& buildIndexList();
00197
00198 std::vector<size_t>& buildIndexListI();
00199 std::vector<size_t> m_indexListI;
00200 std::vector<MiCellExtractIj::couple>& buildIndexListIj();
00201 std::vector<MiCellExtractIj::couple> m_indexListIj;
00202 std::vector<MiCellExtractIjk::triplet>& buildIndexListIjk();
00203 std::vector<MiCellExtractIjk::triplet> m_indexListIjk;
00204
00205 template< MeshType _meshType>
00206 void doExtract(SoState * state,const MiMesh* mesh);
00207
00208 class DisplayName
00209 {
00210 public:
00211 std::string m_name;
00212 MbVec3d m_pos;
00213 bool operator==(const DisplayName& c1) const {return m_name == c1.m_name && m_pos ==c1.m_pos;}
00214 };
00215 std::vector<DisplayName> m_cellNames;
00216 std::vector<DisplayName> m_nodeNames;
00217
00218 template <typename _Iterator, typename _Topology, typename _Tuple>
00219 void getDisplayCellList(const _Topology& topology, std::vector<_Tuple>& indexList, std::vector<_Tuple>& cellIds);
00220
00221 void buildDisplayNamesListI(const MiMeshUnstructuredI& mesh, const MiCellFilterI* cellFilter);
00222 void buildDisplayNamesListIj(const MiTopologyIj& topology, const MiGeometryI& geometry, const MiCellFilterIj* cellFilter);
00223 void buildDisplayNamesListIjk(const MiVolumeTopologyExplicitIjk& topology, const MiGeometryI& geometry,
00224 const MiCellFilterIjk* cellFilter, bool displayNodes = true);
00225
00226 void displayNames(std::vector<DisplayName>& newDisplayNames, std::vector<DisplayName>& currentDisplayNames, SoSeparator*& nameSep);
00227
00228 SoSeparator* m_nodeNamesSep;
00229 SoSeparator* m_cellNamesSep;
00230
00231 class CellFilter : public MiCellFilterI, public MiCellFilterIj, public MiCellFilterIjk
00232 {
00233 public:
00234 CellFilter();
00235 bool acceptCell(size_t cellIndex) const;
00236 bool acceptCell(size_t i, size_t j) const;
00237 bool acceptCell(size_t i, size_t j, size_t k) const;
00238 size_t getTimeStamp() const;
00239 void set(std::vector<size_t>& exclusionListI, const MiCellFilterI* userCellFilter);
00240 void set(std::vector<MiCellExtractIj::couple>& exclusionListIj, const MiCellFilterIj* userCellFilter);
00241 void set(std::vector<MiCellExtractIjk::triplet>& exclusionListIjk, const MiCellFilterIjk* userCellFilter);
00242 private:
00243 template < typename _vectorT > void copy( _vectorT& exclusionListI, _vectorT& newListI);
00244 std::vector<size_t> m_exclusionListI;
00245 std::vector<MiCellExtractIj::couple> m_exclusionListIj;
00246 std::vector<MiCellExtractIjk::triplet> m_exclusionListIjk;
00247 const MiCellFilterI* m_userCellFilterI;
00248 const MiCellFilterIj* m_userCellFilterIj;
00249 const MiCellFilterIjk* m_userCellFilterIjk;
00250 const MiCellFilter* m_currentCellFilter;
00251 mutable size_t m_userTS;
00252 mutable size_t m_timeStamp;
00253 };
00254 CellFilter m_excludedCellFilter;
00255
00256 } ;
00257
00258 template <>
00259 inline std::vector<size_t>& MoMeshCellShape::buildIndexList()
00260 {
00261 return buildIndexListI();
00262 }
00263
00264 template <>
00265 inline std::vector<MiCellExtractIj::couple>& MoMeshCellShape::buildIndexList()
00266 {
00267 return buildIndexListIj();
00268 }
00269
00270 template <>
00271 inline std::vector<MiCellExtractIjk::triplet>& MoMeshCellShape::buildIndexList()
00272 {
00273 return buildIndexListIjk();
00274 }
00275
00276
00277 #ifdef _WIN32
00278 #pragma warning(pop)
00279 #endif
00280
00281 #endif
00282
00283
00284
00285