From: nds Date: Fri, 21 Aug 2015 05:19:32 +0000 (+0300) Subject: External object are not removed in both cases: in multi/signgle selection controls. X-Git-Tag: V_1.4.0_beta4~300 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fbe45f3815d4221bb530f373ba1f87af5ebf63db;p=modules%2Fshaper.git External object are not removed in both cases: in multi/signgle selection controls. --- diff --git a/src/PartSet/PartSet_ExternalObjectsMgr.cpp b/src/PartSet/PartSet_ExternalObjectsMgr.cpp index df63169bc..54608476b 100755 --- a/src/PartSet/PartSet_ExternalObjectsMgr.cpp +++ b/src/PartSet/PartSet_ExternalObjectsMgr.cpp @@ -51,34 +51,12 @@ ObjectPtr PartSet_ExternalObjectsMgr::externalObject(const ObjectPtr& theSelecte // Processing of external (non-sketch) object aSelectedObject = PartSet_Tools::createFixedObjectByExternal(theShape->impl(), theSelectedObject, theSketch, theTemporary); - if (aSelectedObject.get()) { - if (theTemporary) + if (aSelectedObject.get() && theTemporary) myExternalObjectValidated = aSelectedObject; - else - myExternalObjects.append(aSelectedObject); - } } return aSelectedObject; } -//******************************************************************** -/*ObjectPtr PartSet_ExternalObjectsMgr::externalObjectValidated(const ObjectPtr& theSelectedObject, - const GeomShapePtr& theShape, - const CompositeFeaturePtr& theSketch) -{ - // TODO(nds): unite with externalObject() - ObjectPtr aSelectedObject = PartSet_Tools::findFixedObjectByExternal(theShape->impl(), - theSelectedObject, theSketch); - if (!aSelectedObject.get()) { - // Processing of external (non-sketch) object - aSelectedObject = PartSet_Tools::createFixedObjectByExternal(theShape->impl(), - theSelectedObject, theSketch); - if (aSelectedObject.get()) - myExternalObjectValidated = aSelectedObject; - } - return aSelectedObject; -}*/ - //******************************************************************** void PartSet_ExternalObjectsMgr::removeExternal(const CompositeFeaturePtr& theSketch, const FeaturePtr& theFeature, @@ -87,50 +65,10 @@ void PartSet_ExternalObjectsMgr::removeExternal(const CompositeFeaturePtr& theSk { if (theTemporary) removeExternalObject(myExternalObjectValidated, theSketch, theFeature, theWorkshop); - else{ - QObjectPtrList::const_iterator anIt = myExternalObjects.begin(), aLast = myExternalObjects.end(); - for (; anIt != aLast; anIt++) { - ObjectPtr anObject = *anIt; - removeExternalObject(anObject, theSketch, theFeature, theWorkshop); - } - myExternalObjects.clear(); - } -} - -//******************************************************************** -void PartSet_ExternalObjectsMgr::removeUnusedExternalObjects(const QObjectPtrList& theIgnoreObjects, - const CompositeFeaturePtr& theSketch, - const FeaturePtr& theFeature) -{ - /* - // TODO(nds): unite with removeExternal(), remove parameters - QObjectPtrList aUsedExternalObjects; - - QObjectPtrList::const_iterator anIt = myExternalObjects.begin(), aLast = myExternalObjects.end(); - for (; anIt != aLast; anIt++) { - ObjectPtr anObject = *anIt; - if (theIgnoreObjects.contains(anObject)) - aUsedExternalObjects.append(anObject); - else - removeExternalObject(anObject, theSketch, theFeature); - }*/ - myExternalObjects.clear(); - //if (!aUsedExternalObjects.empty()) - // myExternalObjects = aUsedExternalObjects; } -//******************************************************************** -/*void PartSet_ExternalObjectsMgr::removeExternalValidated(const CompositeFeaturePtr& theSketch, - const FeaturePtr& theFeature, - ModuleBase_IWorkshop* theWorkshop) -{ - // TODO(nds): unite with removeExternal(), remove parameters - removeExternalObject(myExternalObjectValidated, theSketch, theFeature, theWorkshop); - myExternalObjectValidated = ObjectPtr(); -}*/ - void PartSet_ExternalObjectsMgr::removeExternalObject(const ObjectPtr& theObject, - const CompositeFeaturePtr& theSketch, + const CompositeFeaturePtr& /*theSketch*/, const FeaturePtr& theFeature, ModuleBase_IWorkshop* theWorkshop) { diff --git a/src/PartSet/PartSet_ExternalObjectsMgr.h b/src/PartSet/PartSet_ExternalObjectsMgr.h index 97dae5248..3d292afce 100755 --- a/src/PartSet/PartSet_ExternalObjectsMgr.h +++ b/src/PartSet/PartSet_ExternalObjectsMgr.h @@ -50,28 +50,23 @@ class PARTSET_EXPORT PartSet_ExternalObjectsMgr ObjectPtr externalObject(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape, const CompositeFeaturePtr& theSketch, const bool theTemporary = false); - //ObjectPtr externalObjectValidated(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape, - // const CompositeFeaturePtr& theSketch); - // Removes the external presentation from the model /// \param theSketch a current sketch /// \param theFeature a current feature - /// \param theFeature a current workshop + /// \param theWorkshop a current workshop /// \param theTemporary if true, a temporary external object is removed overwise all ext objects void removeExternal(const CompositeFeaturePtr& theSketch, const FeaturePtr& theFeature, ModuleBase_IWorkshop* theWorkshop, const bool theTemporary); - //void removeExternalVali+dated(const CompositeFeaturePtr& theSketch, - // const FeaturePtr& theFeature, - // ModuleBase_IWorkshop* theWorkshop); - - void removeUnusedExternalObjects(const QObjectPtrList& theIgnoreObjects, - const CompositeFeaturePtr& theSketch, - const FeaturePtr& theFeature); - protected: + /// Delete from the document the feature of the object. It deletes all objects, which refers to + /// the deleted one. The parameter feature is ignored even it refer to the deleted object. + /// \param theObject a removed object + /// \param theSketch a current sketch + /// \param theFeature a current feature + /// \param theWorkshop a current workshop void removeExternalObject(const ObjectPtr& theObject, const CompositeFeaturePtr& theSketch, const FeaturePtr& theFeature, @@ -81,9 +76,6 @@ protected: static XGUI_Workshop* workshop(ModuleBase_IWorkshop* theWorkshop); protected: - /// An external object - QObjectPtrList myExternalObjects; - /// An external object ObjectPtr myExternalObjectValidated; diff --git a/src/PartSet/PartSet_WidgetMultiSelector.cpp b/src/PartSet/PartSet_WidgetMultiSelector.cpp index 9f76f8120..afb664ed0 100755 --- a/src/PartSet/PartSet_WidgetMultiSelector.cpp +++ b/src/PartSet/PartSet_WidgetMultiSelector.cpp @@ -43,38 +43,6 @@ PartSet_WidgetMultiSelector::~PartSet_WidgetMultiSelector() delete myExternalObjectMgr; } -bool PartSet_WidgetMultiSelector::setSelection(QList& theValues, - const bool theToValidate) -{ - bool aSucceed = ModuleBase_WidgetMultiSelector::setSelection(theValues, theToValidate); - if (aSucceed) { - // TODO(nds): unite with externalObject(), remove parameters - //myFeature->execute(); - - QObjectPtrList aListOfAttributeObjects; - - AttributePtr anAttribute = myFeature->data()->attribute(attributeID()); - if (anAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) { - AttributeSelectionListPtr aSelectionListAttr = - std::dynamic_pointer_cast(anAttribute); - for (int i = 0; i < aSelectionListAttr->size(); i++) { - AttributeSelectionPtr anAttr = aSelectionListAttr->value(i); - aListOfAttributeObjects.append(anAttr->context()); - } - } - else if (anAttribute->attributeType() == ModelAPI_AttributeRefList::typeId()) { - AttributeRefListPtr aRefListAttr = - std::dynamic_pointer_cast(anAttribute); - for (int i = 0; i < aRefListAttr->size(); i++) { - aListOfAttributeObjects.append(aRefListAttr->object(i)); - } - } - - myExternalObjectMgr->removeUnusedExternalObjects(aListOfAttributeObjects, sketch(), myFeature); - } - return aSucceed; -} - //******************************************************************** bool PartSet_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs) { @@ -91,7 +59,7 @@ void PartSet_WidgetMultiSelector::restoreAttributeValue(const bool theValid) { ModuleBase_WidgetMultiSelector::restoreAttributeValue(theValid); - myExternalObjectMgr->removeExternal/*Validated*/(sketch(), myFeature, myWorkshop, true); + myExternalObjectMgr->removeExternal(sketch(), myFeature, myWorkshop, true); } void PartSet_WidgetMultiSelector::getGeomSelection(const ModuleBase_ViewerPrs& thePrs, @@ -112,11 +80,7 @@ void PartSet_WidgetMultiSelector::getGeomSelection(const ModuleBase_ViewerPrs& t if (aResult.get()) aShape = aResult->shape(); } - if (aShape.get() != NULL && !aShape->isNull()) { - //if (myIsInValidate) - // theObject = myExternalObjectMgr->externalObjectValidated(theObject, aShape, sketch()); - //else + if (aShape.get() != NULL && !aShape->isNull()) theObject = myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate); - } } } diff --git a/src/PartSet/PartSet_WidgetMultiSelector.h b/src/PartSet/PartSet_WidgetMultiSelector.h index bc2b97ac3..bf745d643 100644 --- a/src/PartSet/PartSet_WidgetMultiSelector.h +++ b/src/PartSet/PartSet_WidgetMultiSelector.h @@ -46,12 +46,6 @@ Q_OBJECT /// Retrurns installed sketcher CompositeFeaturePtr sketch() const { return mySketch; } - /// Set the given wrapped value to the current widget - /// This value should be processed in the widget according to the needs - /// \param theValues the wrapped selection values - virtual bool setSelection(QList& theValues, - const bool theToValidate); - protected: /// Checks the widget validity. By default, it returns true. /// \param theValue a selected presentation in the view