913a4c4a |
1 | // Created on: 2011-10-14 |
2 | // Created by: Roman KOZLOV |
3 | // Copyright (c) 2011-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef __IVTKVTK_SHAPEDATA_H__ |
17 | #define __IVTKVTK_SHAPEDATA_H__ |
18 | |
19 | #include <IVtk_IShapeData.hxx> |
a2f76b15 |
20 | #include <vtkPolyData.h> |
913a4c4a |
21 | #include <vtkSmartPointer.h> |
22 | |
23 | class vtkIdTypeArray; |
913a4c4a |
24 | |
c04c30b3 |
25 | class IVtkVTK_ShapeData; |
913a4c4a |
26 | DEFINE_STANDARD_HANDLE( IVtkVTK_ShapeData, IVtk_IShapeData ) |
27 | |
28 | // macros to export static field in class |
fe4fc02d |
29 | #ifndef IVtkVTK_EXPORT |
30 | #ifdef _WIN32 |
31 | #ifdef __IVtkVTK_DLL |
32 | #define IVtkVTK_EXPORT __declspec(dllexport) |
33 | #else |
34 | #define IVtkVTK_EXPORT __declspec(dllimport) |
35 | #endif |
913a4c4a |
36 | #else |
fe4fc02d |
37 | #define IVtkVTK_EXPORT |
913a4c4a |
38 | #endif |
913a4c4a |
39 | #endif |
40 | |
41 | //! @class IVtkVTK_ShapeData |
42 | //! @brief IShapeData implementation for VTK. |
43 | //! |
44 | //! Contains the shape geometry information as vtkPolyData. |
45 | class IVtkVTK_ShapeData : public IVtk_IShapeData |
46 | { |
47 | public: |
48 | |
49 | IVtkVTK_EXPORT static const char* const ARRNAME_SUBSHAPE_IDS; |
50 | IVtkVTK_EXPORT static const char* const ARRNAME_MESH_TYPES; |
51 | |
52 | typedef Handle(IVtkVTK_ShapeData) Handle; |
53 | |
54 | //! Constructor |
55 | Standard_EXPORT IVtkVTK_ShapeData(); |
56 | //! Destructor |
57 | Standard_EXPORT ~IVtkVTK_ShapeData(); |
58 | |
92efcf78 |
59 | DEFINE_STANDARD_RTTIEXT(IVtkVTK_ShapeData,IVtk_IShapeData) |
913a4c4a |
60 | |
61 | //! Insert a coordinate |
62 | //! @param [in] theX X coordinate |
63 | //! @param [in] theY Y coordinate |
64 | //! @param [in] theZ Z coordinate |
65 | //! @return id of added point |
c7854818 |
66 | Standard_EXPORT virtual IVtk_PointId InsertCoordinate (double theX, double theY, double theZ) Standard_OVERRIDE; |
913a4c4a |
67 | |
68 | //! Insert a vertex. |
69 | //! @param [in] theShapeID id of the subshape to which the vertex belongs. |
70 | //! @param [in] thePointId id of the point that defines the coordinates of the vertex |
71 | //! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default) |
72 | Standard_EXPORT virtual void InsertVertex (const IVtk_IdType theShapeID, |
73 | const IVtk_PointId thePointId, |
c7854818 |
74 | const IVtk_MeshType theMeshType) Standard_OVERRIDE; |
913a4c4a |
75 | |
76 | //! Insert a line. |
77 | //! @param [in] theShapeID id of the subshape to which the line belongs. |
78 | //! @param [in] thePointId1 id of the first point |
79 | //! @param [in] thePointId2 id of the second point |
80 | //! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default) |
81 | Standard_EXPORT virtual void InsertLine (const IVtk_IdType theShapeID, |
82 | const IVtk_PointId thePointId1, |
83 | const IVtk_PointId thePointId2, |
c7854818 |
84 | const IVtk_MeshType theMeshType) Standard_OVERRIDE; |
913a4c4a |
85 | |
86 | //! Insert a poly-line. |
87 | //! @param [in] theShapeID id of the subshape to which the polyline belongs. |
88 | //! @param [in] thePointIds vector of point ids |
89 | //! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default) |
90 | Standard_EXPORT virtual void InsertLine (const IVtk_IdType theShapeID, |
91 | const IVtk_PointIdList* thePointIds, |
c7854818 |
92 | const IVtk_MeshType theMeshType) Standard_OVERRIDE; |
913a4c4a |
93 | //! Insert a triangle |
94 | //! @param [in] theShapeID id of the subshape to which the triangle belongs. |
95 | //! @param [in] thePointId1 id of the first point |
96 | //! @param [in] thePointId2 id of the second point |
97 | //! @param [in] thePointId3 id of the third point |
98 | //! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default) |
99 | Standard_EXPORT virtual void InsertTriangle (const IVtk_IdType theShapeID, |
100 | const IVtk_PointId thePointId1, |
101 | const IVtk_PointId thePointId2, |
102 | const IVtk_PointId thePointId3, |
c7854818 |
103 | const IVtk_MeshType theMeshType) Standard_OVERRIDE; |
913a4c4a |
104 | |
105 | |
106 | public: //! @name Specific methods |
107 | |
108 | //! Get VTK PolyData. |
109 | //! @return VTK PolyData |
a2f76b15 |
110 | vtkPolyData* getVtkPolyData() const |
913a4c4a |
111 | { return myPolyData; } |
112 | |
113 | private: |
114 | vtkSmartPointer< vtkPolyData > myPolyData; //!< Shape geometry as vtkPolyData |
115 | vtkSmartPointer< vtkIdTypeArray > mySubShapeIDs; //!< Array of sub-shapes ids |
116 | vtkSmartPointer< vtkIdTypeArray > myMeshTypes; //!< Array of type codes of mesh parts |
117 | }; |
118 | |
119 | #endif // __IVTKVTK_SHAPEDATA_H__ |