X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVTKViewer%2FVTKViewer_ConvexTool.h;h=621dde78ee6c21d50b14aafe754ea1a92633f88f;hb=refs%2Fheads%2Fngr%2Fpython3_dev_pv5.4;hp=a49448bf4469677ab84ceecb5103d23f8d7b529e;hpb=84e739898389c91887f9f6325dacd12348efb35e;p=modules%2Fgui.git diff --git a/src/VTKViewer/VTKViewer_ConvexTool.h b/src/VTKViewer/VTKViewer_ConvexTool.h index a49448bf4..621dde78e 100644 --- a/src/VTKViewer/VTKViewer_ConvexTool.h +++ b/src/VTKViewer/VTKViewer_ConvexTool.h @@ -1,46 +1,170 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifndef _VTKViewer_ConvexTool_H #define _VTKViewer_ConvexTool_H -#include -#include +#include "VTKViewer.h" + #include +#include + +#include -typedef std::vector TCell; // ptsIds -typedef std::map TCellArray; // CellId, TCell +class vtkUnstructuredGrid; +class vtkGeometryFilter; +class vtkGenericCell; +class vtkDelaunay3D; +class vtkPolyData; +class vtkCellData; +class vtkPoints; +class vtkIdList; +class vtkCell; +class vtkCellArray; +class vtkTriangle; +class vtkOrderedTriangulator; -/*! This package \namespace CONVEX_TOOL used for: - * calculation of VTK_POLYGON cell array from VTK_TRIANGLE (triangulation) - * of VTK_CONVEX_POINT_SET cell type. - */ -namespace CONVEX_TOOL + +//---------------------------------------------------------------------------- +class VTKVIEWER_EXPORT VTKViewer_Triangulator { - /*! \fn void CONVEX_TOOL::GetPolygonalFaces(vtkUnstructuredGrid* theCell,int cellId,TCellArray &outputCellArray) - * \brief Main function. - * \param theCell - vtkUnstructuredGrid cell pointer - * \param cellId - id of cell type VTK_CONVEX_POINT_SET - * \retval outputCellArray - output array with new cells types VTK_POLYGON - */ - void GetPolygonalFaces(vtkUnstructuredGrid* theCell,int cellId,TCellArray &outputCellArray); -} + public: + VTKViewer_Triangulator(); + + ~VTKViewer_Triangulator(); + + bool + Execute(vtkUnstructuredGrid *theInput, + vtkCellData* thInputCD, + vtkIdType theCellId, + int theShowInside, + int theAllVisible, + int theAppendCoincident3D, + const char* theCellsVisibility, + vtkPolyData *theOutput, + vtkCellData* theOutputCD, + int theStoreMapping, + std::vector& theVTK2ObjIds, + std::vector< std::vector >& theDimension2VTK2ObjIds, + bool theIsCheckConvex); + + private: + vtkIdList* myCellIds; + + protected: + vtkIdType *myPointIds; + vtkIdList* myFaceIds; + vtkPoints* myPoints; + + virtual + vtkPoints* + InitPoints(vtkUnstructuredGrid *theInput, + vtkIdType theCellId); + + virtual + vtkIdType + GetNumFaces() = 0; + + virtual + vtkCell* + GetFace(vtkIdType theFaceId) = 0; + + vtkIdType + GetNbOfPoints(); + + vtkIdType + GetPointId(vtkIdType thePointId); + + double + GetCellLength(); + + void + GetCellNeighbors(vtkUnstructuredGrid *theInput, + vtkIdType theCellId, + vtkCell* theFace, + vtkIdList* theCellIds); + + vtkIdType + GetConnectivity(vtkIdType thePntId); +}; + + +//---------------------------------------------------------------------------- +class VTKVIEWER_EXPORT VTKViewer_OrderedTriangulator : public VTKViewer_Triangulator +{ + public: + + VTKViewer_OrderedTriangulator(); + + ~VTKViewer_OrderedTriangulator(); + + protected: + vtkOrderedTriangulator *myTriangulator; + vtkCellArray *myBoundaryTris; + vtkTriangle *myTriangle; + + virtual + vtkPoints* + InitPoints(vtkUnstructuredGrid *theInput, + vtkIdType theCellId); + + virtual + vtkIdType + GetNumFaces(); + + virtual + vtkCell* + GetFace(vtkIdType theFaceId); +}; + + +//---------------------------------------------------------------------------- +class VTKVIEWER_EXPORT VTKViewer_DelaunayTriangulator : public VTKViewer_Triangulator +{ + public: + + VTKViewer_DelaunayTriangulator(); + + ~VTKViewer_DelaunayTriangulator(); + + protected: + vtkUnstructuredGrid* myUnstructuredGrid; + vtkGeometryFilter* myGeometryFilter; + vtkDelaunay3D* myDelaunay3D; + vtkPolyData* myPolyData; + + virtual + vtkPoints* + InitPoints(vtkUnstructuredGrid *theInput, + vtkIdType theCellId); + + virtual + vtkIdType + GetNumFaces(); + + virtual + vtkCell* + GetFace(vtkIdType theFaceId); +}; + #endif // _VTKViewer_ConvexTool_H