42cf5bc1 |
1 | // Created on: 1995-10-26 |
2 | // Created by: Yves FRICAUD |
3 | // Copyright (c) 1995-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 _BRepAlgo_Image_HeaderFile |
18 | #define _BRepAlgo_Image_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <TopTools_ListOfShape.hxx> |
25 | #include <TopTools_DataMapOfShapeShape.hxx> |
26 | #include <TopTools_DataMapOfShapeListOfShape.hxx> |
27 | #include <Standard_Boolean.hxx> |
28 | #include <TopAbs_ShapeEnum.hxx> |
29 | class Standard_ConstructionError; |
30 | class TopoDS_Shape; |
31 | |
32 | |
33 | //! Stores link between a shape <S> and a shape <NewS> |
34 | //! obtained from <S>. <NewS> is an image of <S>. |
35 | class BRepAlgo_Image |
36 | { |
37 | public: |
38 | |
39 | DEFINE_STANDARD_ALLOC |
40 | |
41 | |
42 | Standard_EXPORT BRepAlgo_Image(); |
43 | |
44 | Standard_EXPORT void SetRoot (const TopoDS_Shape& S); |
45 | |
46 | //! Links <NewS> as image of <OldS>. |
47 | Standard_EXPORT void Bind (const TopoDS_Shape& OldS, const TopoDS_Shape& NewS); |
48 | |
49 | //! Links <NewS> as image of <OldS>. |
50 | Standard_EXPORT void Bind (const TopoDS_Shape& OldS, const TopTools_ListOfShape& NewS); |
51 | |
52 | //! Add <NewS> to the image of <OldS>. |
53 | Standard_EXPORT void Add (const TopoDS_Shape& OldS, const TopoDS_Shape& NewS); |
54 | |
55 | //! Add <NewS> to the image of <OldS>. |
56 | Standard_EXPORT void Add (const TopoDS_Shape& OldS, const TopTools_ListOfShape& NewS); |
57 | |
58 | Standard_EXPORT void Clear(); |
59 | |
60 | //! Remove <S> to set of images. |
61 | Standard_EXPORT void Remove (const TopoDS_Shape& S); |
62 | |
420b38fd |
63 | //! Removes the root <theRoot> from the list of roots and up and down maps. |
64 | Standard_EXPORT void RemoveRoot (const TopoDS_Shape& Root); |
65 | |
66 | //! Replaces the <OldRoot> with the <NewRoot>, so all images |
67 | //! of the <OldRoot> become the images of the <NewRoot>. |
68 | //! The <OldRoot> is removed. |
69 | Standard_EXPORT void ReplaceRoot (const TopoDS_Shape& OldRoot, const TopoDS_Shape& NewRoot); |
70 | |
42cf5bc1 |
71 | Standard_EXPORT const TopTools_ListOfShape& Roots() const; |
72 | |
73 | Standard_EXPORT Standard_Boolean IsImage (const TopoDS_Shape& S) const; |
74 | |
75 | //! Returns the generator of <S> |
76 | Standard_EXPORT const TopoDS_Shape& ImageFrom (const TopoDS_Shape& S) const; |
77 | |
78 | //! Returns the upper generator of <S> |
79 | Standard_EXPORT const TopoDS_Shape& Root (const TopoDS_Shape& S) const; |
80 | |
81 | Standard_EXPORT Standard_Boolean HasImage (const TopoDS_Shape& S) const; |
82 | |
83 | //! Returns the Image of <S>. |
84 | //! Returns <S> in the list if HasImage(S) is false. |
85 | Standard_EXPORT const TopTools_ListOfShape& Image (const TopoDS_Shape& S) const; |
86 | |
87 | //! Stores in <L> the images of images of...images of <S>. |
88 | //! <L> contains only <S> if HasImage(S) is false. |
89 | Standard_EXPORT void LastImage (const TopoDS_Shape& S, TopTools_ListOfShape& L) const; |
90 | |
91 | //! Keeps only the link between roots and lastimage. |
92 | Standard_EXPORT void Compact(); |
93 | |
94 | //! Deletes in the images the shape of type <ShapeType> |
95 | //! which are not in <S>. |
96 | //! Warning: Compact() must be call before. |
97 | Standard_EXPORT void Filter (const TopoDS_Shape& S, const TopAbs_ShapeEnum ShapeType); |
98 | |
99 | |
100 | |
101 | |
102 | protected: |
103 | |
104 | |
105 | |
106 | |
107 | |
108 | private: |
109 | |
110 | |
111 | |
112 | TopTools_ListOfShape roots; |
113 | TopTools_DataMapOfShapeShape up; |
114 | TopTools_DataMapOfShapeListOfShape down; |
115 | |
116 | |
117 | }; |
118 | |
119 | |
120 | |
121 | |
122 | |
123 | |
124 | |
125 | #endif // _BRepAlgo_Image_HeaderFile |