X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_ConstraintRadius.cpp;h=fd429a544a241b97a99501dc5dd58b63a0e2938b;hb=cdd9efd8fbc75f120188ae16eed7471dc6492ac3;hp=133bc91bb74e8639694c2193eb7e372e1b58518d;hpb=c3abf4152cb6f2fce8a3c528f9104c0058f3cc3c;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp index 133bc91bb..fd429a544 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp @@ -55,7 +55,9 @@ void SketchPlugin_ConstraintRadius::execute() } boost::shared_ptr aValueAttr = boost::dynamic_pointer_cast< ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE())); - aValueAttr->setValue(aRadius); + if(!aValueAttr->isInitialized()) { + aValueAttr->setValue(aRadius); + } } } @@ -77,9 +79,10 @@ AISObjectPtr SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePreviou // Flyout point boost::shared_ptr aFlyoutAttr = boost::dynamic_pointer_cast< GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); - if (!aFlyoutAttr->isInitialized()) - return thePrevious; - boost::shared_ptr aFlyoutPnt = sketch()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y()); + boost::shared_ptr aFlyoutPnt; + if (aFlyoutAttr->isInitialized()) { + aFlyoutPnt = sketch()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y()); + } // Prepare a circle aData = aFeature->data(); @@ -91,12 +94,26 @@ AISObjectPtr SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePreviou AttributeDoublePtr aCircRadius = boost::dynamic_pointer_cast( aData->attribute(SketchPlugin_Circle::RADIUS_ID())); aRadius = aCircRadius->value(); + if (!aFlyoutPnt) { + double aShift = aRadius * 1.1; + boost::shared_ptr aPnt = aCenterAttr->pnt(); + boost::shared_ptr aFPnt = + boost::shared_ptr(new GeomAPI_Pnt2d(aPnt->x() + aShift, aPnt->y() + aShift)); + aFlyoutAttr->setValue(aFPnt); + aFlyoutPnt = sketch()->to3D(aFPnt->x(), aFPnt->y()); + } } else if (aKind == SketchPlugin_Arc::ID()) { aCenterAttr = boost::dynamic_pointer_cast( aData->attribute(SketchPlugin_Arc::CENTER_ID())); boost::shared_ptr aStartAttr = boost::dynamic_pointer_cast< GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID())); aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt()); + if (!aFlyoutPnt) { + boost::shared_ptr aStartAttr = boost::dynamic_pointer_cast< + GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID())); + aFlyoutAttr->setValue(aStartAttr->pnt()); + aFlyoutPnt = sketch()->to3D(aStartAttr->pnt()->x(), aStartAttr->pnt()->y()); + } } boost::shared_ptr aCenter = sketch()->to3D(aCenterAttr->x(), aCenterAttr->y());