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
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 _BRepAlgo_Image_HeaderFile
18 #define _BRepAlgo_Image_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
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;
33 //! Stores link between a shape <S> and a shape <NewS>
34 //! obtained from <S>. <NewS> is an image of <S>.
42 Standard_EXPORT BRepAlgo_Image();
44 Standard_EXPORT void SetRoot (const TopoDS_Shape& S);
46 //! Links <NewS> as image of <OldS>.
47 Standard_EXPORT void Bind (const TopoDS_Shape& OldS, const TopoDS_Shape& NewS);
49 //! Links <NewS> as image of <OldS>.
50 Standard_EXPORT void Bind (const TopoDS_Shape& OldS, const TopTools_ListOfShape& NewS);
52 //! Add <NewS> to the image of <OldS>.
53 Standard_EXPORT void Add (const TopoDS_Shape& OldS, const TopoDS_Shape& NewS);
55 //! Add <NewS> to the image of <OldS>.
56 Standard_EXPORT void Add (const TopoDS_Shape& OldS, const TopTools_ListOfShape& NewS);
58 Standard_EXPORT void Clear();
60 //! Remove <S> to set of images.
61 Standard_EXPORT void Remove (const TopoDS_Shape& S);
63 //! Removes the root <theRoot> from the list of roots and up and down maps.
64 Standard_EXPORT void RemoveRoot (const TopoDS_Shape& Root);
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);
71 Standard_EXPORT const TopTools_ListOfShape& Roots() const;
73 Standard_EXPORT Standard_Boolean IsImage (const TopoDS_Shape& S) const;
75 //! Returns the generator of <S>
76 Standard_EXPORT const TopoDS_Shape& ImageFrom (const TopoDS_Shape& S) const;
78 //! Returns the upper generator of <S>
79 Standard_EXPORT const TopoDS_Shape& Root (const TopoDS_Shape& S) const;
81 Standard_EXPORT Standard_Boolean HasImage (const TopoDS_Shape& S) const;
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;
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;
91 //! Keeps only the link between roots and lastimage.
92 Standard_EXPORT void Compact();
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);
112 TopTools_ListOfShape roots;
113 TopTools_DataMapOfShapeShape up;
114 TopTools_DataMapOfShapeListOfShape down;
125 #endif // _BRepAlgo_Image_HeaderFile