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 /// Returns the selected subshape
31 virtual std::shared_ptr<GeomAPI_Shape> value() = 0;
33 /// Returns the context of the selection (the whole shape owner)
34 virtual ResultPtr context() = 0;
36 /// Updates the underlied selection due to the changes in the referenced objects
37 /// \returns false if update is failed
38 virtual bool update() = 0;
40 /// Returns the type of this class of attributes
41 static std::string typeId()
46 /// Returns the type of this class of attributes, not static method
47 MODELAPI_EXPORT virtual std::string attributeType();
49 /// Returns a textual string of the selection
50 /// \param theDefaultValue a value, which is used if the naming name can not be obtained
51 virtual std::string namingName(const std::string& theDefaultValue = "") = 0;
53 /// Returns an id of the selection
57 /// Selects sub-shape by the textual Name
58 virtual void selectSubShape(const std::string& theType, const std::string& theSubShapeName) = 0;
60 /// Returns true if recomute of selection become impossible
61 virtual bool isInvalid() = 0;
63 /// To virtually destroy the fields of successors
64 MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection();
67 /// Objects are created for features automatically
68 MODELAPI_EXPORT ModelAPI_AttributeSelection();
71 //! Pointer on double attribute
72 typedef std::shared_ptr<ModelAPI_AttributeSelection> AttributeSelectionPtr;