1 // Created on: 1993-01-27 2 // Created by: Jean-Louis Frenkel 3 // Copyright (c) 1993-1999 Matra Datavision 4 // Copyright (c) 1999-2014 OPEN CASCADE SAS 5 // 6 // This file is part of Open CASCADE Technology software library. 7 // 8 // This library is free software; you can redistribute it and/or modify it under 9 // the terms of the GNU Lesser General Public License version 2.1 as published 10 // by the Free Software Foundation, with special exception defined in the file 11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 12 // distribution for complete text of the license and disclaimer of any warranty. 13 // 14 // Alternatively, this file may be used under the terms of Open CASCADE 15 // commercial license or contractual agreement. 16 17 #ifndef _Prs3d_ShapeTool_HeaderFile 18 #define _Prs3d_ShapeTool_HeaderFile 19 20 #include <Standard_DefineAlloc.hxx> 21 #include <TopoDS.hxx> 22 #include <TopoDS_Face.hxx> 23 #include <TopoDS_Shape.hxx> 24 #include <TopExp_Explorer.hxx> 25 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> 26 #include <TopTools_IndexedMapOfShape.hxx> 27 #include <TopTools_HSequenceOfShape.hxx> 28 29 class Bnd_Box; 30 class TopoDS_Edge; 31 class TopoDS_Vertex; 32 class Poly_Triangulation; 33 class Poly_PolygonOnTriangulation; 34 class Poly_Polygon3D; 35 36 //! describes the behaviour requested for a wireframe 37 //! shape presentation. 38 class Prs3d_ShapeTool 39 { 40 public: 41 DEFINE_STANDARD_ALLOC 42 43 //! Constructs the tool and initializes it using theShape and theAllVertices 44 //! (optional) arguments. By default, only isolated and internal vertices are considered, 45 //! however if theAllVertices argument is equal to True, all shape's vertices are taken into account. 46 Standard_EXPORT Prs3d_ShapeTool(const TopoDS_Shape& theShape, const Standard_Boolean theAllVertices = Standard_False); 47 48 Standard_EXPORT void InitFace(); 49 50 Standard_EXPORT Standard_Boolean MoreFace() const; 51 52 Standard_EXPORT void NextFace(); 53 54 Standard_EXPORT const TopoDS_Face& GetFace() const; 55 56 Standard_EXPORT Bnd_Box FaceBound() const; 57 IsPlanarFace() const58 Standard_Boolean IsPlanarFace() const 59 { 60 const TopoDS_Face& aFace = TopoDS::Face (myFaceExplorer.Current()); 61 return IsPlanarFace (aFace); 62 } 63 64 Standard_EXPORT void InitCurve(); 65 66 Standard_EXPORT Standard_Boolean MoreCurve() const; 67 68 Standard_EXPORT void NextCurve(); 69 70 Standard_EXPORT const TopoDS_Edge& GetCurve() const; 71 72 Standard_EXPORT Bnd_Box CurveBound() const; 73 74 Standard_EXPORT Standard_Integer Neighbours() const; 75 76 Standard_EXPORT Handle(TopTools_HSequenceOfShape) FacesOfEdge() const; 77 78 Standard_EXPORT void InitVertex(); 79 80 Standard_EXPORT Standard_Boolean MoreVertex() const; 81 82 Standard_EXPORT void NextVertex(); 83 84 Standard_EXPORT const TopoDS_Vertex& GetVertex() const; 85 86 Standard_EXPORT Standard_Boolean HasSurface() const; 87 88 Standard_EXPORT Handle(Poly_Triangulation) CurrentTriangulation (TopLoc_Location& l) const; 89 90 Standard_EXPORT Standard_Boolean HasCurve() const; 91 92 Standard_EXPORT void PolygonOnTriangulation (Handle(Poly_PolygonOnTriangulation)& Indices, Handle(Poly_Triangulation)& T, TopLoc_Location& l) const; 93 94 Standard_EXPORT Handle(Poly_Polygon3D) Polygon3D (TopLoc_Location& l) const; 95 96 public: 97 98 Standard_EXPORT static Standard_Boolean IsPlanarFace (const TopoDS_Face& theFace); 99 100 private: 101 102 TopoDS_Shape myShape; 103 TopExp_Explorer myFaceExplorer; 104 TopTools_IndexedDataMapOfShapeListOfShape myEdgeMap; 105 TopTools_IndexedMapOfShape myVertexMap; 106 Standard_Integer myEdge; 107 Standard_Integer myVertex; 108 109 }; 110 111 #endif // _Prs3d_ShapeTool_HeaderFile 112