1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelAPI_AttributeSelection.h
5 // Author: Mikhail PONIKAROV
7 #ifndef ModelAPI_AttributeSelection_H_
8 #define ModelAPI_AttributeSelection_H_
10 #include "ModelAPI_Attribute.h"
11 #include <ModelAPI_Result.h>
13 /**\class ModelAPI_AttributeSelection
15 * \brief Attribute that contains reference to the sub-shape of some result, the selected shape.
18 class ModelAPI_AttributeSelection : public ModelAPI_Attribute
21 /// Defines the result and its selected sub-shape
22 /// \param theContext object where the sub-shape was selected
23 /// \param theSubShape selected sub-shape (if null, the whole context is selected)
24 /// \param theTemporarily if it is true, do not store and name the added in the data framework
25 /// (used to remove immideately, without the following updates)
26 virtual void setValue(
27 const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
28 const bool theTemporarily = false) = 0;
30 /// Reset temporary stored values
31 virtual void removeTemporaryValues() = 0;
33 /// Returns the selected subshape
34 virtual std::shared_ptr<GeomAPI_Shape> value() = 0;
36 /// Returns the context of the selection (the whole shape owner)
37 virtual ResultPtr context() = 0;
39 /// Updates the underlied selection due to the changes in the referenced objects
40 /// \returns false if update is failed
41 virtual bool update() = 0;
43 /// Returns the type of this class of attributes
44 static std::string typeId()
49 /// Returns the type of this class of attributes, not static method
50 MODELAPI_EXPORT virtual std::string attributeType();
52 /// Returns a textual string of the selection
53 /// \param theDefaultValue a value, which is used if the naming name can not be obtained
54 virtual std::string namingName(const std::string& theDefaultValue = "") = 0;
56 /// Returns an id of the selection
59 /// Defines an id of the selection
60 virtual void setId(int theID) = 0;
62 /// Selects sub-shape by the textual Name
63 virtual void selectSubShape(const std::string& theType, const std::string& theSubShapeName) = 0;
65 /// Returns true if recompute of selection become impossible
66 virtual bool isInvalid() = 0;
68 /// To virtually destroy the fields of successors
69 MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection();
72 /// Objects are created for features automatically
73 MODELAPI_EXPORT ModelAPI_AttributeSelection();
76 //! Pointer on double attribute
77 typedef std::shared_ptr<ModelAPI_AttributeSelection> AttributeSelectionPtr;