SHAPER  9.12.0
ModelAPI_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 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 
27 class GeomAPI_Pnt;
28 class GeomAPI_Shape;
29 
37 {
41  bool myIsWholeResultAllowed;
44  bool myMakeCopy;
45 public:
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) = 0;
62 
64  virtual void append(const std::string& theType, const std::wstring& theContextName,
65  const int theIndex) = 0;
66 
68  virtual void copyTo(std::shared_ptr<ModelAPI_AttributeSelectionList> theTarget) const = 0;
69 
71  virtual void removeTemporaryValues() = 0;
72 
74  virtual void removeLast() = 0;
75 
78  virtual void remove(const std::set<int>& theIndices) = 0;
79 
81  virtual int size() = 0;
82 
88  virtual bool isInList(
89  const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
90  const bool theTemporarily = false) = 0;
91 
94  virtual const std::string selectionType() const = 0;
95 
98  virtual void setSelectionType(const std::string& theType) = 0;
99 
101  virtual std::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex) = 0;
102 
104  virtual void clear() = 0;
105 
109  virtual void cashValues(const bool theEnabled) = 0;
110 
111  virtual void setGeometricalSelection(const bool theIsGeometricalSelection) = 0;
112 
114  virtual bool isGeometricalSelection() const = 0;
115 
117  static std::string typeId()
118  {
119  return "SelectionList";
120  }
121 
123  MODELAPI_EXPORT virtual std::string attributeType();
124 
126  MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelectionList();
127 
129  MODELAPI_EXPORT virtual FiltersFeaturePtr filters() const = 0;
130 
132  MODELAPI_EXPORT virtual void setFilters(FiltersFeaturePtr theFeature) = 0;
133 
135  MODELAPI_EXPORT virtual const bool isWholeResultAllowed() const {
136  return myIsWholeResultAllowed;
137  }
138 
140  MODELAPI_EXPORT virtual void setWholeResultAllowed(const bool theFlag) {
141  myIsWholeResultAllowed = theFlag;
142  }
143 
145  MODELAPI_EXPORT virtual const bool isMakeCopy() const {
146  return myMakeCopy;
147  }
148 
150  MODELAPI_EXPORT virtual void setMakeCopy(const bool theFlag) {
151  myMakeCopy = theFlag;
152  }
153 
154 protected:
157  {myIsWholeResultAllowed = false; myMakeCopy = false;}
158 
159 };
160 
162 typedef std::shared_ptr<ModelAPI_AttributeSelectionList> AttributeSelectionListPtr;
163 
164 #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 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 std::shared_ptr< ModelAPI_AttributeSelection > value(const int theIndex)=0
Returns the attribute selection by the index (zero based)
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:150
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:156
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 const bool isWholeResultAllowed() const
Returns true if the whole result selection corresponds to selection of all sub-shapes.
Definition: ModelAPI_AttributeSelectionList.h:135
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 append(const std::shared_ptr< GeomAPI_Pnt > &thePoint, const std::string &theType)=0
Adds the new reference to the end of the list by inner point on the selected shape.
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:140
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:145
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:117
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