1 // Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef VTKVIEWER_GEOMETRYFILTER_H
24 #define VTKVIEWER_GEOMETRYFILTER_H
26 #include "VTKViewer.h"
28 #include <vtkGeometryFilter.h>
34 #pragma warning ( disable:4251 )
37 class vtkUnstructuredGrid;
39 /*! \brief This class used same as vtkGeometryFilter. See documentation on VTK for more information.
41 class VTKVIEWER_EXPORT VTKViewer_GeometryFilter : public vtkGeometryFilter
44 /*! \fn static VTKViewer_GeometryFilter *New()
46 static VTKViewer_GeometryFilter *New();
48 /*! \fn vtkTypeMacro(VTKViewer_GeometryFilter, vtkGeometryFilter)
49 * \brief VTK type revision macros.
51 vtkTypeMacro(VTKViewer_GeometryFilter, vtkGeometryFilter)
52 /*! \fn void SetInside(int theShowInside)
53 * \brief Sets \a myShowInside flag. \a myShowInside is changed, call this->Modified().
54 * \param theShowInside - used for changing value of \a myShowInside variable.
56 void SetInside(int theShowInside);
57 /*! \fn int GetInside()
58 * \brief Return value of \a myShowInside
59 * \retval myShowInside
62 /*! \fn int GetAppendCoincident3D()
63 * \brief Return value of \a myAppendCoincident3D
64 * \retval myAppendCoincident3D
66 int GetAppendCoincident3D() const;
67 /*! \fn void SetAppendCoincident3D()
68 * \brief Sets \a myAppendCoincident3D flag. If this flag is true, filter append to the
69 result data set coincident 3D elements.
71 void SetAppendCoincident3D(int theFlag);
72 /*! \fn void SetWireframeMode(int theIsWireframeMode)
73 * \brief Sets \a myIsWireframeMode flag. \a myIsWireframeMode is changed, call this->Modified().
74 * \param theIsWireframeMode - used for changing value of \a myIsWireframeMode variable.
76 void SetWireframeMode(int theIsWireframeMode);
77 /*! \fn int GetWireframeMode()
78 * \brief Return value of \a myIsWireframeMode
79 * \retval myIsWireframeMode
81 int GetWireframeMode();
82 /*! \fn void SetStoreMapping(int theStoreMapping);
83 * \brief Sets \a myStoreMapping flag and call this->Modified()
84 * \param theStoreMapping - used for changing value of \a myStoreMapping variable.
86 void SetStoreMapping(int theStoreMapping);
87 /*! \fn int GetStoreMapping()
88 * \brief Return value of \a myStoreMapping
89 * \retval myStoreMapping
91 int GetStoreMapping();
92 /*! \fn virtual vtkIdType GetNodeObjId(int theVtkID)
93 * \brief Return input value theVtkID
96 virtual vtkIdType GetNodeObjId(vtkIdType theVtkID) { return theVtkID;}
97 /*! \fn virtual vtkIdType GetElemObjId(int theVtkID);
98 * \brief Return object ID by VTK ID cell
99 * \retval myVTK2ObjIds[theVtkID]
101 virtual vtkIdType GetElemObjId(vtkIdType theVtkID);
103 virtual void SetQuadraticArcMode(bool theFlag);
104 virtual bool GetQuadraticArcMode() const;
106 virtual void SetQuadraticArcAngle(double theMaxAngle);
107 virtual double GetQuadraticArcAngle() const;
109 typedef std::vector<vtkIdType> TVectorId;
110 //typedef std::map<vtkIdType, TVectorId> TMapOfVectorId;
111 typedef std::vector<TVectorId> TMapOfVectorId;
113 static void InsertId( const vtkIdType theCellId,
114 const vtkIdType theCellType,
115 TVectorId& /*theVTK2ObjIds*/,
116 TMapOfVectorId& theDimension2VTK2ObjIds );
119 /*! \fn VTKViewer_GeometryFilter();
120 * \brief Constructor which sets \a myShowInside = 0 and \a myStoreMapping = 0
122 VTKViewer_GeometryFilter();
123 /*! \fn ~VTKViewer_GeometryFilter();
126 ~VTKViewer_GeometryFilter();
128 int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
130 //special cases for performance
132 /*! \fn void UnstructuredGridExecute();
133 * \brief Filter calculation method for data object type is VTK_UNSTRUCTURED_GRID.
135 int UnstructuredGridExecute (vtkDataSet *, vtkPolyData *, vtkInformation *);
138 void BuildArcedPolygon(vtkIdType cellId,
139 vtkUnstructuredGrid* input,
141 TMapOfVectorId& theDimension2VTK2ObjIds,
142 bool triangulate = false);
144 /*! \fn void FillVTK2ObjIds(vtkPolyData *output);
145 * \brief fill myVTK2ObjIds to get the correspondence between vtk ids (displayed edges and faces
146 * computed in vtkGeometryFilter::UnstructuredGridExecute) and original cell ids (mesh cells)
148 void FillVTK2ObjIds(vtkPolyData *output);
150 // Delegate VTKViewer_GeometryFilter::UnstructuredGridExecute to vtkGeometryFilter::UnstructuredGridExecute
151 bool delegateToVtk = false;
154 TVectorId myVTK2ObjIds;
157 int myIsWireframeMode;
158 int myAppendCoincident3D;
160 double myMaxArcAngle; // define max angle for mesh 2D quadratic element in the degrees
161 bool myIsBuildArc; // flag for representation 2D quadratic element as arked polygon
165 #pragma warning ( default:4251 )