SHAPER 9.16.0
ModelAPI_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 ModelAPI_AttributeSelectionList_H_
21#define ModelAPI_AttributeSelectionList_H_
22
23#include "ModelAPI_AttributeSelection.h"
24#include <ModelAPI_Result.h>
25#include <ModelAPI_Filter.h>
26
27class GeomAPI_Pnt;
28class GeomAPI_Shape;
29
37{
41 bool myIsWholeResultAllowed;
44 bool myMakeCopy;
45public:
51 virtual void append(const ObjectPtr& theContext,
52 const std::shared_ptr<GeomAPI_Shape>& theSubShape,
53 const bool theTemporarily = false) = 0;
54
57 virtual void append(const std::wstring& theNamingName, const std::string& theType = "") = 0;
58
60 virtual void append(const std::shared_ptr<GeomAPI_Pnt>& thePoint,
61 const std::string& theType,
62 const bool theIsIgnoreGroups = false) = 0;
63
65 virtual void append(const std::string& theType, const std::wstring& theContextName,
66 const int theIndex) = 0;
67
69 virtual void copyTo(std::shared_ptr<ModelAPI_AttributeSelectionList> theTarget) const = 0;
70
72 virtual void removeTemporaryValues() = 0;
73
75 virtual void removeLast() = 0;
76
79 virtual void remove(const std::set<int>& theIndices) = 0;
80
82 virtual int size() = 0;
83
89 virtual bool isInList(
90 const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
91 const bool theTemporarily = false) = 0;
92
95 virtual const std::string selectionType() const = 0;
96
99 virtual void setSelectionType(const std::string& theType) = 0;
100
102 virtual std::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex) = 0;
103
105 virtual void clear() = 0;
106
110 virtual void cashValues(const bool theEnabled) = 0;
111
112 virtual void setGeometricalSelection(const bool theIsGeometricalSelection) = 0;
113
115 virtual bool isGeometricalSelection() const = 0;
116
118 static std::string typeId()
119 {
120 return "SelectionList";
121 }
122
124 MODELAPI_EXPORT virtual std::string attributeType();
125
127 MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelectionList();
128
130 MODELAPI_EXPORT virtual FiltersFeaturePtr filters() const = 0;
131
133 MODELAPI_EXPORT virtual void setFilters(FiltersFeaturePtr theFeature) = 0;
134
136 MODELAPI_EXPORT virtual void applyFilters() = 0;
137
139 MODELAPI_EXPORT virtual void removeFilters() = 0;
140
142 MODELAPI_EXPORT virtual const bool isWholeResultAllowed() const {
143 return myIsWholeResultAllowed;
144 }
145
147 MODELAPI_EXPORT virtual void setWholeResultAllowed(const bool theFlag) {
148 myIsWholeResultAllowed = theFlag;
149 }
150
152 MODELAPI_EXPORT virtual const bool isMakeCopy() const {
153 return myMakeCopy;
154 }
155
157 MODELAPI_EXPORT virtual void setMakeCopy(const bool theFlag) {
158 myMakeCopy = theFlag;
159 }
160
161protected:
164 {myIsWholeResultAllowed = false; myMakeCopy = false;}
165
166};
167
169typedef std::shared_ptr<ModelAPI_AttributeSelectionList> AttributeSelectionListPtr;
170
171#endif
3D point defined by three coordinates
Definition: GeomAPI_Pnt.h:38
Interface to the topological shape object.
Definition: GeomAPI_Shape.h:43
Attribute that contains list of references to the sub-shapes with possibility to manage them.
Definition: ModelAPI_AttributeSelectionList.h:37
virtual const std::string selectionType() const =0
The type of all elements selection.
virtual bool isGeometricalSelection() const =0
Returns true if is geometrical selection.
virtual std::shared_ptr< ModelAPI_AttributeSelection > value(const int theIndex)=0
Returns the attribute selection by the index (zero based)
virtual void append(const std::shared_ptr< GeomAPI_Pnt > &thePoint, const std::string &theType, const bool theIsIgnoreGroups=false)=0
Adds the new reference to the end of the list by inner point on the selected shape.
virtual void append(const ObjectPtr &theContext, const std::shared_ptr< GeomAPI_Shape > &theSubShape, const bool theTemporarily=false)=0
Adds the new reference to the end of the list.
virtual void removeTemporaryValues()=0
Reset temporary stored values.
virtual void clear()=0
Removes all attributes of the list.
virtual void setSelectionType(const std::string &theType)=0
Sets the type of all elements selection.
virtual void setMakeCopy(const bool theFlag)
Sets true if a copy features must be used in update in history.
Definition: ModelAPI_AttributeSelectionList.h:157
virtual void applyFilters()=0
Applies the filters to this selection list.
virtual ~ModelAPI_AttributeSelectionList()
To virtually destroy the fields of successors.
Definition: ModelAPI_AttributeSelectionList.cpp:27
virtual bool isInList(const ObjectPtr &theContext, const std::shared_ptr< GeomAPI_Shape > &theSubShape, const bool theTemporarily=false)=0
Returns true if the object with the shape are in list.
ModelAPI_AttributeSelectionList()
Default constructor.
Definition: ModelAPI_AttributeSelectionList.h:163
virtual void remove(const std::set< int > &theIndices)=0
Removes the elements from the list.
virtual void cashValues(const bool theEnabled)=0
Starts or stops cashing of the values in the attribute (the cash may become invalid on modification o...
virtual void copyTo(std::shared_ptr< ModelAPI_AttributeSelectionList > theTarget) const =0
Copy the selection list to the destination attribute.
virtual void removeFilters()=0
Removes the filters of this selection list.
virtual const bool isWholeResultAllowed() const
Returns true if the whole result selection corresponds to selection of all sub-shapes.
Definition: ModelAPI_AttributeSelectionList.h:142
virtual void removeLast()=0
Removes the last element in the list.
virtual FiltersFeaturePtr filters() const =0
Returns a selection filters feature if it is defined for this selection list.
virtual void setFilters(FiltersFeaturePtr theFeature)=0
Sets a selection filters feature if it is defined for this selection list.
virtual void setWholeResultAllowed(const bool theFlag)
Sets whether the whole result selection corresponds to selection of all sub-shapes.
Definition: ModelAPI_AttributeSelectionList.h:147
virtual void append(const std::string &theType, const std::wstring &theContextName, const int theIndex)=0
Adds the new reference to the end of the list by weak naming index.
virtual std::string attributeType()
Returns the type of this class of attributes, not static method.
Definition: ModelAPI_AttributeSelectionList.cpp:22
virtual const bool isMakeCopy() const
Returns true if a copy features must be used in update in history.
Definition: ModelAPI_AttributeSelectionList.h:152
virtual int size()=0
Returns the number of selection attributes in the list.
static std::string typeId()
Returns the type of this class of attributes.
Definition: ModelAPI_AttributeSelectionList.h:118
virtual void append(const std::wstring &theNamingName, const std::string &theType="")=0
Adds the new reference to the end of the list by the naming name of the selected shape The type of sh...
Generic attribute of the Object.
Definition: ModelAPI_Attribute.h:34