Salome HOME
Issue #2024: Redesign of circle and arc of circle
[modules/shaper.git] / src / PartSet / PartSet_WidgetSubShapeSelector.cpp
index 50f81218d9c380d5008baac0d6b09bbbd360adce..24dd2cad09e5bbcf18986b35d5794239c50abad0 100755 (executable)
@@ -20,6 +20,7 @@
 
 #include <GeomAlgoAPI_ShapeTools.h>
 #include <ModelGeomAlgo_Point2D.h>
+#include <ModelGeomAlgo_Shape.h>
 
 #include <ModelGeomAlgo_Point2D.h>
 
@@ -167,10 +168,10 @@ bool PartSet_WidgetSubShapeSelector::setSelection(
       FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObject);
       std::list<AttributePtr> a2DPointAttributes = aBaseFeature->data()->attributes(
                                                         GeomDataAPI_Point2D::typeId());
-      std::list<AttributePtr>::const_iterator anIt = a2DPointAttributes.begin(), 
+      std::list<AttributePtr>::const_iterator anIt = a2DPointAttributes.begin(),
                                               aLast = a2DPointAttributes.end();
       for (; anIt != aLast; anIt++) {
-        std::shared_ptr<GeomDataAPI_Point2D> anAttributePoint = 
+        std::shared_ptr<GeomDataAPI_Point2D> anAttributePoint =
                                       std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
         std::shared_ptr<GeomAPI_Pnt2d> aPoint2D = anAttributePoint->pnt();
         std::shared_ptr<GeomAPI_Pnt> aPoint3D = PartSet_Tools::convertTo3D(aPoint2D->x(),
@@ -183,7 +184,8 @@ bool PartSet_WidgetSubShapeSelector::setSelection(
 
       /// find the points in coincident features
       PntToAttributesMap aRefAttributes = myCashedReferences[aBaseObject];
-      PntToAttributesMap::const_iterator aRIt = aRefAttributes.begin(), aRLast = aRefAttributes.end();
+      PntToAttributesMap::const_iterator
+        aRIt = aRefAttributes.begin(), aRLast = aRefAttributes.end();
       for (; aRIt != aRLast; aRIt++) {
         std::shared_ptr<GeomDataAPI_Point2D> anAttribute = aRIt->first;
         std::shared_ptr<GeomAPI_Pnt> aPoint = aRIt->second;
@@ -227,11 +229,11 @@ void PartSet_WidgetSubShapeSelector::fillObjectShapes(const ObjectPtr& theObject
   std::set<std::shared_ptr<GeomDataAPI_Point2D> > aRefAttributes;
   // current feature
   FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
-  std::set<GeomShapePtr> anEdgeShapes;
   // edges on feature
-  ModelAPI_Tools::shapesOfType(aFeature, GeomAPI_Shape::EDGE, anEdgeShapes);
-  if (!anEdgeShapes.empty()) {
-    GeomShapePtr aFeatureShape = *anEdgeShapes.begin();
+  std::set<ResultPtr> anEdgeResults;
+  ModelGeomAlgo_Shape::shapesOfType(aFeature, GeomAPI_Shape::EDGE, anEdgeResults);
+  if (!anEdgeResults.empty()) {
+    GeomShapePtr aFeatureShape = (*anEdgeResults.begin())->shape();
 
     // coincidences to the feature
     ModelGeomAlgo_Point2D::getPointsOfReference(aFeature, SketchPlugin_ConstraintCoincidence::ID(),
@@ -247,10 +249,10 @@ void PartSet_WidgetSubShapeSelector::fillObjectShapes(const ObjectPtr& theObject
         aData->attribute(SketchPlugin_Sketch::NORM_ID()));
     std::shared_ptr<GeomAPI_Dir> aY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir())));
     std::list<std::shared_ptr<GeomAPI_Pnt> > aPoints;
-    ModelGeomAlgo_Point2D::getPointsInsideShape(aFeatureShape, aRefAttributes, aC->pnt(),
+    ModelGeomAlgo_Point2D::getPointsInsideShape_p(aFeatureShape, aRefAttributes, aC->pnt(),
                                                 aX->dir(), aY, aPoints, aPointToAttributes);
 
-    GeomAlgoAPI_ShapeTools::splitShape(aFeatureShape, aPoints, aShapes);
+    GeomAlgoAPI_ShapeTools::splitShape_p(aFeatureShape, aPoints, aShapes);
   }
   myCashedShapes[theObject] = aShapes;
   myCashedReferences[theObject] = aPointToAttributes;