0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / TopExp / TopExp.hxx
1 // Created on: 1990-12-20
2 // Created by: Remi Lequette
3 // Copyright (c) 1990-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 _TopExp_HeaderFile
18 #define _TopExp_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TopAbs_ShapeEnum.hxx>
25 #include <TopTools_IndexedMapOfShape.hxx>
26 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
27 #include <TopTools_MapOfShape.hxx>
28 #include <Standard_Boolean.hxx>
29 class TopoDS_Shape;
30 class TopoDS_Vertex;
31 class TopoDS_Edge;
32 class TopoDS_Wire;
33 class TopExp_Explorer;
34
35
36 //! This package   provides  basic tools  to   explore the
37 //! topological data structures.
38 //!
39 //! * Explorer : A tool to find all sub-shapes of  a given
40 //! type. e.g. all faces of a solid.
41 //!
42 //! * Package methods to map sub-shapes of a shape.
43 //!
44 //! Level : Public
45 //! All methods of all  classes will be public.
46 class TopExp 
47 {
48 public:
49
50   DEFINE_STANDARD_ALLOC
51
52   
53   //! Tool to explore a topological data structure.
54   //! Stores in the map <M> all  the sub-shapes of <S>
55   //! of type <T>.
56   //!
57   //! Warning: The map is not cleared at first.
58   Standard_EXPORT static void MapShapes (const TopoDS_Shape& S, const TopAbs_ShapeEnum T, TopTools_IndexedMapOfShape& M);
59   
60   //! Stores in the map <M> all  the sub-shapes of <S>.
61   Standard_EXPORT static void MapShapes (const TopoDS_Shape& S, TopTools_IndexedMapOfShape& M);
62
63   //! Stores in the map <M> all  the sub-shapes of <S>.
64   Standard_EXPORT static void MapShapes (const TopoDS_Shape& S, TopTools_MapOfShape& M);
65
66   //! Stores in the map <M> all the subshape of <S> of
67   //! type <TS>  for each one append  to  the list all
68   //! the ancestors of type <TA>.  For example map all
69   //! the edges and bind the list of faces.
70   //! Warning: The map is not cleared at first.
71   Standard_EXPORT static void MapShapesAndAncestors (const TopoDS_Shape& S, const TopAbs_ShapeEnum TS, const TopAbs_ShapeEnum TA, TopTools_IndexedDataMapOfShapeListOfShape& M);
72   
73   //! Stores in the map <M> all the subshape of <S> of
74   //! type <TS> for each one append to the list all
75   //! unique ancestors of type <TA>.  For example map all
76   //! the edges and bind the list of faces.
77   //! useOrientation = True : taking account the ancestor orientation
78   //! Warning: The map is not cleared at first.
79   Standard_EXPORT static void MapShapesAndUniqueAncestors (const TopoDS_Shape& S, const TopAbs_ShapeEnum TS, const TopAbs_ShapeEnum TA, TopTools_IndexedDataMapOfShapeListOfShape& M,
80                                                            const Standard_Boolean useOrientation = Standard_False);
81
82   //! Returns the Vertex of orientation FORWARD in E. If
83   //! there is none returns a Null Shape.
84   //! CumOri = True : taking account the edge orientation
85   Standard_EXPORT static TopoDS_Vertex FirstVertex (const TopoDS_Edge& E, const Standard_Boolean CumOri = Standard_False);
86   
87   //! Returns the Vertex of orientation REVERSED in E. If
88   //! there is none returns a Null Shape.
89   //! CumOri = True : taking account the edge orientation
90   Standard_EXPORT static TopoDS_Vertex LastVertex (const TopoDS_Edge& E, const Standard_Boolean CumOri = Standard_False);
91   
92   //! Returns in Vfirst, Vlast the  FORWARD and REVERSED
93   //! vertices of the edge <E>. May be null shapes.
94   //! CumOri = True : taking account the edge orientation
95   Standard_EXPORT static void Vertices (const TopoDS_Edge& E, TopoDS_Vertex& Vfirst, TopoDS_Vertex& Vlast, const Standard_Boolean CumOri = Standard_False);
96   
97   //! Returns  in  Vfirst,  Vlast   the first   and last
98   //! vertices of the open wire <W>. May be null shapes.
99   //! if   <W>  is closed Vfirst and Vlast  are a same
100   //! vertex on <W>.
101   //! if <W> is no manifold. VFirst and VLast are null
102   //! shapes.
103   Standard_EXPORT static void Vertices (const TopoDS_Wire& W, TopoDS_Vertex& Vfirst, TopoDS_Vertex& Vlast);
104   
105   //! Finds   the  vertex <V> common   to  the two edges
106   //! <E1,E2>, returns True if this vertex exists.
107   //!
108   //! Warning: <V> has sense only if the value <True> is returned
109   Standard_EXPORT static Standard_Boolean CommonVertex (const TopoDS_Edge& E1, const TopoDS_Edge& E2, TopoDS_Vertex& V);
110
111
112
113
114 protected:
115
116
117
118
119
120 private:
121
122
123
124
125 friend class TopExp_Explorer;
126
127 };
128
129
130
131
132
133
134
135 #endif // _TopExp_HeaderFile