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
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 _IFSelect_SelectAnyList_HeaderFile
18 #define _IFSelect_SelectAnyList_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
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;
35 class IFSelect_SelectAnyList;
36 DEFINE_STANDARD_HANDLE(IFSelect_SelectAnyList, IFSelect_SelectDeduct)
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...)
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)
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
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
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
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;
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;
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);
83 //! Sets a unique number (only one Entity will be sorted as True)
84 Standard_EXPORT void SetOne (const Handle(IFSelect_IntParam)& rank);
86 //! Sets a Lower limit but no upper limit
87 Standard_EXPORT void SetFrom (const Handle(IFSelect_IntParam)& rankfrom);
89 //! Sets an Upper limit but no lower limit (equivalent to lower 1)
90 Standard_EXPORT void SetUntil (const Handle(IFSelect_IntParam)& rankto);
92 //! Returns True if a Lower limit is defined
93 Standard_EXPORT Standard_Boolean HasLower() const;
95 //! Returns Lower limit (if there is; else, value is senseless)
96 Standard_EXPORT Handle(IFSelect_IntParam) Lower() const;
98 //! Returns Integer Value of Lower Limit (0 if none)
99 Standard_EXPORT Standard_Integer LowerValue() const;
101 //! Returns True if a Lower limit is defined
102 Standard_EXPORT Standard_Boolean HasUpper() const;
104 //! Returns Upper limit (if there is; else, value is senseless)
105 Standard_EXPORT Handle(IFSelect_IntParam) Upper() const;
107 //! Returns Integer Value of Upper Limit (0 if none)
108 Standard_EXPORT Standard_Integer UpperValue() const;
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;
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;
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;
127 //! Returns the specific label for the list, which is included as
129 Standard_EXPORT virtual TCollection_AsciiString ListLabel() const = 0;
134 DEFINE_STANDARD_RTTI(IFSelect_SelectAnyList,IFSelect_SelectDeduct)
144 Handle(IFSelect_IntParam) thelower;
145 Handle(IFSelect_IntParam) theupper;
156 #endif // _IFSelect_SelectAnyList_HeaderFile