Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:54

0001 // Created on: 1994-05-30
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1994-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_SelectPointed_HeaderFile
0018 #define _IFSelect_SelectPointed_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <IFSelect_SelectBase.hxx>
0024 #include <TColStd_HSequenceOfTransient.hxx>
0025 #include <Standard_Integer.hxx>
0026 class Standard_Transient;
0027 class Interface_CopyControl;
0028 class IFSelect_Transformer;
0029 class Interface_EntityIterator;
0030 class Interface_Graph;
0031 class TCollection_AsciiString;
0032 
0033 
0034 class IFSelect_SelectPointed;
0035 DEFINE_STANDARD_HANDLE(IFSelect_SelectPointed, IFSelect_SelectBase)
0036 
0037 //! This type of Selection is intended to describe a direct
0038 //! selection without an explicit criterium, for instance the
0039 //! result of picking viewed entities on a graphic screen
0040 //!
0041 //! It can also be used to provide a list as internal alternate
0042 //! input : this use implies to clear the list once queried
0043 class IFSelect_SelectPointed : public IFSelect_SelectBase
0044 {
0045 
0046 public:
0047 
0048   
0049   //! Creates a SelectPointed
0050   Standard_EXPORT IFSelect_SelectPointed();
0051   
0052   //! Clears the list of selected items
0053   //! Also says the list is unset
0054   //! All Add* methods and SetList say the list is set
0055   Standard_EXPORT void Clear();
0056   
0057   //! Tells if the list has been set. Even if empty
0058   Standard_EXPORT Standard_Boolean IsSet() const;
0059   
0060   //! As SetList but with only one entity
0061   //! If <ent> is Null, the list is said as being set but is empty
0062   Standard_EXPORT void SetEntity (const Handle(Standard_Transient)& item);
0063   
0064   //! Sets a given list to define the list of selected items
0065   //! <list> can be empty or null : in this case, the list is said
0066   //! as being set, but it is empty
0067   //!
0068   //! To use it as an alternate input, one shot :
0069   //! - SetList or SetEntity to define the input list
0070   //! - RootResult to get it
0071   //! - then Clear to drop it
0072   Standard_EXPORT void SetList (const Handle(TColStd_HSequenceOfTransient)& list);
0073   
0074   //! Adds an item. Returns True if Done, False if <item> is already
0075   //! in the selected list
0076   Standard_EXPORT Standard_Boolean Add (const Handle(Standard_Transient)& item);
0077   
0078   //! Removes an item. Returns True if Done, False if <item> was not
0079   //! in the selected list
0080   Standard_EXPORT Standard_Boolean Remove (const Handle(Standard_Transient)& item);
0081   
0082   //! Toggles status of an item : adds it if not pointed or removes
0083   //! it if already pointed. Returns the new status (Pointed or not)
0084   Standard_EXPORT Standard_Boolean Toggle (const Handle(Standard_Transient)& item);
0085   
0086   //! Adds all the items defined in a list. Returns True if at least
0087   //! one item has been added, False else
0088   Standard_EXPORT Standard_Boolean AddList (const Handle(TColStd_HSequenceOfTransient)& list);
0089   
0090   //! Removes all the items defined in a list. Returns True if at
0091   //! least one item has been removed, False else
0092   Standard_EXPORT Standard_Boolean RemoveList (const Handle(TColStd_HSequenceOfTransient)& list);
0093   
0094   //! Toggles status of all the items defined in a list : adds it if
0095   //! not pointed or removes it if already pointed.
0096   Standard_EXPORT Standard_Boolean ToggleList (const Handle(TColStd_HSequenceOfTransient)& list);
0097   
0098   //! Returns the rank of an item in the selected list, or 0.
0099   Standard_EXPORT Standard_Integer Rank (const Handle(Standard_Transient)& item) const;
0100   
0101   //! Returns the count of selected items
0102   Standard_EXPORT Standard_Integer NbItems() const;
0103   
0104   //! Returns an item given its rank, or a Null Handle
0105   Standard_EXPORT Handle(Standard_Transient) Item (const Standard_Integer num) const;
0106   
0107   //! Rebuilds the selected list. Any selected entity which has a
0108   //! bound result is replaced by this result, else it is removed.
0109   Standard_EXPORT void Update (const Handle(Interface_CopyControl)& control);
0110   
0111   //! Rebuilds the selected list, by querying a Transformer
0112   //! (same principle as from a CopyControl)
0113   Standard_EXPORT void Update (const Handle(IFSelect_Transformer)& trf);
0114   
0115   //! Returns the list of selected items. Only the selected entities
0116   //! which are present in the graph are given (this result assures
0117   //! uniqueness).
0118   Standard_EXPORT Interface_EntityIterator RootResult (const Interface_Graph& G) const Standard_OVERRIDE;
0119   
0120   //! Returns a text which identifies the type of selection made.
0121   //! It is "Pointed Entities"
0122   Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
0123 
0124 
0125 
0126 
0127   DEFINE_STANDARD_RTTIEXT(IFSelect_SelectPointed,IFSelect_SelectBase)
0128 
0129 protected:
0130 
0131 
0132 
0133 
0134 private:
0135 
0136 
0137   Standard_Boolean theset;
0138   TColStd_SequenceOfTransient theitems;
0139 
0140 
0141 };
0142 
0143 
0144 
0145 
0146 
0147 
0148 
0149 #endif // _IFSelect_SelectPointed_HeaderFile