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