SHAPER 9.16.0
Model_AttributeSelectionList.h
1// Copyright (C) 2014-2026 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;
47public:
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 const bool theIsIgnoreGroups = false);
66
68 MODEL_EXPORT virtual void append(const std::string& theType,
69 const std::wstring& theContextName,
70 const int theIndex);
71
73 MODEL_EXPORT virtual void copyTo(AttributeSelectionListPtr theTarget) const;
74
76 virtual void removeTemporaryValues();
77
79 MODEL_EXPORT virtual void removeLast();
80
83 MODEL_EXPORT virtual void remove(const std::set<int>& theIndices);
84
86 MODEL_EXPORT virtual int size();
87
93 MODEL_EXPORT virtual bool isInList(
94 const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
95 const bool theTemporarily = false);
96
99 MODEL_EXPORT virtual const std::string selectionType() const;
100
103 MODEL_EXPORT virtual void setSelectionType(const std::string& theType);
104
106 MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex);
107
109 MODEL_EXPORT virtual void clear();
110
112 MODEL_EXPORT virtual bool isInitialized();
113
117 MODEL_EXPORT virtual void cashValues(const bool theEnabled);
118
119 MODEL_EXPORT virtual void setGeometricalSelection(const bool theIsGeometricalSelection) override;
120
122 MODEL_EXPORT virtual bool isGeometricalSelection() const override;
123
125 MODEL_EXPORT virtual FiltersFeaturePtr filters() const;
126
128 MODEL_EXPORT virtual void setFilters(FiltersFeaturePtr theFeature);
129
131 MODEL_EXPORT virtual void applyFilters();
132
134 MODEL_EXPORT virtual void removeFilters();
135
136protected:
138 MODEL_EXPORT Model_AttributeSelectionList(TDF_Label& theLabel);
140 virtual void reinit();
141
145
146 friend class Model_Data;
147 friend class Model_AttributeSelection;
148};
149
150#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:397
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:290
virtual FiltersFeaturePtr filters() const
Returns a selection filters feature if it is defined for this selection list.
Definition: Model_AttributeSelectionList.cpp:517
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:310
virtual void setSelectionType(const std::string &theType)
Sets the type of all elements selection.
Definition: Model_AttributeSelectionList.cpp:372
virtual void applyFilters()
Applies the filters to this selection list.
Definition: Model_AttributeSelectionList.cpp:558
virtual void removeLast()
Removes the last element in the list.
Definition: Model_AttributeSelectionList.cpp:158
virtual void removeFilters()
Removes the filters of this selection list.
Definition: Model_AttributeSelectionList.cpp:586
virtual void copyTo(AttributeSelectionListPtr theTarget) const
Copy the selection list to the destination attribute.
Definition: Model_AttributeSelectionList.cpp:280
virtual void reinit()
Reinitializes the internal state of the attribute (may be needed on undo/redo, abort,...
Definition: Model_AttributeSelectionList.cpp:433
virtual void setFilters(FiltersFeaturePtr theFeature)
Sets a selection filters feature if it is defined for this selection list.
Definition: Model_AttributeSelectionList.cpp:540
virtual void remove(const std::set< int > &theIndices)
Removes the elements from the list.
Definition: Model_AttributeSelectionList.cpp:249
virtual void removeTemporaryValues()
Reset temporary stored values.
Definition: Model_AttributeSelectionList.cpp:151
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:61
virtual std::shared_ptr< ModelAPI_AttributeSelection > value(const int theIndex)
Returns the attribute selection by the index (zero based)
Definition: Model_AttributeSelectionList.cpp:378
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:446
virtual bool isGeometricalSelection() const override
Returns true if is geometrical selection.
Definition: Model_AttributeSelectionList.cpp:461
Model_AttributeSelectionList(TDF_Label &theLabel)
Objects are created for features automatically.
Definition: Model_AttributeSelectionList.cpp:427
virtual bool isInitialized()
Returns true if attribute was initialized by some value.
Definition: Model_AttributeSelectionList.cpp:419
virtual const std::string selectionType() const
The type of all elements selection.
Definition: Model_AttributeSelectionList.cpp:367
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:62