SHAPER  9.12.0
Model_AttributeSelectionList.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef Model_AttributeSelectionList_H_
21 #define Model_AttributeSelectionList_H_
22 
23 #include "Model.h"
24 #include "Model_AttributeSelection.h"
25 #include <ModelAPI_AttributeSelectionList.h>
26 #include <TDataStd_Integer.hxx>
27 #include <TDataStd_Comment.hxx>
28 #include <vector>
29 #include <map>
30 
38 {
39  TDF_Label myLab;
40  Handle(TDataStd_Integer) mySize;
42  Handle(TDataStd_Comment) mySelectionType;
43  std::shared_ptr<Model_AttributeSelection> myTmpAttr;
45  std::map<ObjectPtr, std::list<std::shared_ptr<GeomAPI_Shape> > > myCash;
46  bool myIsCashed;
47 public:
53  MODEL_EXPORT virtual void append(
54  const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
55  const bool theTemporarily = false);
56 
59  MODEL_EXPORT virtual void append(const std::wstring& theNamingName,
60  const std::string& theType="");
61 
63  MODEL_EXPORT virtual void append(const std::shared_ptr<GeomAPI_Pnt>& thePoint,
64  const std::string& theType);
65 
67  MODEL_EXPORT virtual void append(const std::string& theType,
68  const std::wstring& theContextName,
69  const int theIndex);
70 
72  MODEL_EXPORT virtual void copyTo(AttributeSelectionListPtr theTarget) const;
73 
75  virtual void removeTemporaryValues();
76 
78  MODEL_EXPORT virtual void removeLast();
79 
82  MODEL_EXPORT virtual void remove(const std::set<int>& theIndices);
83 
85  MODEL_EXPORT virtual int size();
86 
92  MODEL_EXPORT virtual bool isInList(
93  const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
94  const bool theTemporarily = false);
95 
98  MODEL_EXPORT virtual const std::string selectionType() const;
99 
102  MODEL_EXPORT virtual void setSelectionType(const std::string& theType);
103 
105  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex);
106 
108  MODEL_EXPORT virtual void clear();
109 
111  MODEL_EXPORT virtual bool isInitialized();
112 
116  MODEL_EXPORT virtual void cashValues(const bool theEnabled);
117 
118  MODEL_EXPORT virtual void setGeometricalSelection(const bool theIsGeometricalSelection) override;
119 
121  MODEL_EXPORT virtual bool isGeometricalSelection() const override;
122 
124  MODEL_EXPORT virtual FiltersFeaturePtr filters() const;
125 
127  MODEL_EXPORT virtual void setFilters(FiltersFeaturePtr theFeature);
128 
129 protected:
131  MODEL_EXPORT Model_AttributeSelectionList(TDF_Label& theLabel);
133  virtual void reinit();
134 
138 
139  friend class Model_Data;
140  friend class Model_AttributeSelection;
141 };
142 
143 #endif
Attribute that contains list of references to the sub-shapes with possibility to manage them.
Definition: ModelAPI_AttributeSelectionList.h:37
Attribute that contains list of references to the sub-shapes with possibility to manage them.
Definition: Model_AttributeSelectionList.h:38
virtual void clear()
Returns all attributes.
Definition: Model_AttributeSelectionList.cpp:389
bool merge(Model_AttributeSelection *theStart)
Tries to merge attributes in this list with the same result shape.
virtual int size()
Returns the number of selection attributes in the list.
Definition: Model_AttributeSelectionList.cpp:282
virtual FiltersFeaturePtr filters() const
Returns a selection filters feature if it is defined for this selection list.
Definition: Model_AttributeSelectionList.cpp:509
virtual bool isInList(const ObjectPtr &theContext, const std::shared_ptr< GeomAPI_Shape > &theSubShape, const bool theTemporarily=false)
Returns true if the object with the shape are in list.
Definition: Model_AttributeSelectionList.cpp:302
virtual void setSelectionType(const std::string &theType)
Sets the type of all elements selection.
Definition: Model_AttributeSelectionList.cpp:364
virtual void removeLast()
Removes the last element in the list.
Definition: Model_AttributeSelectionList.cpp:150
virtual void copyTo(AttributeSelectionListPtr theTarget) const
Copy the selection list to the destination attribute.
Definition: Model_AttributeSelectionList.cpp:272
virtual void reinit()
Reinitializes the internal state of the attribute (may be needed on undo/redo, abort,...
Definition: Model_AttributeSelectionList.cpp:425
virtual void setFilters(FiltersFeaturePtr theFeature)
Sets a selection filters feature if it is defined for this selection list.
Definition: Model_AttributeSelectionList.cpp:532
virtual void remove(const std::set< int > &theIndices)
Removes the elements from the list.
Definition: Model_AttributeSelectionList.cpp:241
virtual void removeTemporaryValues()
Reset temporary stored values.
Definition: Model_AttributeSelectionList.cpp:143
virtual void append(const ObjectPtr &theContext, const std::shared_ptr< GeomAPI_Shape > &theSubShape, const bool theTemporarily=false)
Adds the new reference to the end of the list.
Definition: Model_AttributeSelectionList.cpp:55
virtual std::shared_ptr< ModelAPI_AttributeSelection > value(const int theIndex)
Returns the attribute selection by the index (zero based)
Definition: Model_AttributeSelectionList.cpp:370
virtual void cashValues(const bool theEnabled)
Starts or stops cashing of the values in the attribute (the cash may become invalid on modification o...
Definition: Model_AttributeSelectionList.cpp:438
virtual bool isGeometricalSelection() const override
Returns true if is geometrical selection.
Definition: Model_AttributeSelectionList.cpp:453
Model_AttributeSelectionList(TDF_Label &theLabel)
Objects are created for features automatically.
Definition: Model_AttributeSelectionList.cpp:419
virtual bool isInitialized()
Returns true if attribute was initialized by some value.
Definition: Model_AttributeSelectionList.cpp:411
virtual const std::string selectionType() const
The type of all elements selection.
Definition: Model_AttributeSelectionList.cpp:359
Attribute that contains reference to the sub-shape of some result, the selected shape.
Definition: Model_AttributeSelection.h:40
General object of the application that allows to get/set attributes from the document and compute res...
Definition: Model_Data.h:61