1 // File: Model_AttributeSelection.h
3 // Author: Mikhail PONIKAROV
5 #ifndef Model_AttributeSelection_H_
6 #define Model_AttributeSelection_H_
9 #include "Model_AttributeReference.h"
10 #include <ModelAPI_AttributeSelection.h>
12 /**\class Model_AttributeSelection
14 * \brief Attribute that contains reference to the sub-shape of some result, the selected shape.
17 class Model_AttributeSelection : public ModelAPI_AttributeSelection
19 Model_AttributeReference myRef; ///< The reference functionality reusage
21 /// Defines the result and its selected sub-shape
22 MODEL_EXPORT virtual void setValue(
23 const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape);
25 /// Returns the selected subshape
26 MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape> value();
28 /// Returns the context of the selection (the whole shape owner)
29 MODEL_EXPORT virtual ResultPtr context();
31 /// Sets the feature object
32 MODEL_EXPORT virtual void setObject(const boost::shared_ptr<ModelAPI_Object>& theObject);
34 /// Updates the underlied selection due to the changes in the referenced objects
35 /// \returns false if update is failed
36 MODEL_EXPORT virtual bool update();
39 /// Objects are created for features automatically
40 MODEL_EXPORT Model_AttributeSelection(TDF_Label& theLabel);
41 /// Performs the selection for the body result (TNaming Selection)
43 /// Performs the selection for the body result (TNaming selection)
44 virtual void selectBody(
45 const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape);
46 /// Performs the selection for the construction result (selection by index)
47 virtual void selectConstruction(
48 const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape);
50 /// Returns the label where TNaming_Selection results are stored
51 /// Note: there must be no attributes stored at the same label because Selector clears this lab
52 TDF_Label selectionLabel();
54 friend class Model_Data;
55 friend class Model_AttributeSelectionList;