}
Model_AttributeSelection::Model_AttributeSelection(TDF_Label& theLabel)
- : myRef(theLabel)
+: myRef(theLabel),
+ myIsGeometricalSelection(false)
{
myIsInitialized = myRef.isInitialized();
myParent = NULL;
myRef.setID(theID);
ModelAPI_AttributeSelection::setID(theID);
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
- // TODO: check if parent list have geometrical selection flag.
- myIsGeometricalSelection =
- ModelAPI_Session::get()->validators()->isGeometricalSelection(aFeature->getKind(), id());
+ if (myParent) {
+ myIsGeometricalSelection = myParent->isGeometricalSelection();
+ } else {
+ myIsGeometricalSelection =
+ ModelAPI_Session::get()->validators()->isGeometricalSelection(aFeature->getKind(), id());
+ }
}
ResultPtr Model_AttributeSelection::context()
}
Model_AttributeSelectionList::Model_AttributeSelectionList(TDF_Label& theLabel)
+: myLab(theLabel),
+ myIsGeometricalSelection(false)
{
- myLab = theLabel;
reinit();
}
}
}
}
+
+void Model_AttributeSelectionList::setGeometricalSelection(const bool theIsGeometricalSelection)
+{
+ myIsGeometricalSelection = theIsGeometricalSelection;
+ // TODO: update list accodring to the flag:
+ // false - all objects with same geometry must be splited in separate.
+ // true - all objets with same geometry must be combined into single.
+}
/// during non-modification operations with this attribute)
MODEL_EXPORT virtual void cashValues(const bool theEnabled);
+ MODEL_EXPORT virtual void setGeometricalSelection(const bool theIsGeometricalSelection) override;
+
+ /// Returns true if is geometrical selection.
+ MODEL_EXPORT virtual bool isGeometricalSelection() const override {
+ return myIsGeometricalSelection;
+ };
+
protected:
/// Objects are created for features automatically
MODEL_EXPORT Model_AttributeSelectionList(TDF_Label& theLabel);
/// during non-modification operations with this attribute)
virtual void cashValues(const bool theEnabled) = 0;
+ virtual void setGeometricalSelection(const bool theIsGeometricalSelection) = 0;
+
+ /// Returns true if is geometrical selection.
+ virtual bool isGeometricalSelection() const = 0;
+
/// Returns the type of this class of attributes
static std::string typeId()
{
if (aType == ModelAPI_AttributeSelectionList::typeId()) {
AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
//TODO: set same topology flag
+ aSelectionListAttr->setGeometricalSelection(theOn);
updateObject(myFeature);
}
}