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 Interface_EntityIterator;
28 class Standard_Transient;
29 class Interface_Graph;
30 class TCollection_AsciiString;
33 class IFSelect_SelectAnyList;
34 DEFINE_STANDARD_HANDLE(IFSelect_SelectAnyList, IFSelect_SelectDeduct)
36 //! A SelectAnyList kind Selection selects a List of an Entity, as
37 //! well as this Entity contains some. A List contains sub-entities
38 //! as one per Item, or several (for instance if an Entity binds
39 //! couples of sub-entities, each item is one of these couples).
40 //! Remark that only Entities are taken into account (neither
41 //! Reals, nor Strings, etc...)
43 //! To define the list on which to work, SelectAnyList has two
44 //! deferred methods : NbItems (which gives the length of the
45 //! list), FillResult (which fills an EntityIterator). They are
46 //! intended to get a List in an Entity of the required Type (and
47 //! consider that list is empty if Entity has not required Type)
49 //! In addition, remark that some types of Entity define more than
50 //! one list in each instance : a given sub-class of SelectAnyList
51 //! must be attached to one list
53 //! SelectAnyList keeps or rejects a sub-set of the list,
54 //! that is the Items of which rank in the list is in a given
55 //! range (for instance form 2nd to 6th, etc...)
56 //! Range is defined by two Integer values. In order to allow
57 //! external control of them, these values are not directly
58 //! defined as fields, but accessed through IntParams, that is,
59 //! referenced as Transient (Handle) objects
61 //! Warning : the Input can be any kind of Selection, BUT its
62 //! RootResult must have zero (empty) or one Entity maximum
63 class IFSelect_SelectAnyList : public IFSelect_SelectDeduct
69 //! Keeps Input Entity, as having required type. It works by
70 //! keeping in <iter>, only suitable Entities (SelectType can be
71 //! used). Called by RootResult (which waits for ONE ENTITY MAX)
72 Standard_EXPORT virtual void KeepInputEntity (Interface_EntityIterator& iter) const = 0;
74 //! Returns count of Items in the list in the Entity <ent>
75 //! If <ent> has not required type, returned value must be Zero
76 Standard_EXPORT virtual Standard_Integer NbItems (const Handle(Standard_Transient)& ent) const = 0;
78 //! Sets a Range for numbers, with a lower and a upper limits
79 Standard_EXPORT void SetRange (const Handle(IFSelect_IntParam)& rankfrom, const Handle(IFSelect_IntParam)& rankto);
81 //! Sets a unique number (only one Entity will be sorted as True)
82 Standard_EXPORT void SetOne (const Handle(IFSelect_IntParam)& rank);
84 //! Sets a Lower limit but no upper limit
85 Standard_EXPORT void SetFrom (const Handle(IFSelect_IntParam)& rankfrom);
87 //! Sets an Upper limit but no lower limit (equivalent to lower 1)
88 Standard_EXPORT void SetUntil (const Handle(IFSelect_IntParam)& rankto);
90 //! Returns True if a Lower limit is defined
91 Standard_EXPORT Standard_Boolean HasLower() const;
93 //! Returns Lower limit (if there is; else, value is senseless)
94 Standard_EXPORT Handle(IFSelect_IntParam) Lower() const;
96 //! Returns Integer Value of Lower Limit (0 if none)
97 Standard_EXPORT Standard_Integer LowerValue() const;
99 //! Returns True if a Lower limit is defined
100 Standard_EXPORT Standard_Boolean HasUpper() const;
102 //! Returns Upper limit (if there is; else, value is senseless)
103 Standard_EXPORT Handle(IFSelect_IntParam) Upper() const;
105 //! Returns Integer Value of Upper Limit (0 if none)
106 Standard_EXPORT Standard_Integer UpperValue() const;
108 //! Returns the list of selected entities (list of entities
109 //! complying with rank criterium)
110 //! Error if the input list has more than one Item
111 Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
113 //! Puts into <res>, the sub-entities of the list, from n1 to
114 //! n2 included. Remark that adequation with Entity's type and
115 //! length of list has already been made at this stage
116 //! Called by RootResult
117 Standard_EXPORT virtual void FillResult (const Standard_Integer n1, const Standard_Integer n2, const Handle(Standard_Transient)& ent, Interface_EntityIterator& res) const = 0;
119 //! Returns a text defining the criterium : "Components of List "
120 //! then Specific List Label, then, following cases :
121 //! " From .. Until .." or "From .." or "Until .." or "Rank no .."
122 //! Specific type is given by deferred method ListLabel
123 Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
125 //! Returns the specific label for the list, which is included as
127 Standard_EXPORT virtual TCollection_AsciiString ListLabel() const = 0;
132 DEFINE_STANDARD_RTTIEXT(IFSelect_SelectAnyList,IFSelect_SelectDeduct)
142 Handle(IFSelect_IntParam) thelower;
143 Handle(IFSelect_IntParam) theupper;
154 #endif // _IFSelect_SelectAnyList_HeaderFile