1 // Created on: 2011-10-14
2 // Created by: Roman KOZLOV
3 // Copyright (c) 2011-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef __IVTKVTK_SHAPEDATA_H__
17 #define __IVTKVTK_SHAPEDATA_H__
19 #include <IVtk_IShapeData.hxx>
20 #include <vtkPolyData.h>
21 #include <vtkSmartPointer.h>
25 class IVtkVTK_ShapeData;
26 DEFINE_STANDARD_HANDLE( IVtkVTK_ShapeData, IVtk_IShapeData )
28 // macros to export static field in class
29 #if (defined(_WIN32) || defined(__WIN32__))
31 #define IVtkVTK_EXPORT __declspec(dllexport)
33 #define IVtkVTK_EXPORT __declspec(dllimport)
36 #define IVtkVTK_EXPORT
39 //! @class IVtkVTK_ShapeData
40 //! @brief IShapeData implementation for VTK.
42 //! Contains the shape geometry information as vtkPolyData.
43 class IVtkVTK_ShapeData : public IVtk_IShapeData
47 IVtkVTK_EXPORT static const char* const ARRNAME_SUBSHAPE_IDS;
48 IVtkVTK_EXPORT static const char* const ARRNAME_MESH_TYPES;
50 typedef Handle(IVtkVTK_ShapeData) Handle;
53 Standard_EXPORT IVtkVTK_ShapeData();
55 Standard_EXPORT ~IVtkVTK_ShapeData();
57 DEFINE_STANDARD_RTTIEXT(IVtkVTK_ShapeData,IVtk_IShapeData)
59 //! Insert a coordinate
60 //! @param [in] theX X coordinate
61 //! @param [in] theY Y coordinate
62 //! @param [in] theZ Z coordinate
63 //! @return id of added point
64 Standard_EXPORT virtual IVtk_PointId InsertCoordinate (double theX, double theY, double theZ) Standard_OVERRIDE;
67 //! @param [in] theShapeID id of the subshape to which the vertex belongs.
68 //! @param [in] thePointId id of the point that defines the coordinates of the vertex
69 //! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default)
70 Standard_EXPORT virtual void InsertVertex (const IVtk_IdType theShapeID,
71 const IVtk_PointId thePointId,
72 const IVtk_MeshType theMeshType) Standard_OVERRIDE;
75 //! @param [in] theShapeID id of the subshape to which the line belongs.
76 //! @param [in] thePointId1 id of the first point
77 //! @param [in] thePointId2 id of the second point
78 //! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default)
79 Standard_EXPORT virtual void InsertLine (const IVtk_IdType theShapeID,
80 const IVtk_PointId thePointId1,
81 const IVtk_PointId thePointId2,
82 const IVtk_MeshType theMeshType) Standard_OVERRIDE;
84 //! Insert a poly-line.
85 //! @param [in] theShapeID id of the subshape to which the polyline belongs.
86 //! @param [in] thePointIds vector of point ids
87 //! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default)
88 Standard_EXPORT virtual void InsertLine (const IVtk_IdType theShapeID,
89 const IVtk_PointIdList* thePointIds,
90 const IVtk_MeshType theMeshType) Standard_OVERRIDE;
92 //! @param [in] theShapeID id of the subshape to which the triangle belongs.
93 //! @param [in] thePointId1 id of the first point
94 //! @param [in] thePointId2 id of the second point
95 //! @param [in] thePointId3 id of the third point
96 //! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default)
97 Standard_EXPORT virtual void InsertTriangle (const IVtk_IdType theShapeID,
98 const IVtk_PointId thePointId1,
99 const IVtk_PointId thePointId2,
100 const IVtk_PointId thePointId3,
101 const IVtk_MeshType theMeshType) Standard_OVERRIDE;
104 public: //! @name Specific methods
106 //! Get VTK PolyData.
107 //! @return VTK PolyData
108 vtkPolyData* getVtkPolyData() const
109 { return myPolyData; }
112 vtkSmartPointer< vtkPolyData > myPolyData; //!< Shape geometry as vtkPolyData
113 vtkSmartPointer< vtkIdTypeArray > mySubShapeIDs; //!< Array of sub-shapes ids
114 vtkSmartPointer< vtkIdTypeArray > myMeshTypes; //!< Array of type codes of mesh parts
117 #endif // __IVTKVTK_SHAPEDATA_H__