0028452: VIS - MSVC 14 compiler warnings
[occt.git] / src / IVtkVTK / IVtkVTK_ShapeData.hxx
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>
20
21 // prevent disabling some MSVC warning messages by VTK headers 
22 #ifdef _MSC_VER
23 #pragma warning(push)
24 #endif
25 #include <vtkPolyData.h>
26 #include <vtkSmartPointer.h>
27 #ifdef _MSC_VER
28 #pragma warning(pop)
29 #endif
30
31 class vtkIdTypeArray;
32
33 class IVtkVTK_ShapeData;
34 DEFINE_STANDARD_HANDLE( IVtkVTK_ShapeData, IVtk_IShapeData )
35
36 // macros to export static field in class
37 #ifndef IVtkVTK_EXPORT
38   #ifdef _WIN32
39     #ifdef __IVtkVTK_DLL
40       #define IVtkVTK_EXPORT __declspec(dllexport)
41     #else
42       #define IVtkVTK_EXPORT __declspec(dllimport)
43     #endif
44   #else
45     #define IVtkVTK_EXPORT
46   #endif
47 #endif
48
49 //! @class IVtkVTK_ShapeData 
50 //! @brief IShapeData implementation for VTK.
51 //!
52 //! Contains the shape geometry information as vtkPolyData.
53 class IVtkVTK_ShapeData : public IVtk_IShapeData
54 {
55 public:
56
57   IVtkVTK_EXPORT static const char* const ARRNAME_SUBSHAPE_IDS;
58   IVtkVTK_EXPORT static const char* const ARRNAME_MESH_TYPES;
59
60   typedef Handle(IVtkVTK_ShapeData) Handle;
61
62   //! Constructor
63   Standard_EXPORT IVtkVTK_ShapeData();
64   //! Destructor
65   Standard_EXPORT ~IVtkVTK_ShapeData();
66
67   DEFINE_STANDARD_RTTIEXT(IVtkVTK_ShapeData,IVtk_IShapeData)
68
69   //! Insert a coordinate
70   //! @param [in] theX X coordinate
71   //! @param [in] theY Y coordinate
72   //! @param [in] theZ Z coordinate
73   //! @return id of added point
74   Standard_EXPORT virtual IVtk_PointId InsertCoordinate (double theX, double theY, double theZ) Standard_OVERRIDE;
75
76   //! Insert a vertex.
77   //! @param [in] theShapeID id of the subshape to which the vertex belongs.
78   //! @param [in] thePointId id of the point that defines the coordinates of the vertex
79   //! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default)
80   Standard_EXPORT virtual void InsertVertex (const IVtk_IdType   theShapeID,
81                                              const IVtk_PointId  thePointId,
82                                              const IVtk_MeshType theMeshType) Standard_OVERRIDE;
83
84   //! Insert a line.
85   //! @param [in] theShapeID id of the subshape to which the line belongs.
86   //! @param [in] thePointId1 id of the first point
87   //! @param [in] thePointId2 id of the second point
88   //! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default)
89   Standard_EXPORT virtual void InsertLine (const IVtk_IdType   theShapeID,
90                                            const IVtk_PointId  thePointId1,
91                                            const IVtk_PointId  thePointId2,
92                                            const IVtk_MeshType theMeshType) Standard_OVERRIDE;
93
94   //! Insert a poly-line.
95   //! @param [in] theShapeID id of the subshape to which the polyline belongs.
96   //! @param [in] thePointIds vector of point ids
97   //! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default)
98   Standard_EXPORT virtual void InsertLine (const IVtk_IdType       theShapeID, 
99                                            const IVtk_PointIdList* thePointIds,
100                                            const IVtk_MeshType     theMeshType) Standard_OVERRIDE;
101   //! Insert a triangle
102   //! @param [in] theShapeID id of the subshape to which the triangle belongs.
103   //! @param [in] thePointId1 id of the first point
104   //! @param [in] thePointId2 id of the second point
105   //! @param [in] thePointId3 id of the third point
106   //! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default)
107   Standard_EXPORT virtual void InsertTriangle (const IVtk_IdType   theShapeID,
108                                                const IVtk_PointId  thePointId1,
109                                                const IVtk_PointId  thePointId2,
110                                                const IVtk_PointId  thePointId3,
111                                                const IVtk_MeshType theMeshType) Standard_OVERRIDE;
112
113
114 public: //! @name Specific methods
115
116   //! Get VTK PolyData.
117   //! @return VTK PolyData
118   vtkPolyData* getVtkPolyData() const
119   { return myPolyData; }
120
121 private:
122   vtkSmartPointer< vtkPolyData >    myPolyData;    //!< Shape geometry as vtkPolyData
123   vtkSmartPointer< vtkIdTypeArray > mySubShapeIDs; //!< Array of sub-shapes ids
124   vtkSmartPointer< vtkIdTypeArray > myMeshTypes;   //!< Array of type codes of mesh parts
125 };
126
127 #endif // __IVTKVTK_SHAPEDATA_H__