Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-10 09:17:03

0001 // Created on: 1992-12-09
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _IFSelect_SelectAnyList_HeaderFile
0018 #define _IFSelect_SelectAnyList_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <IFSelect_SelectDeduct.hxx>
0024 #include <Standard_Integer.hxx>
0025 class IFSelect_IntParam;
0026 class Interface_EntityIterator;
0027 class Standard_Transient;
0028 class Interface_Graph;
0029 class TCollection_AsciiString;
0030 
0031 class IFSelect_SelectAnyList;
0032 DEFINE_STANDARD_HANDLE(IFSelect_SelectAnyList, IFSelect_SelectDeduct)
0033 
0034 //! A SelectAnyList kind Selection selects a List of an Entity, as
0035 //! well as this Entity contains some. A List contains sub-entities
0036 //! as one per Item, or several (for instance if an Entity binds
0037 //! couples of sub-entities, each item is one of these couples).
0038 //! Remark that only Entities are taken into account (neither
0039 //! Reals, nor Strings, etc...)
0040 //!
0041 //! To define the list on which to work, SelectAnyList has two
0042 //! deferred methods : NbItems (which gives the length of the
0043 //! list), FillResult (which fills an EntityIterator). They are
0044 //! intended to get a List in an Entity of the required Type (and
0045 //! consider that list is empty if Entity has not required Type)
0046 //!
0047 //! In addition, remark that some types of Entity define more than
0048 //! one list in each instance : a given sub-class of SelectAnyList
0049 //! must be attached to one list
0050 //!
0051 //! SelectAnyList keeps or rejects a sub-set of the list,
0052 //! that is the Items of which rank in the list is in a given
0053 //! range (for instance form 2nd to 6th, etc...)
0054 //! Range is defined by two Integer values. In order to allow
0055 //! external control of them, these values are not directly
0056 //! defined as fields, but accessed through IntParams, that is,
0057 //! referenced as Transient (Handle) objects
0058 //!
0059 //! Warning : the Input can be any kind of Selection, BUT its
0060 //! RootResult must have zero (empty) or one Entity maximum
0061 class IFSelect_SelectAnyList : public IFSelect_SelectDeduct
0062 {
0063 
0064 public:
0065   //! Keeps Input Entity, as having required type. It works by
0066   //! keeping in <iter>, only suitable Entities (SelectType can be
0067   //! used). Called by RootResult (which waits for ONE ENTITY MAX)
0068   Standard_EXPORT virtual void KeepInputEntity(Interface_EntityIterator& iter) const = 0;
0069 
0070   //! Returns count of Items in the list in the Entity <ent>
0071   //! If <ent> has not required type, returned value must be Zero
0072   Standard_EXPORT virtual Standard_Integer NbItems(const Handle(Standard_Transient)& ent) const = 0;
0073 
0074   //! Sets a Range for numbers, with a lower and a upper limits
0075   Standard_EXPORT void SetRange(const Handle(IFSelect_IntParam)& rankfrom,
0076                                 const Handle(IFSelect_IntParam)& rankto);
0077 
0078   //! Sets a unique number (only one Entity will be sorted as True)
0079   Standard_EXPORT void SetOne(const Handle(IFSelect_IntParam)& rank);
0080 
0081   //! Sets a Lower limit but no upper limit
0082   Standard_EXPORT void SetFrom(const Handle(IFSelect_IntParam)& rankfrom);
0083 
0084   //! Sets an Upper limit but no lower limit (equivalent to lower 1)
0085   Standard_EXPORT void SetUntil(const Handle(IFSelect_IntParam)& rankto);
0086 
0087   //! Returns True if a Lower limit is defined
0088   Standard_EXPORT Standard_Boolean HasLower() const;
0089 
0090   //! Returns Lower limit (if there is; else, value is senseless)
0091   Standard_EXPORT Handle(IFSelect_IntParam) Lower() const;
0092 
0093   //! Returns Integer Value of Lower Limit (0 if none)
0094   Standard_EXPORT Standard_Integer LowerValue() const;
0095 
0096   //! Returns True if a Lower limit is defined
0097   Standard_EXPORT Standard_Boolean HasUpper() const;
0098 
0099   //! Returns Upper limit (if there is; else, value is senseless)
0100   Standard_EXPORT Handle(IFSelect_IntParam) Upper() const;
0101 
0102   //! Returns Integer Value of Upper Limit (0 if none)
0103   Standard_EXPORT Standard_Integer UpperValue() const;
0104 
0105   //! Returns the list of selected entities (list of entities
0106   //! complying with rank criterium)
0107   //! Error if the input list has more than one Item
0108   Standard_EXPORT Interface_EntityIterator
0109     RootResult(const Interface_Graph& G) const Standard_OVERRIDE;
0110 
0111   //! Puts into <res>, the sub-entities of the list, from n1 to
0112   //! n2 included. Remark that adequation with Entity's type and
0113   //! length of list has already been made at this stage
0114   //! Called by RootResult
0115   Standard_EXPORT virtual void FillResult(const Standard_Integer            n1,
0116                                           const Standard_Integer            n2,
0117                                           const Handle(Standard_Transient)& ent,
0118                                           Interface_EntityIterator&         res) const = 0;
0119 
0120   //! Returns a text defining the criterium : "Components of List "
0121   //! then Specific List Label, then, following cases :
0122   //! " From .. Until .." or "From .." or "Until .." or "Rank no .."
0123   //! Specific type is given by deferred method ListLabel
0124   Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
0125 
0126   //! Returns the specific label for the list, which is included as
0127   //! a part of Label
0128   Standard_EXPORT virtual TCollection_AsciiString ListLabel() const = 0;
0129 
0130   DEFINE_STANDARD_RTTIEXT(IFSelect_SelectAnyList, IFSelect_SelectDeduct)
0131 
0132 protected:
0133 private:
0134   Handle(IFSelect_IntParam) thelower;
0135   Handle(IFSelect_IntParam) theupper;
0136 };
0137 
0138 #endif // _IFSelect_SelectAnyList_HeaderFile