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 virtual void setValue(
23 const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape) = 0;
25 /// Returns the selected subshape
26 virtual std::shared_ptr<GeomAPI_Shape> value() = 0;
28 /// Returns the context of the selection (the whole shape owner)
29 virtual ResultPtr context() = 0;
31 /// Updates the underlied selection due to the changes in the referenced objects
32 /// \returns false if update is failed
33 virtual bool update() = 0;
35 /// Returns the type of this class of attributes
36 static std::string typeId()
41 /// Returns the type of this class of attributes, not static method
42 MODELAPI_EXPORT virtual std::string attributeType();
44 /// Returns a textual string of the selection
45 /// \param theDefaultValue a value, which is used if the naming name can not be obtained
46 virtual std::string namingName(const std::string& theDefaultValue = "") = 0;
48 /// Returns an id of the selection
52 /// Selects sub-shape by the textual Name
53 virtual void selectSubShape(const std::string& theType, const std::string& theSubShapeName) = 0;
55 /// To virtually destroy the fields of successors
56 MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection();
59 /// Objects are created for features automatically
60 MODELAPI_EXPORT ModelAPI_AttributeSelection();
63 //! Pointer on double attribute
64 typedef std::shared_ptr<ModelAPI_AttributeSelection> AttributeSelectionPtr;