- //int aNbSubs = aOwner->numberOfSubs();
- //for (int i = 0; i < aNbSubs; i++) {
- // FeaturePtr aFeature = aOwner->subFeature(i);
- // if (aFeature->getKind() == SketchPlugin_Line::ID()) {
- // GeomPnt2dPtr aPnt1 =
- // SketcherPrs_Tools::getPoint(aFeature.get(), SketchPlugin_Line::START_ID());
- // GeomPnt2dPtr aPnt2 =
- // SketcherPrs_Tools::getPoint(aFeature.get(), SketchPlugin_Line::END_ID());
- // if (aPnt1->isEqual(aPnt2d) || aPnt2->isEqual(aPnt2d)) {
- // GeomShapePtr aShp = SketcherPrs_Tools::getShape(aFeature->firstResult());
- // GeomCurvePtr aCurv = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp));
- // aList.Append(aCurv->impl<Handle(Geom_Curve)>());
- // }
- // } else if ((aFeature->getKind() == SketchPlugin_Circle::ID()) ||
- // (aFeature->getKind() == SketchPlugin_Arc::ID())) {
- // GeomShapePtr aShp = SketcherPrs_Tools::getShape(aFeature->firstResult());
- // GeomCurvePtr aCurv = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp));
- // }
- //}
+ GeomPnt2dPtr aPnt1 = aSPnt1->pnt();
+ GeomPnt2dPtr aPnt2 = aSPnt2->pnt();
+
+ if (aPnt1->isEqual(aPnt2d) || aPnt2->isEqual(aPnt2d)) {
+ GeomShapePtr aShp = SketcherPrs_Tools::getShape(aFeature->firstResult());
+ GeomCurvePtr aCurv = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp));
+ aList.push_back(aFeature->firstResult());
+ }
+ } else if ((aFeature->getKind() == SketchPlugin_Circle::ID()) ||
+ (aFeature->getKind() == SketchPlugin_Arc::ID())) {
+ GeomCurvePtr aCurve;
+ ObjectPtr aResObj;
+ std::list<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr>::const_iterator aIt;
+ for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) {
+ GeomShapePtr aShp = SketcherPrs_Tools::getShape((*aIt));
+ if (aShp->isEdge()) {
+ aResObj = (*aIt);
+ aCurve = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp));
+ break;
+ }
+ }
+ if (aCurve.get()) {
+ double aStart = aCurve->startParam();
+ double aEnd = aCurve->endParam();
+ GeomCirclePtr aCircle = GeomCirclePtr(new GeomAPI_Circ(aCurve));
+ double aParam;
+ if (aCircle->parameter(thePnt, 1.e-4, aParam) && (aParam >= aStart) && (aParam <= aEnd))
+ aList.push_back(aResObj);
+ }
+ }
+ }