]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
External object are not removed in both cases: in multi/signgle selection controls.
authornds <natalia.donis@opencascade.com>
Fri, 21 Aug 2015 05:19:32 +0000 (08:19 +0300)
committernds <natalia.donis@opencascade.com>
Fri, 21 Aug 2015 05:19:32 +0000 (08:19 +0300)
src/PartSet/PartSet_ExternalObjectsMgr.cpp
src/PartSet/PartSet_ExternalObjectsMgr.h
src/PartSet/PartSet_WidgetMultiSelector.cpp
src/PartSet/PartSet_WidgetMultiSelector.h

index df63169bcca030b776758ccd2dfbd51b25876f9a..54608476b671021210654dc4ff9ca73fe3a3b1fc 100755 (executable)
@@ -51,34 +51,12 @@ ObjectPtr PartSet_ExternalObjectsMgr::externalObject(const ObjectPtr& theSelecte
     // Processing of external (non-sketch) object
     aSelectedObject = PartSet_Tools::createFixedObjectByExternal(theShape->impl<TopoDS_Shape>(),
                                                     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<TopoDS_Shape>(),
-                                                             theSelectedObject, theSketch);
-  if (!aSelectedObject.get()) {
-    // Processing of external (non-sketch) object
-    aSelectedObject = PartSet_Tools::createFixedObjectByExternal(theShape->impl<TopoDS_Shape>(),
-                                                                 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)
 {
index 97dae5248ba163396aac1f7512cb7a64394c74d3..3d292afceeb485e31d89aaeb0e5c3a8039c7a460 100755 (executable)
@@ -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;
 
index 9f76f81200fd7bbd5ae520cb26b3649cd7b816e9..afb664ed02bc246363af1633e6b6ebc6bf030885 100755 (executable)
@@ -43,38 +43,6 @@ PartSet_WidgetMultiSelector::~PartSet_WidgetMultiSelector()
   delete myExternalObjectMgr;
 }
 
-bool PartSet_WidgetMultiSelector::setSelection(QList<ModuleBase_ViewerPrs>& 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<ModelAPI_AttributeSelectionList>(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<ModelAPI_AttributeRefList>(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);
-    }
   }
 }
index bc2b97ac356a8fb465d609133c4e3b9031079ff6..bf745d6433d11837a8906ec068b10446c8e0c5b0 100644 (file)
@@ -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<ModuleBase_ViewerPrs>& theValues,
-                            const bool theToValidate);
-
 protected:
   /// Checks the widget validity. By default, it returns true.
   /// \param theValue a selected presentation in the view