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
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 _AIS_Selection_HeaderFile
18 #define _AIS_Selection_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
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;
38 DEFINE_STANDARD_HANDLE(AIS_Selection, MMgt_TShared)
41 class AIS_Selection : public MMgt_TShared
47 //! creates a new selection.
49 Standard_EXPORT AIS_Selection();
51 //! removes all the object of the selection.
52 Standard_EXPORT void Select();
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);
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);
62 //! clears the selection and adds the object in the selection.
63 Standard_EXPORT void ClearAndSelect (const Handle(Standard_Transient)& anObject);
65 //! checks if the object is in the selection.
66 Standard_EXPORT Standard_Boolean IsSelected (const Handle(Standard_Transient)& anObject) const;
68 //! returns the number of objects selected.
69 Standard_EXPORT Standard_Integer Extent() const;
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();
77 Standard_Boolean More() const;
81 const Handle(Standard_Transient)& Value() const;
83 Standard_Integer NbStored() const;
85 const AIS_NListTransient& Objects() const;
87 DEFINE_STANDARD_RTTIEXT(AIS_Selection,MMgt_TShared)
96 AIS_NListTransient myresult;
97 AIS_NListIteratorOfListTransient myIterator;
98 AIS_NDataMapOfTransientIteratorOfListTransient myResultMap;
99 Standard_Integer myNb;
105 #include <AIS_Selection.lxx>
111 #endif // _AIS_Selection_HeaderFile