00b3eef1127403441db3c2f7f09fd09d19f232b5
[occt.git] / src / BRepTools / BRepTools_WireExplorer.hxx
1 // Created on: 1993-01-21
2 // Created by: Remi LEQUETTE
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 _BRepTools_WireExplorer_HeaderFile
18 #define _BRepTools_WireExplorer_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TopTools_DataMapOfShapeListOfShape.hxx>
25 #include <TopoDS_Edge.hxx>
26 #include <TopoDS_Vertex.hxx>
27 #include <TopoDS_Face.hxx>
28 #include <TopTools_MapOfShape.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <Standard_Real.hxx>
31 #include <TopAbs_Orientation.hxx>
32 class Standard_DomainError;
33 class Standard_NoSuchObject;
34 class Standard_NoMoreObject;
35 class TopoDS_Wire;
36 class TopoDS_Face;
37 class TopoDS_Edge;
38 class TopoDS_Vertex;
39
40
41 //! The WireExplorer is a tool to explore the edges of
42 //! a wire in a connection order.
43 //!
44 //! i.e. each edge is connected to the previous one by
45 //! its origin.
46 //! If a wire is not closed returns only a segment of edges which
47 //! length depends on started in exploration edge. 
48 //! Algorithm suggests that wire is valid and has no any defects, which 
49 //! can stop edge exploration. Such defects can be loops, wrong orientation of edges
50 //! (two edges go in to shared vertex or go out from shared vertex), branching of edges, 
51 //! the presens of edges with INTERNAL or EXTERNAL orientation. If wire has
52 //! such kind of defects WireExplorer can return not all
53 //! edges in a wire. it depends on type of defect and position of starting edge.
54 class BRepTools_WireExplorer 
55 {
56 public:
57
58   DEFINE_STANDARD_ALLOC
59
60   
61   //! Constructs an empty explorer (which can be initialized using Init)
62   Standard_EXPORT BRepTools_WireExplorer();
63   
64   //! IInitializes an exploration  of the wire <W>.
65   Standard_EXPORT BRepTools_WireExplorer(const TopoDS_Wire& W);
66   
67   //! Initializes an exploration  of the wire <W>.
68   //! F is used to select the edge connected to the
69   //! previous in the parametric representation of <F>.
70   Standard_EXPORT BRepTools_WireExplorer(const TopoDS_Wire& W, const TopoDS_Face& F);
71   
72   //! Initializes an exploration of the wire <W>.
73   Standard_EXPORT void Init (const TopoDS_Wire& W);
74   
75   //! Initializes an exploration of the wire <W>.
76   //! F is used to select the edge connected to the
77   //! previous in the parametric representation of <F>.
78   Standard_EXPORT void Init (const TopoDS_Wire& W, const TopoDS_Face& F);
79   
80   //! Returns True if there  is a current  edge.
81   Standard_EXPORT Standard_Boolean More() const;
82   
83   //! Proceeds to the next edge.
84   Standard_EXPORT void Next();
85   
86   //! Returns the current edge.
87   Standard_EXPORT const TopoDS_Edge& Current() const;
88   
89   //! Returns an Orientation for the current edge.
90   Standard_EXPORT TopAbs_Orientation Orientation() const;
91   
92   //! Returns the vertex connecting the current  edge to
93   //! the previous one.
94   Standard_EXPORT const TopoDS_Vertex& CurrentVertex() const;
95   
96   //! Clears the content of the explorer.
97   Standard_EXPORT void Clear();
98
99
100
101
102 protected:
103
104
105
106
107
108 private:
109
110
111
112   TopTools_DataMapOfShapeListOfShape myMap;
113   TopoDS_Edge myEdge;
114   TopoDS_Vertex myVertex;
115   TopoDS_Face myFace;
116   TopTools_MapOfShape myDoubles;
117   Standard_Boolean myReverse;
118   Standard_Real myTolU;
119   Standard_Real myTolV;
120
121
122 };
123
124
125
126
127
128
129
130 #endif // _BRepTools_WireExplorer_HeaderFile