1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: Model_AttributeSelection.h
5 // Author: Mikhail PONIKAROV
7 #ifndef Model_AttributeSelection_H_
8 #define Model_AttributeSelection_H_
11 #include "Model_AttributeReference.h"
12 #include <ModelAPI_AttributeSelection.h>
13 #include <TDF_LabelMap.hxx>
15 /**\class Model_AttributeSelection
17 * \brief Attribute that contains reference to the sub-shape of some result, the selected shape.
20 class Model_AttributeSelection : public ModelAPI_AttributeSelection
22 Model_AttributeReference myRef; ///< The reference functionality reusage
23 TDF_LabelMap myScope; ///< the map of valid labels for naming selection solving
25 /// Defines the result and its selected sub-shape
26 MODEL_EXPORT virtual void setValue(
27 const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
29 /// Returns the selected subshape
30 MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> value();
32 /// Returns the context of the selection (the whole shape owner)
33 MODEL_EXPORT virtual ResultPtr context();
35 /// Sets the feature object
36 MODEL_EXPORT virtual void setObject(const std::shared_ptr<ModelAPI_Object>& theObject);
38 /// Updates the underlied selection due to the changes in the referenced objects
39 /// \returns false if update is failed
40 MODEL_EXPORT virtual bool update();
42 /// Returns a textual string of the selection
43 MODEL_EXPORT virtual std::string namingName();
46 /// Objects are created for features automatically
47 MODEL_EXPORT Model_AttributeSelection(TDF_Label& theLabel);
48 /// Performs the selection for the body result (TNaming Selection)
50 /// Performs the selection for the body result (TNaming selection)
51 virtual void selectBody(
52 const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
53 /// Performs the selection for the construction result (selection by index)
54 virtual void selectConstruction(
55 const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
57 /// Returns the label where TNaming_Selection results are stored
58 /// Note: there must be no attributes stored at the same label because Selector clears this lab
59 TDF_Label selectionLabel();
61 /// Returns the prepared map of valid labels for naming selection solving (creates if not exists)
62 TDF_LabelMap& scope();
64 friend class Model_Data;
65 friend class Model_AttributeSelectionList;