1 // Created on: 1993-06-17
2 // Created by: Jean Yves LEBEY
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 _TopOpeBRepDS_HDataStructure_HeaderFile
18 #define _TopOpeBRepDS_HDataStructure_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22 
23 #include <TopOpeBRepDS_DataStructure.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <TCollection_AsciiString.hxx>
26 #include <Standard_Transient.hxx>
27 #include <TopAbs_ShapeEnum.hxx>
28 #include <Standard_Integer.hxx>
29 #include <TopTools_ListIteratorOfListOfShape.hxx>
30 #include <TopOpeBRepDS_Config.hxx>
31 #include <TopOpeBRepDS_Kind.hxx>
32 #include <TopOpeBRepDS_ListOfInterference.hxx>
33 #include <Standard_Real.hxx>
34 #include <TopOpeBRepDS_ListIteratorOfListOfInterference.hxx>
35 class TopoDS_Shape;
36 class TopOpeBRepDS_DataStructure;
37 class TopOpeBRepDS_Surface;
38 class TopOpeBRepDS_CurveIterator;
39 class TopOpeBRepDS_Curve;
40 class TopOpeBRepDS_PointIterator;
41 class TopOpeBRepDS_Point;
42 class TopOpeBRepDS_SurfaceIterator;
43 class TopOpeBRepDS_Interference;
44 
45 
46 class TopOpeBRepDS_HDataStructure;
47 DEFINE_STANDARD_HANDLE(TopOpeBRepDS_HDataStructure, Standard_Transient)
48 
49 
50 class TopOpeBRepDS_HDataStructure : public Standard_Transient
51 {
52 
53 public:
54 
55 
56   Standard_EXPORT TopOpeBRepDS_HDataStructure();
57 
58   Standard_EXPORT void AddAncestors (const TopoDS_Shape& S);
59 
60   //! Update  the data structure with  shapes of type T1
61   //! containing a subshape of type T2 which is stored
62   //! in the DS.
63   //! Used by the previous one.
64   Standard_EXPORT void AddAncestors (const TopoDS_Shape& S, const TopAbs_ShapeEnum T1, const TopAbs_ShapeEnum T2);
65 
66 
67   //! Check the integrity of the DS
68   Standard_EXPORT void ChkIntg();
69 
70   Standard_EXPORT const TopOpeBRepDS_DataStructure& DS() const;
71 
72   Standard_EXPORT TopOpeBRepDS_DataStructure& ChangeDS();
73 
74   Standard_EXPORT Standard_Integer NbSurfaces() const;
75 
76   Standard_EXPORT Standard_Integer NbCurves() const;
77 
78   Standard_EXPORT Standard_Integer NbPoints() const;
79 
80   //! Returns the surface of index <I>.
81   Standard_EXPORT const TopOpeBRepDS_Surface& Surface (const Standard_Integer I) const;
82 
83   //! Returns an iterator  on the curves on  the surface
84   //! <I>.
85   Standard_EXPORT TopOpeBRepDS_CurveIterator SurfaceCurves (const Standard_Integer I) const;
86 
87   //! Returns the Curve of index <I>.
88   Standard_EXPORT const TopOpeBRepDS_Curve& Curve (const Standard_Integer I) const;
89 
90   //! Returns the Curve of index <I>.
91   Standard_EXPORT TopOpeBRepDS_Curve& ChangeCurve (const Standard_Integer I);
92 
93   //! Returns an iterator   on the points on  the  curve
94   //! <I>.
95   Standard_EXPORT TopOpeBRepDS_PointIterator CurvePoints (const Standard_Integer I) const;
96 
97   //! Returns the point of index <I>.
98   Standard_EXPORT const TopOpeBRepDS_Point& Point (const Standard_Integer I) const;
99 
100   Standard_EXPORT Standard_Integer NbShapes() const;
101 
102   //! Returns the shape of index <I> in the DS
103   Standard_EXPORT const TopoDS_Shape& Shape (const Standard_Integer I, const Standard_Boolean FindKeep = Standard_True) const;
104 
105   //! Returns the index of shape <S> in the DS
106   //! returns 0 if <S> is not in the DS
107   Standard_EXPORT Standard_Integer Shape (const TopoDS_Shape& S, const Standard_Boolean FindKeep = Standard_True) const;
108 
109   //! Returns True if <S> has new geometries.
110   Standard_EXPORT Standard_Boolean HasGeometry (const TopoDS_Shape& S) const;
111 
112   //! Returns True if <S> has new geometries (SOLID,FACE,EDGE)
113   //! or if <S> (SHELL,WIRE) has sub-shape (FACE,EDGE)
114   //! with new geometries
115   Standard_EXPORT Standard_Boolean HasShape (const TopoDS_Shape& S, const Standard_Boolean FindKeep = Standard_True) const;
116 
117   //! Returns True if <S> share a geometrical domain with
118   //! some other shapes.
119   Standard_EXPORT Standard_Boolean HasSameDomain (const TopoDS_Shape& S, const Standard_Boolean FindKeep = Standard_True) const;
120 
121   //! Returns an iterator on the SameDomain shapes attached
122   //! to the shape <S>.
123   Standard_EXPORT TopTools_ListIteratorOfListOfShape SameDomain (const TopoDS_Shape& S) const;
124 
125   //! Returns orientation of shape <S> compared with its
126   //! reference shape
127   Standard_EXPORT TopOpeBRepDS_Config SameDomainOrientation (const TopoDS_Shape& S) const;
128 
129   //! Returns orientation of shape <S> compared with its
130   //! reference shape
131   Standard_EXPORT Standard_Integer SameDomainReference (const TopoDS_Shape& S) const;
132 
133   //! Returns an iterator on the  surfaces attached to the
134   //! solid <S>.
135   Standard_EXPORT TopOpeBRepDS_SurfaceIterator SolidSurfaces (const TopoDS_Shape& S) const;
136 
137   //! Returns an iterator on the  surfaces attached to the
138   //! solid <I>.
139   Standard_EXPORT TopOpeBRepDS_SurfaceIterator SolidSurfaces (const Standard_Integer I) const;
140 
141   //! Returns an iterator on the  curves attached to the
142   //! face <F>.
143   Standard_EXPORT TopOpeBRepDS_CurveIterator FaceCurves (const TopoDS_Shape& F) const;
144 
145   //! Returns an iterator on the  curves attached to the
146   //! face <I>.
147   Standard_EXPORT TopOpeBRepDS_CurveIterator FaceCurves (const Standard_Integer I) const;
148 
149   //! Returns an iterator on the points  attached to the
150   //! edge <E>.
151   Standard_EXPORT TopOpeBRepDS_PointIterator EdgePoints (const TopoDS_Shape& E) const;
152 
153   Standard_EXPORT Standard_Integer MakeCurve (const TopOpeBRepDS_Curve& C1, TopOpeBRepDS_Curve& C2);
154 
155   Standard_EXPORT void RemoveCurve (const Standard_Integer iC);
156 
157   Standard_EXPORT Standard_Integer NbGeometry (const TopOpeBRepDS_Kind K) const;
158 
159   Standard_EXPORT Standard_Integer NbTopology (const TopOpeBRepDS_Kind K) const;
160 
161   Standard_EXPORT Standard_Integer NbTopology() const;
162 
163   //! returns True if all the edges stored as shapes in the DS
164   //! are SameParameter, otherwise False.
165   Standard_EXPORT Standard_Boolean EdgesSameParameter() const;
166 
167   Standard_EXPORT void SortOnParameter (const TopOpeBRepDS_ListOfInterference& L1, TopOpeBRepDS_ListOfInterference& L2) const;
168 
169   Standard_EXPORT void SortOnParameter (TopOpeBRepDS_ListOfInterference& L) const;
170 
171   Standard_EXPORT void MinMaxOnParameter (const TopOpeBRepDS_ListOfInterference& L, Standard_Real& Min, Standard_Real& Max) const;
172 
173 
174   //! Search, among a list of interferences accessed by the iterator
175   //! <IT>, a geometry <G> whose 3D point is identical to the 3D point
176   //! of the TheDSPoint <PDS>.
177   //! returns True if such an interference has been found, False else.
178   //! if True, iterator It points (by the Value() method) on the first
179   //! interference accessing an identical 3D point.
180   Standard_EXPORT Standard_Boolean ScanInterfList (TopOpeBRepDS_ListIteratorOfListOfInterference& IT, const TopOpeBRepDS_Point& PDS) const;
181 
182 
183   //! Get the geometry of a DS point <PDS>.
184   //! Search for it with ScanInterfList (previous method).
185   //! if found, set <G,K> to the geometry,kind of the interference found.
186   //! returns the value of ScanInterfList().
187   Standard_EXPORT Standard_Boolean GetGeometry (TopOpeBRepDS_ListIteratorOfListOfInterference& IT, const TopOpeBRepDS_Point& PDS, Standard_Integer& G, TopOpeBRepDS_Kind& K) const;
188 
189 
190   //! Add interference <I> to list <LI>.
191   Standard_EXPORT void StoreInterference (const Handle(TopOpeBRepDS_Interference)& I, TopOpeBRepDS_ListOfInterference& LI, const TCollection_AsciiString& str = "");
192 
193 
194   //! Add interference <I> to list of interference of shape <S>.
195   Standard_EXPORT void StoreInterference (const Handle(TopOpeBRepDS_Interference)& I, const TopoDS_Shape& S, const TCollection_AsciiString& str = "");
196 
197 
198   //! Add interference <I> to list of interference of shape <IS>.
199   Standard_EXPORT void StoreInterference (const Handle(TopOpeBRepDS_Interference)& I, const Standard_Integer IS, const TCollection_AsciiString& str = "");
200 
201   Standard_EXPORT void StoreInterferences (const TopOpeBRepDS_ListOfInterference& LI, const TopoDS_Shape& S, const TCollection_AsciiString& str = "");
202 
203   Standard_EXPORT void StoreInterferences (const TopOpeBRepDS_ListOfInterference& LI, const Standard_Integer IS, const TCollection_AsciiString& str = "");
204 
205   Standard_EXPORT void ClearStoreInterferences (const TopOpeBRepDS_ListOfInterference& LI, const TopoDS_Shape& S, const TCollection_AsciiString& str = "");
206 
207   Standard_EXPORT void ClearStoreInterferences (const TopOpeBRepDS_ListOfInterference& LI, const Standard_Integer IS, const TCollection_AsciiString& str = "");
208 
209 
210 
211 
212   DEFINE_STANDARD_RTTIEXT(TopOpeBRepDS_HDataStructure,Standard_Transient)
213 
214 protected:
215 
216 
217 
218 
219 private:
220 
221 
222   TopOpeBRepDS_DataStructure myDS;
223 
224 
225 };
226 
227 
228 
229 
230 
231 
232 
233 #endif // _TopOpeBRepDS_HDataStructure_HeaderFile
234