0026886: Visualization, TKV3d - eliminate global variables
[occt.git] / src / AIS / AIS_Selection.hxx
CommitLineData
42cf5bc1 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
42cf5bc1 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>
31class Standard_NoSuchObject;
32class Standard_MultiplyDefined;
33class Standard_TypeMismatch;
34class Standard_Transient;
35
36
37class AIS_Selection;
38DEFINE_STANDARD_HANDLE(AIS_Selection, MMgt_TShared)
39
40
41class AIS_Selection : public MMgt_TShared
42{
43
44public:
45
46
016e5959 47 //! creates a new selection.
48
49 Standard_EXPORT AIS_Selection();
42cf5bc1 50
016e5959 51 //! removes all the object of the selection.
52 Standard_EXPORT void Select();
42cf5bc1 53
016e5959 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);
42cf5bc1 57
58 //! the object is always add int the selection.
59 //! faster when the number of objects selected is great.
016e5959 60 Standard_EXPORT AIS_SelectStatus AddSelect (const Handle(Standard_Transient)& anObject);
42cf5bc1 61
62 //! clears the selection and adds the object in the selection.
016e5959 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;
42cf5bc1 67
68 //! returns the number of objects selected.
016e5959 69 Standard_EXPORT Standard_Integer Extent() const;
42cf5bc1 70
71 //! returns the single object selected.
72 //! Warning: raises TypeMismatch from Standard if Extent is not equal to 1.
016e5959 73 Standard_EXPORT Handle(Standard_Transient) Single();
42cf5bc1 74
016e5959 75 void Init();
42cf5bc1 76
016e5959 77 Standard_Boolean More() const;
42cf5bc1 78
016e5959 79 void Next();
42cf5bc1 80
016e5959 81 const Handle(Standard_Transient)& Value() const;
42cf5bc1 82
016e5959 83 Standard_Integer NbStored() const;
42cf5bc1 84
016e5959 85 const AIS_NListTransient& Objects() const;
42cf5bc1 86
92efcf78 87 DEFINE_STANDARD_RTTIEXT(AIS_Selection,MMgt_TShared)
42cf5bc1 88
89protected:
90
91
92
93
94private:
95
42cf5bc1 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