Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:00

0001 // Created on: 1993-01-27
0002 // Created by: Jean-Louis Frenkel
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
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 //! Describes the behaviour requested for a wireframe shape presentation.
0034 class StdPrs_ShapeTool
0035 {
0036 public:
0037   DEFINE_STANDARD_ALLOC
0038 
0039   //! Constructs the tool and initializes it using theShape and theAllVertices
0040   //! (optional) arguments. By default, only isolated and internal vertices are considered,
0041   //! however if theAllVertices argument is equal to True, all shape's vertices are taken into account.
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 // _StdPrs_ShapeTool_HeaderFile