X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_ConstraintParallel.cpp;h=f77c95d27ad041f871daaaabb84a9542b5e882e5;hb=47d69c6e766821c1296c5147a6248ae49020c7dd;hp=92e23ead40c5c274df3cc10ab2bf83b5b4dc5bc5;hpb=5b8faa76d601d5dace07f2184378cc85b9e52438;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp b/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp index 92e23ead4..f77c95d27 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp @@ -6,13 +6,17 @@ #include #include + #include +#include #include #include #include #include +#include +#include SketchPlugin_ConstraintParallel::SketchPlugin_ConstraintParallel() { @@ -61,11 +65,16 @@ Handle_AIS_InteractiveObject SketchPlugin_ConstraintParallel::getAISShape(Handle boost::shared_ptr aLine2 = aLine2Feature->preview(); Handle(Geom_Plane) aPlane = new Geom_Plane(sketch()->plane()->impl()); + boost::shared_ptr aFlyoutAttr = + boost::dynamic_pointer_cast(aData->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT)); + boost::shared_ptr aFOPnt2d = aFlyoutAttr->pnt(); + boost::shared_ptr aFlyoutPnt = sketch()->to3D(aFOPnt2d->x(), aFOPnt2d->y()); + if (anAIS.IsNull()) { Handle(AIS_ParallelRelation) aParallel = new AIS_ParallelRelation(aLine1->impl(), aLine2->impl(), aPlane); - + aParallel->SetPosition(aFlyoutPnt->impl()); anAIS = aParallel; } else @@ -76,9 +85,21 @@ Handle_AIS_InteractiveObject SketchPlugin_ConstraintParallel::getAISShape(Handle aParallel->SetFirstShape(aLine1->impl()); aParallel->SetSecondShape(aLine2->impl()); aParallel->SetPlane(aPlane); + aParallel->SetPosition(aFlyoutPnt->impl()); aParallel->Redisplay(Standard_True); } } return anAIS; } +void SketchPlugin_ConstraintParallel::move(double theDeltaX, double theDeltaY) +{ + boost::shared_ptr aData = data(); + if (!aData->isValid()) + return; + + boost::shared_ptr aPoint = + boost::dynamic_pointer_cast(aData->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT)); + aPoint->setValue(aPoint->x() + theDeltaX, aPoint->y() + theDeltaY); +} +