Salome HOME
The external feature should be executed manually in order to return first result.
[modules/shaper.git] / src / PartSet / PartSet_OperationPrs.cpp
index 5e7d2f2ec834c288d6b849888a1d143f4c0ec165..d20041e43aa7b97aca301a2f3868e09d78a65580 100755 (executable)
 #include "XGUI_ModuleConnector.h"
 #include "XGUI_Displayer.h"
 
+#include "ModuleBase_Tools.h"
+
 #include <ModelAPI_Result.h>
 #include <ModelAPI_Attribute.h>
 #include <ModelAPI_AttributeRefAttr.h>
 #include <ModelAPI_AttributeReference.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeRefList.h>
+
 
 #include <GeomValidators_Tools.h>
 
@@ -82,7 +86,11 @@ void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t
     QList<GeomShapePtr>::const_iterator aShIt = aShapes.begin(), aShLast = aShapes.end();
     for (; aShIt != aShLast; aShIt++) {
       GeomShapePtr aGeomShape = *aShIt;
+      if (!aGeomShape.get())
+        continue;
       TopoDS_Shape aShape = aGeomShape->impl<TopoDS_Shape>();
+      // change deviation coefficient to provide more precise circle
+      ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer);
       StdPrs_WFDeflectionShape::Add(thePresentation, aShape, aDrawer);
     }
   }
@@ -137,10 +145,10 @@ void addValue(const ObjectPtr& theObject, const GeomShapePtr& theShape,
     }
     if (!isSubObject(theObject, theFeature)) {
       if (theObjectShapes.contains(theObject))
-        theObjectShapes[theObject].append(theShape);
+        theObjectShapes[theObject].append(aShape);
       else {
         QList<GeomShapePtr> aShapes;
-        aShapes.append(theShape);
+        aShapes.append(aShape);
         theObjectShapes[theObject] = aShapes;
       }
     }
@@ -172,6 +180,14 @@ void PartSet_OperationPrs::getFeatureShapes(QMap<ObjectPtr, QList<GeomShapePtr>
         addValue(aResult, aShape, myFeature, theObjectShapes);
       }
     }
+    if (anAttrType == ModelAPI_AttributeRefList::typeId()) {
+      std::shared_ptr<ModelAPI_AttributeRefList> aCurSelList =
+        std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(anAttribute);
+      for (int i = 0; i < aCurSelList->size(); i++) {
+        GeomShapePtr aShape;
+        addValue(aCurSelList->object(i), aShape, myFeature, theObjectShapes);
+      }
+    }
     else {
       ObjectPtr anObject;
       GeomShapePtr aShape;
@@ -208,6 +224,7 @@ bool PartSet_OperationPrs::isSelectionAttribute(const AttributePtr& theAttribute
   std::string anAttrType = theAttribute->attributeType();
 
   return anAttrType == ModelAPI_AttributeSelectionList::typeId() ||
+         anAttrType == ModelAPI_AttributeRefList::typeId() ||
          anAttrType == ModelAPI_AttributeRefAttr::typeId() ||
          anAttrType == ModelAPI_AttributeSelection::typeId() ||
          anAttrType == ModelAPI_AttributeReference::typeId();