Salome HOME
ModuleBase_WidgetShapeSelector correction to process AttrRefAtt like MultiSelector...
authornds <nds@opencascade.com>
Thu, 21 Jan 2016 11:05:09 +0000 (14:05 +0300)
committerdbv <dbv@opencascade.com>
Tue, 16 Feb 2016 14:04:26 +0000 (17:04 +0300)
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/PartSet/PartSet_WidgetShapeSelector.cpp
src/PartSet/PartSet_WidgetShapeSelector.h

index 1047536e988e1abc372d0a6544e7bddc9f6b986b..27b99ab853e266076c6125929484eff434e75157 100644 (file)
@@ -208,9 +208,15 @@ GeomShapePtr ModuleBase_WidgetShapeSelector::getShape() const
   if (!aData->isValid())
     return aShape;
 
-  AttributeSelectionPtr aSelect = aData->selection(attributeID());
-  if (aSelect)
-    aShape = aSelect->value();
+  std::string aType = aData->attribute(attributeID())->attributeType();
+  if (aType == ModelAPI_AttributeReference::typeId()) {
+  } else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
+    AttributeRefAttrPtr aRefAttr = aData->refattr(attributeID());
+    aShape = myWorkshop->module()->findShape(aRefAttr);
+  } else if (aType == ModelAPI_AttributeSelection::typeId()) {
+    AttributeSelectionPtr aSelectAttr = aData->selection(attributeID());
+    aShape = aSelectAttr->value();
+  }
 
   return aShape;
 }
index 79e32272de5969a21d1928a9c6d9f32a57aec02b..064a29efb529763d3ab48331ffb4b4cbd71bf66d 100755 (executable)
 #include <ModuleBase_Definitions.h>
 #include <Config_WidgetAPI.h>
 
-#include <PartSet_Tools.h>
 #include <PartSet_ExternalObjectsMgr.h>
 #include <SketchPlugin_Feature.h>
 
-#include <SketchPlugin_ConstraintRigid.h>
-
 #include <XGUI_Workshop.h>
 
 #include <XGUI_ModuleConnector.h>
 #include <XGUI_Displayer.h>
 #include <XGUI_SelectionMgr.h>
 #include <XGUI_Selection.h>
-#include <SelectMgr_IndexedMapOfOwner.hxx>
-#include <StdSelect_BRepOwner.hxx>
 
 PartSet_WidgetShapeSelector::PartSet_WidgetShapeSelector(QWidget* theParent,
                                                          ModuleBase_IWorkshop* theWorkshop,
@@ -76,19 +71,6 @@ void PartSet_WidgetShapeSelector::getGeomSelection(const ModuleBase_ViewerPrs& t
   }
 }
 
-//********************************************************************
-GeomShapePtr PartSet_WidgetShapeSelector::getShape() const
-{
-  // an empty shape by default
-  DataPtr aData = myFeature->data();
-  AttributePtr anAttribute = aData->attribute(attributeID());
-  GeomShapePtr aShape = PartSet_Tools::findShapeBy2DPoint(anAttribute, myWorkshop);
-
-  if (!aShape.get())
-    aShape = ModuleBase_WidgetShapeSelector::getShape();
-  return aShape;
-}
-
 //********************************************************************
 void PartSet_WidgetShapeSelector::restoreAttributeValue(const bool theValid)
 {
index f6b836e2ed742886c98d322724546d97fcadd2c9..0f9a88218489236723d2902a1e4769ce82a2f866 100644 (file)
@@ -56,13 +56,6 @@ protected:
                                 ObjectPtr& theObject,
                                 GeomShapePtr& theShape);
 
-  /// Get the shape from the attribute if the attribute contain a shape
-  /// It processes the ref attr type of attributes. It obtains the referenced attribute,
-  /// results of the attribute feature. And it founds a vertes in the owners of the results
-  /// If the vertex is found, it creates a geom shape on it.
-  /// \return a shape
-  virtual GeomShapePtr getShape() const;
-
   /// Creates a backup of the current values of the attribute
   /// It should be realized in the specific widget because of different
   /// parameters of the current attribute