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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _TopOpeBRepDS_HDataStructure_HeaderFile
18 #define _TopOpeBRepDS_HDataStructure_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
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>
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;
46 class TopOpeBRepDS_HDataStructure;
47 DEFINE_STANDARD_HANDLE(TopOpeBRepDS_HDataStructure, Standard_Transient)
50 class TopOpeBRepDS_HDataStructure : public Standard_Transient
56 Standard_EXPORT TopOpeBRepDS_HDataStructure();
58 Standard_EXPORT void AddAncestors (const TopoDS_Shape& S);
60 //! Update the data structure with shapes of type T1
61 //! containing a subshape of type T2 which is stored
63 //! Used by the previous one.
64 Standard_EXPORT void AddAncestors (const TopoDS_Shape& S, const TopAbs_ShapeEnum T1, const TopAbs_ShapeEnum T2);
67 //! Check the integrity of the DS
68 Standard_EXPORT void ChkIntg();
70 Standard_EXPORT const TopOpeBRepDS_DataStructure& DS() const;
72 Standard_EXPORT TopOpeBRepDS_DataStructure& ChangeDS();
74 Standard_EXPORT Standard_Integer NbSurfaces() const;
76 Standard_EXPORT Standard_Integer NbCurves() const;
78 Standard_EXPORT Standard_Integer NbPoints() const;
80 //! Returns the surface of index <I>.
81 Standard_EXPORT const TopOpeBRepDS_Surface& Surface (const Standard_Integer I) const;
83 //! Returns an iterator on the curves on the surface
85 Standard_EXPORT TopOpeBRepDS_CurveIterator SurfaceCurves (const Standard_Integer I) const;
87 //! Returns the Curve of index <I>.
88 Standard_EXPORT const TopOpeBRepDS_Curve& Curve (const Standard_Integer I) const;
90 //! Returns the Curve of index <I>.
91 Standard_EXPORT TopOpeBRepDS_Curve& ChangeCurve (const Standard_Integer I);
93 //! Returns an iterator on the points on the curve
95 Standard_EXPORT TopOpeBRepDS_PointIterator CurvePoints (const Standard_Integer I) const;
97 //! Returns the point of index <I>.
98 Standard_EXPORT const TopOpeBRepDS_Point& Point (const Standard_Integer I) const;
100 Standard_EXPORT Standard_Integer NbShapes() const;
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;
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;
109 //! Returns True if <S> has new geometries.
110 Standard_EXPORT Standard_Boolean HasGeometry (const TopoDS_Shape& S) const;
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;
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;
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;
125 //! Returns orientation of shape <S> compared with its
127 Standard_EXPORT TopOpeBRepDS_Config SameDomainOrientation (const TopoDS_Shape& S) const;
129 //! Returns orientation of shape <S> compared with its
131 Standard_EXPORT Standard_Integer SameDomainReference (const TopoDS_Shape& S) const;
133 //! Returns an iterator on the surfaces attached to the
135 Standard_EXPORT TopOpeBRepDS_SurfaceIterator SolidSurfaces (const TopoDS_Shape& S) const;
137 //! Returns an iterator on the surfaces attached to the
139 Standard_EXPORT TopOpeBRepDS_SurfaceIterator SolidSurfaces (const Standard_Integer I) const;
141 //! Returns an iterator on the curves attached to the
143 Standard_EXPORT TopOpeBRepDS_CurveIterator FaceCurves (const TopoDS_Shape& F) const;
145 //! Returns an iterator on the curves attached to the
147 Standard_EXPORT TopOpeBRepDS_CurveIterator FaceCurves (const Standard_Integer I) const;
149 //! Returns an iterator on the points attached to the
151 Standard_EXPORT TopOpeBRepDS_PointIterator EdgePoints (const TopoDS_Shape& E) const;
153 Standard_EXPORT Standard_Integer MakeCurve (const TopOpeBRepDS_Curve& C1, TopOpeBRepDS_Curve& C2);
155 Standard_EXPORT void RemoveCurve (const Standard_Integer iC);
157 Standard_EXPORT Standard_Integer NbGeometry (const TopOpeBRepDS_Kind K) const;
159 Standard_EXPORT Standard_Integer NbTopology (const TopOpeBRepDS_Kind K) const;
161 Standard_EXPORT Standard_Integer NbTopology() const;
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;
167 Standard_EXPORT void SortOnParameter (const TopOpeBRepDS_ListOfInterference& L1, TopOpeBRepDS_ListOfInterference& L2) const;
169 Standard_EXPORT void SortOnParameter (TopOpeBRepDS_ListOfInterference& L) const;
171 Standard_EXPORT void MinMaxOnParameter (const TopOpeBRepDS_ListOfInterference& L, Standard_Real& Min, Standard_Real& Max) const;
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;
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;
190 //! Add interference <I> to list <LI>.
191 Standard_EXPORT void StoreInterference (const Handle(TopOpeBRepDS_Interference)& I, TopOpeBRepDS_ListOfInterference& LI, const TCollection_AsciiString& str = "");
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 = "");
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 = "");
201 Standard_EXPORT void StoreInterferences (const TopOpeBRepDS_ListOfInterference& LI, const TopoDS_Shape& S, const TCollection_AsciiString& str = "");
203 Standard_EXPORT void StoreInterferences (const TopOpeBRepDS_ListOfInterference& LI, const Standard_Integer IS, const TCollection_AsciiString& str = "");
205 Standard_EXPORT void ClearStoreInterferences (const TopOpeBRepDS_ListOfInterference& LI, const TopoDS_Shape& S, const TCollection_AsciiString& str = "");
207 Standard_EXPORT void ClearStoreInterferences (const TopOpeBRepDS_ListOfInterference& LI, const Standard_Integer IS, const TCollection_AsciiString& str = "");
212 DEFINE_STANDARD_RTTIEXT(TopOpeBRepDS_HDataStructure,Standard_Transient)
222 TopOpeBRepDS_DataStructure myDS;
233 #endif // _TopOpeBRepDS_HDataStructure_HeaderFile