42cf5bc1 |
1 | // Created on: 1994-05-30 |
2 | // Created by: Christian CAILLET |
3 | // Copyright (c) 1994-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 _IFSelect_SelectPointed_HeaderFile |
18 | #define _IFSelect_SelectPointed_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Boolean.hxx> |
24 | #include <TColStd_SequenceOfTransient.hxx> |
25 | #include <IFSelect_SelectBase.hxx> |
26 | #include <TColStd_HSequenceOfTransient.hxx> |
27 | #include <Standard_Integer.hxx> |
28 | class Interface_InterfaceError; |
29 | class Standard_Transient; |
30 | class Interface_CopyControl; |
31 | class IFSelect_Transformer; |
32 | class Interface_EntityIterator; |
33 | class Interface_Graph; |
34 | class TCollection_AsciiString; |
35 | |
36 | |
37 | class IFSelect_SelectPointed; |
38 | DEFINE_STANDARD_HANDLE(IFSelect_SelectPointed, IFSelect_SelectBase) |
39 | |
40 | //! This type of Selection is intended to describe a direct |
41 | //! selection without an explicit criterium, for instance the |
42 | //! result of picking viewed entities on a graphic screen |
43 | //! |
44 | //! It can also be used to provide a list as internal alternate |
45 | //! input : this use implies to clear the list once queried |
46 | class IFSelect_SelectPointed : public IFSelect_SelectBase |
47 | { |
48 | |
49 | public: |
50 | |
51 | |
52 | //! Creates a SelectPointed |
53 | Standard_EXPORT IFSelect_SelectPointed(); |
54 | |
55 | //! Clears the list of selected items |
56 | //! Also says the list is unset |
57 | //! All Add* methods and SetList say the list is set |
58 | Standard_EXPORT void Clear(); |
59 | |
60 | //! Tells if the list has been set. Even if empty |
61 | Standard_EXPORT Standard_Boolean IsSet() const; |
62 | |
63 | //! As SetList but with only one entity |
64 | //! If <ent> is Null, the list is said as being set but is empty |
65 | Standard_EXPORT void SetEntity (const Handle(Standard_Transient)& item); |
66 | |
67 | //! Sets a given list to define the list of selected items |
68 | //! <list> can be empty or null : in this case, the list is said |
69 | //! as being set, but it is empty |
70 | //! |
71 | //! To use it as an alternate input, one shot : |
72 | //! - SetList or SetEntity to define the input list |
73 | //! - RootResult to get it |
74 | //! - then Clear to drop it |
75 | Standard_EXPORT void SetList (const Handle(TColStd_HSequenceOfTransient)& list); |
76 | |
77 | //! Adds an item. Returns True if Done, False if <item> is already |
78 | //! in the selected list |
79 | Standard_EXPORT Standard_Boolean Add (const Handle(Standard_Transient)& item); |
80 | |
81 | //! Removes an item. Returns True if Done, False if <item> was not |
82 | //! in the selected list |
83 | Standard_EXPORT Standard_Boolean Remove (const Handle(Standard_Transient)& item); |
84 | |
85 | //! Toggles status of an item : adds it if not pointed or removes |
86 | //! it if already pointed. Returns the new status (Pointed or not) |
87 | Standard_EXPORT Standard_Boolean Toggle (const Handle(Standard_Transient)& item); |
88 | |
89 | //! Adds all the items defined in a list. Returns True if at least |
90 | //! one item has been added, False else |
91 | Standard_EXPORT Standard_Boolean AddList (const Handle(TColStd_HSequenceOfTransient)& list); |
92 | |
93 | //! Removes all the items defined in a list. Returns True if at |
94 | //! least one item has been removed, False else |
95 | Standard_EXPORT Standard_Boolean RemoveList (const Handle(TColStd_HSequenceOfTransient)& list); |
96 | |
97 | //! Toggles status of all the items defined in a list : adds it if |
98 | //! not pointed or removes it if already pointed. |
99 | Standard_EXPORT Standard_Boolean ToggleList (const Handle(TColStd_HSequenceOfTransient)& list); |
100 | |
101 | //! Returns the rank of an item in the selected list, or 0. |
102 | Standard_EXPORT Standard_Integer Rank (const Handle(Standard_Transient)& item) const; |
103 | |
104 | //! Returns the count of selected items |
105 | Standard_EXPORT Standard_Integer NbItems() const; |
106 | |
107 | //! Returns an item given its rank, or a Null Handle |
108 | Standard_EXPORT Handle(Standard_Transient) Item (const Standard_Integer num) const; |
109 | |
110 | //! Rebuilds the selected list. Any selected entity which has a |
111 | //! bound result is replaced by this result, else it is removed. |
112 | Standard_EXPORT void Update (const Handle(Interface_CopyControl)& control); |
113 | |
114 | //! Rebuilds the selected list, by querying a Transformer |
115 | //! (same principle as from a CopyControl) |
116 | Standard_EXPORT void Update (const Handle(IFSelect_Transformer)& trf); |
117 | |
118 | //! Returns the list of selected items. Only the selected entities |
119 | //! which are present in the graph are given (this result assures |
120 | //! uniqueness). |
79104795 |
121 | Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE; |
42cf5bc1 |
122 | |
123 | //! Returns a text which identifies the type of selection made. |
124 | //! It is "Pointed Entities" |
79104795 |
125 | Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE; |
42cf5bc1 |
126 | |
127 | |
128 | |
129 | |
92efcf78 |
130 | DEFINE_STANDARD_RTTIEXT(IFSelect_SelectPointed,IFSelect_SelectBase) |
42cf5bc1 |
131 | |
132 | protected: |
133 | |
134 | |
135 | |
136 | |
137 | private: |
138 | |
139 | |
140 | Standard_Boolean theset; |
141 | TColStd_SequenceOfTransient theitems; |
142 | |
143 | |
144 | }; |
145 | |
146 | |
147 | |
148 | |
149 | |
150 | |
151 | |
152 | #endif // _IFSelect_SelectPointed_HeaderFile |