Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:16:43

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 <Standard_Transient.hxx>
0025 #include <NCollection_Sequence.hxx>
0026 #include <NCollection_HSequence.hxx>
0027 #include <Standard_Integer.hxx>
0028 class Standard_Transient;
0029 class Interface_CopyControl;
0030 class IFSelect_Transformer;
0031 class Interface_EntityIterator;
0032 class Interface_Graph;
0033 class TCollection_AsciiString;
0034 
0035 //! This type of Selection is intended to describe a direct
0036 //! selection without an explicit criterium, for instance the
0037 //! result of picking viewed entities on a graphic screen
0038 //!
0039 //! It can also be used to provide a list as internal alternate
0040 //! input : this use implies to clear the list once queried
0041 class IFSelect_SelectPointed : public IFSelect_SelectBase
0042 {
0043 
0044 public:
0045   //! Creates a SelectPointed
0046   Standard_EXPORT IFSelect_SelectPointed();
0047 
0048   //! Clears the list of selected items
0049   //! Also says the list is unset
0050   //! All Add* methods and SetList say the list is set
0051   Standard_EXPORT void Clear();
0052 
0053   //! Tells if the list has been set. Even if empty
0054   Standard_EXPORT bool IsSet() const;
0055 
0056   //! As SetList but with only one entity
0057   //! If <ent> is Null, the list is said as being set but is empty
0058   Standard_EXPORT void SetEntity(const occ::handle<Standard_Transient>& item);
0059 
0060   //! Sets a given list to define the list of selected items
0061   //! <list> can be empty or null : in this case, the list is said
0062   //! as being set, but it is empty
0063   //!
0064   //! To use it as an alternate input, one shot :
0065   //! - SetList or SetEntity to define the input list
0066   //! - RootResult to get it
0067   //! - then Clear to drop it
0068   Standard_EXPORT void SetList(
0069     const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& list);
0070 
0071   //! Adds an item. Returns True if Done, False if <item> is already
0072   //! in the selected list
0073   Standard_EXPORT bool Add(const occ::handle<Standard_Transient>& item);
0074 
0075   //! Removes an item. Returns True if Done, False if <item> was not
0076   //! in the selected list
0077   Standard_EXPORT bool Remove(const occ::handle<Standard_Transient>& item);
0078 
0079   //! Toggles status of an item : adds it if not pointed or removes
0080   //! it if already pointed. Returns the new status (Pointed or not)
0081   Standard_EXPORT bool Toggle(const occ::handle<Standard_Transient>& item);
0082 
0083   //! Adds all the items defined in a list. Returns True if at least
0084   //! one item has been added, False else
0085   Standard_EXPORT bool AddList(
0086     const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& list);
0087 
0088   //! Removes all the items defined in a list. Returns True if at
0089   //! least one item has been removed, False else
0090   Standard_EXPORT bool RemoveList(
0091     const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& list);
0092 
0093   //! Toggles status of all the items defined in a list : adds it if
0094   //! not pointed or removes it if already pointed.
0095   Standard_EXPORT bool ToggleList(
0096     const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& list);
0097 
0098   //! Returns the rank of an item in the selected list, or 0.
0099   Standard_EXPORT int Rank(const occ::handle<Standard_Transient>& item) const;
0100 
0101   //! Returns the count of selected items
0102   Standard_EXPORT int NbItems() const;
0103 
0104   //! Returns an item given its rank, or a Null Handle
0105   Standard_EXPORT occ::handle<Standard_Transient> Item(const int 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 occ::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 occ::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 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 override;
0123 
0124   DEFINE_STANDARD_RTTIEXT(IFSelect_SelectPointed, IFSelect_SelectBase)
0125 
0126 private:
0127   bool                                                  theset;
0128   NCollection_Sequence<occ::handle<Standard_Transient>> theitems;
0129 };
0130 
0131 #endif // _IFSelect_SelectPointed_HeaderFile