File indexing completed on 2025-01-18 10:05:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _StdPrs_ShapeTool_HeaderFile
0018 #define _StdPrs_ShapeTool_HeaderFile
0019
0020 #include <TopoDS.hxx>
0021 #include <TopoDS_Edge.hxx>
0022 #include <TopoDS_Shape.hxx>
0023 #include <TopExp_Explorer.hxx>
0024 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
0025 #include <TopTools_IndexedMapOfShape.hxx>
0026 #include <TopTools_HSequenceOfShape.hxx>
0027
0028 class Bnd_Box;
0029 class Poly_Triangulation;
0030 class Poly_PolygonOnTriangulation;
0031 class Poly_Polygon3D;
0032
0033
0034 class StdPrs_ShapeTool
0035 {
0036 public:
0037 DEFINE_STANDARD_ALLOC
0038
0039
0040
0041
0042 Standard_EXPORT StdPrs_ShapeTool (const TopoDS_Shape& theShape, const Standard_Boolean theAllVertices = Standard_False);
0043
0044 void InitFace() { myFaceExplorer.Init(myShape,TopAbs_FACE); }
0045
0046 Standard_Boolean MoreFace() const { return myFaceExplorer.More(); }
0047
0048 void NextFace() { myFaceExplorer.Next(); }
0049
0050 const TopoDS_Face& GetFace() const { return TopoDS::Face(myFaceExplorer.Current()); }
0051
0052 Standard_EXPORT Bnd_Box FaceBound() const;
0053
0054 Standard_Boolean IsPlanarFace() const
0055 {
0056 const TopoDS_Face& aFace = TopoDS::Face (myFaceExplorer.Current());
0057 return IsPlanarFace (aFace);
0058 }
0059
0060 void InitCurve() { myEdge = 1; }
0061
0062 Standard_Boolean MoreCurve() const { return myEdge <= myEdgeMap.Extent(); }
0063
0064 void NextCurve() { ++myEdge; }
0065
0066 const TopoDS_Edge& GetCurve() const { return TopoDS::Edge(myEdgeMap.FindKey(myEdge)); }
0067
0068 Standard_EXPORT Bnd_Box CurveBound() const;
0069
0070 Standard_EXPORT Standard_Integer Neighbours() const;
0071
0072 Standard_EXPORT Handle(TopTools_HSequenceOfShape) FacesOfEdge() const;
0073
0074 void InitVertex() { myVertex = 1; }
0075
0076 Standard_Boolean MoreVertex() const { return myVertex <= myVertexMap.Extent(); }
0077
0078 void NextVertex() { ++myVertex; }
0079
0080 const TopoDS_Vertex& GetVertex() const { return TopoDS::Vertex (myVertexMap.FindKey(myVertex)); }
0081
0082 Standard_EXPORT Standard_Boolean HasSurface() const;
0083
0084 Standard_EXPORT Handle(Poly_Triangulation) CurrentTriangulation (TopLoc_Location& l) const;
0085
0086 Standard_EXPORT Standard_Boolean HasCurve() const;
0087
0088 Standard_EXPORT void PolygonOnTriangulation (Handle(Poly_PolygonOnTriangulation)& Indices, Handle(Poly_Triangulation)& T, TopLoc_Location& l) const;
0089
0090 Standard_EXPORT Handle(Poly_Polygon3D) Polygon3D (TopLoc_Location& l) const;
0091
0092 public:
0093
0094 Standard_EXPORT static Standard_Boolean IsPlanarFace (const TopoDS_Face& theFace);
0095
0096 private:
0097
0098 TopoDS_Shape myShape;
0099 TopExp_Explorer myFaceExplorer;
0100 TopTools_IndexedDataMapOfShapeListOfShape myEdgeMap;
0101 TopTools_IndexedMapOfShape myVertexMap;
0102 Standard_Integer myEdge;
0103 Standard_Integer myVertex;
0104
0105 };
0106
0107 #endif