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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _StdPrs_ShapeTool_HeaderFile
18 #define _StdPrs_ShapeTool_HeaderFile
20 #include <Standard_DefineAlloc.hxx>
22 #include <TopoDS_Edge.hxx>
23 #include <TopoDS_Face.hxx>
24 #include <TopoDS_Shape.hxx>
25 #include <TopoDS_Vertex.hxx>
26 #include <TopExp_Explorer.hxx>
27 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
28 #include <TopTools_IndexedMapOfShape.hxx>
29 #include <TopTools_HSequenceOfShape.hxx>
32 class Poly_Triangulation;
33 class Poly_PolygonOnTriangulation;
36 //! Describes the behaviour requested for a wireframe shape presentation.
37 class StdPrs_ShapeTool
42 //! Constructs the tool and initializes it using theShape and theAllVertices
43 //! (optional) arguments. By default, only isolated and internal vertices are considered,
44 //! however if theAllVertices argument is equal to True, all shape's vertices are taken into account.
45 Standard_EXPORT StdPrs_ShapeTool (const TopoDS_Shape& theShape, const Standard_Boolean theAllVertices = Standard_False);
47 void InitFace() { myFaceExplorer.Init(myShape,TopAbs_FACE); }
49 Standard_Boolean MoreFace() const { return myFaceExplorer.More(); }
51 void NextFace() { myFaceExplorer.Next(); }
53 const TopoDS_Face& GetFace() const { return TopoDS::Face(myFaceExplorer.Current()); }
55 Standard_EXPORT Bnd_Box FaceBound() const;
57 Standard_Boolean IsPlanarFace() const
59 const TopoDS_Face& aFace = TopoDS::Face (myFaceExplorer.Current());
60 return IsPlanarFace (aFace);
63 void InitCurve() { myEdge = 1; }
65 Standard_Boolean MoreCurve() const { return myEdge <= myEdgeMap.Extent(); }
67 void NextCurve() { ++myEdge; }
69 const TopoDS_Edge& GetCurve() const { return TopoDS::Edge(myEdgeMap.FindKey(myEdge)); }
71 Standard_EXPORT Bnd_Box CurveBound() const;
73 Standard_EXPORT Standard_Integer Neighbours() const;
75 Standard_EXPORT Handle(TopTools_HSequenceOfShape) FacesOfEdge() const;
77 void InitVertex() { myVertex = 1; }
79 Standard_Boolean MoreVertex() const { return myVertex <= myVertexMap.Extent(); }
81 void NextVertex() { ++myVertex; }
83 const TopoDS_Vertex& GetVertex() const { return TopoDS::Vertex (myVertexMap.FindKey(myVertex)); }
85 Standard_EXPORT Standard_Boolean HasSurface() const;
87 Standard_EXPORT Handle(Poly_Triangulation) CurrentTriangulation (TopLoc_Location& l) const;
89 Standard_EXPORT Standard_Boolean HasCurve() const;
91 Standard_EXPORT void PolygonOnTriangulation (Handle(Poly_PolygonOnTriangulation)& Indices, Handle(Poly_Triangulation)& T, TopLoc_Location& l) const;
93 Standard_EXPORT Handle(Poly_Polygon3D) Polygon3D (TopLoc_Location& l) const;
97 Standard_EXPORT static Standard_Boolean IsPlanarFace (const TopoDS_Face& theFace);
101 TopoDS_Shape myShape;
102 TopExp_Explorer myFaceExplorer;
103 TopTools_IndexedDataMapOfShapeListOfShape myEdgeMap;
104 TopTools_IndexedMapOfShape myVertexMap;
105 Standard_Integer myEdge;
106 Standard_Integer myVertex;
110 #endif // _StdPrs_ShapeTool_HeaderFile