X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_WidgetPoint2d.cpp;h=37d9fb01599b1bef5cfcb10f85d3e9520247a064;hb=ade68d25465a422af49d71881550bd89a2ecb824;hp=bf109cd6ed7eb9f50560884bd8a84e740774646a;hpb=2532fb2df83ee1ddd9ff3e8b381d3788eaa15b69;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index bf109cd6e..37d9fb015 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -14,7 +14,8 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com // #include "PartSet_WidgetPoint2d.h" @@ -22,6 +23,7 @@ #include #include #include +#include #include #include @@ -75,6 +77,7 @@ #include #include #include +#include #include #include @@ -355,10 +358,24 @@ bool PartSet_WidgetPoint2D::storeValueCustom() // myYSpin->hasVariable() ? myYSpin->text().toStdString() : ""); //aPoint->setValue(!myXSpin->hasVariable() ? myXSpin->value() : aPoint->x(), // !myYSpin->hasVariable() ? myYSpin->value() : aPoint->y()); - aPoint->setValue(myXSpin->value(), myYSpin->value()); - // after movement the solver will call the update event: optimization - moveObject(myFeature); + if (myFeature->isMacro()) { + // Moving points of macro-features has been processed directly (without solver) + aPoint->setValue(myXSpin->value(), myYSpin->value()); + updateObject(myFeature); + + } else { + if (!aPoint->isInitialized()) + aPoint->setValue(0., 0.); + + std::shared_ptr aMessage( + new ModelAPI_ObjectMovedMessage(this)); + aMessage->setMovedAttribute(aPoint); + aMessage->setOriginalPosition(aPoint->pnt()); + aMessage->setCurrentPosition(myXSpin->value(), myYSpin->value()); + Events_Loop::loop()->send(aMessage); + } + aPoint->setImmutable(isImmutable); that->blockSignals(isBlocked); @@ -577,6 +594,7 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo if (!aFirstValue.get() && myPreSelected.get()) { aFirstValue = myPreSelected; } + // if we have selection and use it if (aFirstValue.get() && isValidSelectionCustom(aFirstValue) && aFirstValue->shape().get()) { /// Trihedron Axis may be selected, but shape is empty @@ -600,7 +618,11 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo else { anExternal = true; if (!aFixedObject.get()) - aFixedObject = PartSet_Tools::createFixedObjectByExternal(aShape, aObject, mySketch); + { + FeaturePtr aCreatedFeature; + aFixedObject = PartSet_Tools::createFixedObjectByExternal(aGeomShape, aObject, mySketch, + false, aCreatedFeature); + } } } if (anExternal) { @@ -692,7 +714,36 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo } } } - // End of Bug dependent fragment + // The selection could be a center of an external circular object + else if (aFirstValue.get() && (!aFirstValue->interactive().IsNull())) { + Handle(PartSet_CenterPrs) aAIS = + Handle(PartSet_CenterPrs)::DownCast(aFirstValue->interactive()); + if (!aAIS.IsNull()) { + gp_Pnt aPntComp = aAIS->Component()->Pnt(); + GeomVertexPtr aVertPtr(new GeomAPI_Vertex(aPntComp.X(), aPntComp.Y(), aPntComp.Z())); + TopoDS_Shape aShape = aVertPtr->impl(); + + ResultPtr aFixedObject = + PartSet_Tools::findFixedObjectByExternal(aShape, aAIS->object(), mySketch); + if (!aFixedObject.get()) + aFixedObject = PartSet_Tools::createFixedByExternalCenter(aAIS->object(), aAIS->edge(), + aAIS->centerType(), mySketch); + if (aFixedObject.get()) + setConstraintToObject(aFixedObject); + // fignal updated should be flushed in order to visualize possible created + // external objects e.g. selection of trihedron axis when input end arc point + updateObject(feature()); + + double aX, aY; + if (getPoint2d(aView, aShape, aX, aY)) { + // do not create a constraint to the point, which already used by the feature + // if the feature contains the point, focus is not switched + setPoint(aX, aY); + } + emit vertexSelected(); // it stops the reentrant operation + emit focusOutWidget(this); + } + } else { // A case when point is taken from mouse event gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView());