owner()->data()->sendAttributeUpdated(this);
}
+void Model_AttributeSelection::removeTemporaryValues()
+{
+ if (myTmpContext.get() || myTmpSubShape.get()) {
+ myTmpContext.reset();
+ myTmpSubShape.reset();
+ }
+}
+
std::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::value()
{
GeomShapePtr aResult;
const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
const bool theTemporarily = false);
+ /// Reset temporary stored values
+ virtual void removeTemporaryValues();
+
/// Returns the selected subshape
MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> value();
owner()->data()->sendAttributeUpdated(this);
}
+void Model_AttributeSelectionList::removeTemporaryValues()
+{
+ if (myTmpAttr.get()) {
+ myTmpAttr.reset();
+ }
+}
+
void Model_AttributeSelectionList::removeLast()
{
int anOldSize = mySize->Get();
/// The type of shape is taken from the current selection type if the given is empty
MODEL_EXPORT virtual void append(const std::string theNamingName, const std::string& theType="");
+ /// Reset temporary stored values
+ virtual void removeTemporaryValues();
+
/// Removes the last element in the list
MODEL_EXPORT virtual void removeLast();
const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
const bool theTemporarily = false) = 0;
+ /// Reset temporary stored values
+ virtual void removeTemporaryValues() = 0;
+
/// Returns the selected subshape
virtual std::shared_ptr<GeomAPI_Shape> value() = 0;
/// The type of shape is taken from the current selection type if the given is empty
virtual void append(const std::string theNamingName, const std::string& theType = "") = 0;
+ /// Reset temporary stored values
+ virtual void removeTemporaryValues() = 0;
+
/// Removes the last element in the list
virtual void removeLast() = 0;
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_Events.h>
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeSelectionList.h>
#include <TopoDS_Iterator.hxx>
ModuleBase_ModelWidget::deactivate();
disconnect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
activateSelectionAndFilters(false);
- ModuleBase_ModelWidget::deactivate();
+
+ /// clear temporary cash
+ AttributePtr anAttribute = attribute();
+ std::string aType = anAttribute->attributeType();
+ if (anAttribute->attributeType() == ModelAPI_AttributeSelection::typeId()) {
+ AttributeSelectionPtr aSelectAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(anAttribute);
+ aSelectAttr->removeTemporaryValues();
+ }
+ else if (anAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) {
+ AttributeSelectionListPtr aSelectAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(anAttribute);
+ aSelectAttr->removeTemporaryValues();
+ }
}
//********************************************************************