0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / IFSelect / IFSelect_SelectAnyList.hxx
1 // Created on: 1992-12-09
2 // Created by: Christian CAILLET
3 // Copyright (c) 1992-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_SelectAnyList_HeaderFile
18 #define _IFSelect_SelectAnyList_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <IFSelect_SelectDeduct.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 class IFSelect_IntParam;
27 class Standard_OutOfRange;
28 class Interface_InterfaceError;
29 class Interface_EntityIterator;
30 class Standard_Transient;
31 class Interface_Graph;
32 class TCollection_AsciiString;
33
34
35 class IFSelect_SelectAnyList;
36 DEFINE_STANDARD_HANDLE(IFSelect_SelectAnyList, IFSelect_SelectDeduct)
37
38 //! A SelectAnyList kind Selection selects a List of an Entity, as
39 //! well as this Entity contains some. A List contains sub-entities
40 //! as one per Item, or several (for instance if an Entity binds
41 //! couples of sub-entities, each item is one of these couples).
42 //! Remark that only Entities are taken into account (neither
43 //! Reals, nor Strings, etc...)
44 //!
45 //! To define the list on which to work, SelectAnyList has two
46 //! deferred methods : NbItems (which gives the length of the
47 //! list), FillResult (which fills an EntityIterator). They are
48 //! intended to get a List in an Entity of the required Type (and
49 //! consider that list is empty if Entity has not required Type)
50 //!
51 //! In addition, remark that some types of Entity define more than
52 //! one list in each instance : a given sub-class of SelectAnyList
53 //! must be attached to one list
54 //!
55 //! SelectAnyList keeps or rejects a sub-set of the list,
56 //! that is the Items of which rank in the list is in a given
57 //! range (for instance form 2nd to 6th, etc...)
58 //! Range is defined by two Integer values. In order to allow
59 //! external control of them, these values are not directly
60 //! defined as fields, but accessed through IntParams, that is,
61 //! referenced as Transient (Handle) objects
62 //!
63 //! Warning : the Input can be any kind of Selection, BUT its
64 //! RootResult must have zero (empty) or one Entity maximum
65 class IFSelect_SelectAnyList : public IFSelect_SelectDeduct
66 {
67
68 public:
69
70   
71   //! Keeps Input Entity, as having required type. It works by
72   //! keeping in <iter>, only suitable Entities (SelectType can be
73   //! used). Called by RootResult (which waits for ONE ENTITY MAX)
74   Standard_EXPORT virtual void KeepInputEntity (Interface_EntityIterator& iter) const = 0;
75   
76   //! Returns count of Items in the list in the Entity <ent>
77   //! If <ent> has not required type, returned value must be Zero
78   Standard_EXPORT virtual Standard_Integer NbItems (const Handle(Standard_Transient)& ent) const = 0;
79   
80   //! Sets a Range for numbers, with a lower and a upper limits
81   Standard_EXPORT void SetRange (const Handle(IFSelect_IntParam)& rankfrom, const Handle(IFSelect_IntParam)& rankto);
82   
83   //! Sets a unique number (only one Entity will be sorted as True)
84   Standard_EXPORT void SetOne (const Handle(IFSelect_IntParam)& rank);
85   
86   //! Sets a Lower limit but no upper limit
87   Standard_EXPORT void SetFrom (const Handle(IFSelect_IntParam)& rankfrom);
88   
89   //! Sets an Upper limit but no lower limit (equivalent to lower 1)
90   Standard_EXPORT void SetUntil (const Handle(IFSelect_IntParam)& rankto);
91   
92   //! Returns True if a Lower limit is defined
93   Standard_EXPORT Standard_Boolean HasLower() const;
94   
95   //! Returns Lower limit (if there is; else, value is senseless)
96   Standard_EXPORT Handle(IFSelect_IntParam) Lower() const;
97   
98   //! Returns Integer Value of Lower Limit (0 if none)
99   Standard_EXPORT Standard_Integer LowerValue() const;
100   
101   //! Returns True if a Lower limit is defined
102   Standard_EXPORT Standard_Boolean HasUpper() const;
103   
104   //! Returns Upper limit (if there is; else, value is senseless)
105   Standard_EXPORT Handle(IFSelect_IntParam) Upper() const;
106   
107   //! Returns Integer Value of Upper Limit (0 if none)
108   Standard_EXPORT Standard_Integer UpperValue() const;
109   
110   //! Returns the list of selected entities (list of entities
111   //! complying with rank criterium)
112   //! Error if the input list has more than one Item
113   Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
114   
115   //! Puts into <res>, the sub-entities of the list, from n1 to
116   //! n2 included. Remark that adequation with Entity's type and
117   //! length of list has already been made at this stage
118   //! Called by RootResult
119   Standard_EXPORT virtual void FillResult (const Standard_Integer n1, const Standard_Integer n2, const Handle(Standard_Transient)& ent, Interface_EntityIterator& res) const = 0;
120   
121   //! Returns a text defining the criterium : "Componants of List "
122   //! then Specific List Label, then, following cases :
123   //! " From .. Until .." or "From .." or "Until .." or "Rank no .."
124   //! Specific type is given by deferred method ListLabel
125   Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
126   
127   //! Returns the specific label for the list, which is included as
128   //! a part of Label
129   Standard_EXPORT virtual TCollection_AsciiString ListLabel() const = 0;
130
131
132
133
134   DEFINE_STANDARD_RTTIEXT(IFSelect_SelectAnyList,IFSelect_SelectDeduct)
135
136 protected:
137
138
139
140
141 private:
142
143
144   Handle(IFSelect_IntParam) thelower;
145   Handle(IFSelect_IntParam) theupper;
146
147
148 };
149
150
151
152
153
154
155
156 #endif // _IFSelect_SelectAnyList_HeaderFile