0027783: Visualization, XCAFPrs_AISObject - override method SetMaterial()
[occt.git] / src / AIS / AIS_Selection.hxx
1 // Created on: 1995-03-21
2 // Created by: Jean-Louis Frenkel
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 _AIS_Selection_HeaderFile
18 #define _AIS_Selection_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <AIS_NListTransient.hxx>
24 #include <AIS_NListIteratorOfListTransient.hxx>
25 #include <AIS_NDataMapOfTransientIteratorOfListTransient.hxx>
26 #include <Standard_Integer.hxx>
27 #include <MMgt_TShared.hxx>
28 #include <Standard_CString.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <AIS_SelectStatus.hxx>
31 class Standard_NoSuchObject;
32 class Standard_MultiplyDefined;
33 class Standard_TypeMismatch;
34 class Standard_Transient;
35
36
37 class AIS_Selection;
38 DEFINE_STANDARD_HANDLE(AIS_Selection, MMgt_TShared)
39
40
41 class AIS_Selection : public MMgt_TShared
42 {
43
44 public:
45
46   
47   //! creates a new selection.
48
49   Standard_EXPORT AIS_Selection();
50   
51   //! removes all the object of the selection.
52   Standard_EXPORT void Select();
53   
54   //! if the object is not yet in the selection, it will be added.
55   //! if the object is already in the selection, it will be removed.
56   Standard_EXPORT AIS_SelectStatus Select (const Handle(Standard_Transient)& anObject);
57   
58   //! the object is always add int the selection.
59   //! faster when the number of objects selected is great.
60   Standard_EXPORT AIS_SelectStatus AddSelect (const Handle(Standard_Transient)& anObject);
61   
62   //! clears the selection and adds the object in the selection.
63   Standard_EXPORT void ClearAndSelect (const Handle(Standard_Transient)& anObject);
64
65   //! checks if the object is in the selection.
66   Standard_EXPORT Standard_Boolean IsSelected (const Handle(Standard_Transient)& anObject) const;
67   
68   //! returns the number of objects selected.
69   Standard_EXPORT Standard_Integer Extent() const;
70   
71   //! returns the single object selected.
72   //! Warning: raises TypeMismatch from Standard if Extent is not equal to 1.
73   Standard_EXPORT Handle(Standard_Transient) Single();
74   
75   void Init();
76   
77   Standard_Boolean More() const;
78   
79   void Next();
80   
81   const Handle(Standard_Transient)& Value() const;
82   
83   Standard_Integer NbStored() const;
84   
85   const AIS_NListTransient& Objects() const;
86
87   DEFINE_STANDARD_RTTIEXT(AIS_Selection,MMgt_TShared)
88
89 protected:
90
91
92
93
94 private:
95
96   AIS_NListTransient myresult;
97   AIS_NListIteratorOfListTransient myIterator;
98   AIS_NDataMapOfTransientIteratorOfListTransient myResultMap;
99   Standard_Integer myNb;
100
101
102 };
103
104
105 #include <AIS_Selection.lxx>
106
107
108
109
110
111 #endif // _AIS_Selection_HeaderFile