0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / IVtkVTK / IVtkVTK_ShapeData.hxx
index 935921e..04ceac3 100644 (file)
 #define __IVTKVTK_SHAPEDATA_H__
 
 #include <IVtk_IShapeData.hxx>
+
+// prevent disabling some MSVC warning messages by VTK headers 
+#ifdef _MSC_VER
+#pragma warning(push)
+#endif
 #include <vtkPolyData.h>
 #include <vtkSmartPointer.h>
+#include <vtkIdTypeArray.h>
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
 
 class vtkIdTypeArray;
 
 class IVtkVTK_ShapeData;
 DEFINE_STANDARD_HANDLE( IVtkVTK_ShapeData, IVtk_IShapeData )
 
-// macros to export static field in class
-#if (defined(_WIN32) || defined(__WIN32__))
-  #ifdef __IVtkVTK_DLL
-    #define IVtkVTK_EXPORT __declspec(dllexport)
-  #else
-    #define IVtkVTK_EXPORT __declspec(dllimport)
-  #endif
-#else
-  #define IVtkVTK_EXPORT
-#endif
-
 //! @class IVtkVTK_ShapeData 
 //! @brief IShapeData implementation for VTK.
 //!
@@ -44,8 +42,8 @@ class IVtkVTK_ShapeData : public IVtk_IShapeData
 {
 public:
 
-  IVtkVTK_EXPORT static const char* const ARRNAME_SUBSHAPE_IDS;
-  IVtkVTK_EXPORT static const char* const ARRNAME_MESH_TYPES;
+  static const char* ARRNAME_SUBSHAPE_IDS() { return "SUBSHAPE_IDS"; }
+  static const char* ARRNAME_MESH_TYPES() { return "MESH_TYPES"; }
 
   typedef Handle(IVtkVTK_ShapeData) Handle;
 
@@ -108,6 +106,23 @@ public: //! @name Specific methods
   vtkPolyData* getVtkPolyData() const
   { return myPolyData; }
 
+private:
+
+  //! Wrapper over vtkGenericDataArray::InsertNextTypedTuple().
+  void insertNextSubShapeId (IVtk_IdType theShapeID,
+                             IVtk_MeshType theMeshType)
+  {
+    const vtkIdType aShapeIDVTK = theShapeID;
+    const vtkIdType aType = theMeshType;
+  #if (VTK_MAJOR_VERSION > 7) || (VTK_MAJOR_VERSION == 7 && VTK_MINOR_VERSION >= 1)
+    mySubShapeIDs->InsertNextTypedTuple (&aShapeIDVTK);
+    myMeshTypes->InsertNextTypedTuple (&aType);
+  #else
+    mySubShapeIDs->InsertNextTupleValue (&aShapeIDVTK);
+    myMeshTypes->InsertNextTupleValue (&aType);
+  #endif
+  }
+
 private:
   vtkSmartPointer< vtkPolyData >    myPolyData;    //!< Shape geometry as vtkPolyData
   vtkSmartPointer< vtkIdTypeArray > mySubShapeIDs; //!< Array of sub-shapes ids