0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / BRepAlgo / BRepAlgo_Image.hxx
CommitLineData
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>
29class Standard_ConstructionError;
30class 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>.
35class BRepAlgo_Image
36{
37public:
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
63 Standard_EXPORT const TopTools_ListOfShape& Roots() const;
64
65 Standard_EXPORT Standard_Boolean IsImage (const TopoDS_Shape& S) const;
66
67 //! Returns the generator of <S>
68 Standard_EXPORT const TopoDS_Shape& ImageFrom (const TopoDS_Shape& S) const;
69
70 //! Returns the upper generator of <S>
71 Standard_EXPORT const TopoDS_Shape& Root (const TopoDS_Shape& S) const;
72
73 Standard_EXPORT Standard_Boolean HasImage (const TopoDS_Shape& S) const;
74
75 //! Returns the Image of <S>.
76 //! Returns <S> in the list if HasImage(S) is false.
77 Standard_EXPORT const TopTools_ListOfShape& Image (const TopoDS_Shape& S) const;
78
79 //! Stores in <L> the images of images of...images of <S>.
80 //! <L> contains only <S> if HasImage(S) is false.
81 Standard_EXPORT void LastImage (const TopoDS_Shape& S, TopTools_ListOfShape& L) const;
82
83 //! Keeps only the link between roots and lastimage.
84 Standard_EXPORT void Compact();
85
86 //! Deletes in the images the shape of type <ShapeType>
87 //! which are not in <S>.
88 //! Warning: Compact() must be call before.
89 Standard_EXPORT void Filter (const TopoDS_Shape& S, const TopAbs_ShapeEnum ShapeType);
90
91
92
93
94protected:
95
96
97
98
99
100private:
101
102
103
104 TopTools_ListOfShape roots;
105 TopTools_DataMapOfShapeShape up;
106 TopTools_DataMapOfShapeListOfShape down;
107
108
109};
110
111
112
113
114
115
116
117#endif // _BRepAlgo_Image_HeaderFile