0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / BRepAlgo / BRepAlgo_AsDes.hxx
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_AsDes_HeaderFile
18 #define _BRepAlgo_AsDes_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <TopTools_DataMapOfShapeListOfShape.hxx>
24 #include <Standard_Transient.hxx>
25 #include <TopTools_ListOfShape.hxx>
26 #include <Standard_Boolean.hxx>
27 class Standard_ConstructionError;
28 class TopoDS_Shape;
29
30
31 class BRepAlgo_AsDes;
32 DEFINE_STANDARD_HANDLE(BRepAlgo_AsDes, Standard_Transient)
33
34 //! SD to store descendants and ascendants of Shapes.
35 class BRepAlgo_AsDes : public Standard_Transient
36 {
37
38 public:
39
40   
41   //! Creates an empty AsDes.
42   Standard_EXPORT BRepAlgo_AsDes();
43   
44   Standard_EXPORT void Clear();
45   
46   //! Stores <SS> as a futur subshape of <S>.
47   Standard_EXPORT void Add (const TopoDS_Shape& S, const TopoDS_Shape& SS);
48   
49   //! Stores <SS> as futurs SubShapes of <S>.
50   Standard_EXPORT void Add (const TopoDS_Shape& S, const TopTools_ListOfShape& SS);
51   
52   Standard_EXPORT Standard_Boolean HasAscendant (const TopoDS_Shape& S) const;
53   
54   Standard_EXPORT Standard_Boolean HasDescendant (const TopoDS_Shape& S) const;
55   
56   //! Returns the Shape containing <S>.
57   Standard_EXPORT const TopTools_ListOfShape& Ascendant (const TopoDS_Shape& S) const;
58   
59   //! Returns futur subhapes of <S>.
60   Standard_EXPORT const TopTools_ListOfShape& Descendant (const TopoDS_Shape& S) const;
61   
62   //! Returns futur subhapes of <S>.
63   Standard_EXPORT TopTools_ListOfShape& ChangeDescendant (const TopoDS_Shape& S);
64   
65   //! Replace <OldS> by <NewS>.
66   //! <OldS> disapear from <me>.
67   Standard_EXPORT void Replace (const TopoDS_Shape& OldS, const TopoDS_Shape& NewS);
68   
69   //! Remove <S> from me.
70   Standard_EXPORT void Remove (const TopoDS_Shape& S);
71   
72   //! Returns  True if (S1> and <S2>  has  common
73   //! Descendants.  Stores in <LC> the Commons Descendants.
74   Standard_EXPORT Standard_Boolean HasCommonDescendant (const TopoDS_Shape& S1, const TopoDS_Shape& S2, TopTools_ListOfShape& LC) const;
75
76
77
78
79   DEFINE_STANDARD_RTTIEXT(BRepAlgo_AsDes,Standard_Transient)
80
81 protected:
82
83
84
85
86 private:
87
88   
89   //! Replace <OldS> by <NewS>.
90   //! <OldS> disapear from <me>.
91   Standard_EXPORT void BackReplace (const TopoDS_Shape& OldS, const TopoDS_Shape& NewS, const TopTools_ListOfShape& L, const Standard_Boolean InUp);
92
93   TopTools_DataMapOfShapeListOfShape up;
94   TopTools_DataMapOfShapeListOfShape down;
95
96
97 };
98
99
100
101
102
103
104
105 #endif // _BRepAlgo_AsDes_HeaderFile