From 62390c63cfcaf79e7ee1182aac74a015080db7bc Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 12 Apr 2017 16:13:55 +0300 Subject: [PATCH] Issue #1220 Crash when creating an arc passing through the arc connected to both ends --- src/PartSet/PartSet_SketcherReentrantMgr.cpp | 12 ++++++++++-- src/PartSet/PartSet_WidgetPoint2d.cpp | 7 +++++++ src/PartSet/PartSet_WidgetPoint2d.h | 8 ++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/PartSet/PartSet_SketcherReentrantMgr.cpp b/src/PartSet/PartSet_SketcherReentrantMgr.cpp index 23e759020..7006876a4 100644 --- a/src/PartSet/PartSet_SketcherReentrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReentrantMgr.cpp @@ -233,8 +233,16 @@ bool PartSet_SketcherReentrantMgr::processMouseReleased(ModuleBase_IViewWindow* myClickedSketchPoint = PartSet_Tools::getPnt2d(theEvent, theWindow, module()->sketchMgr()->activeSketch()); - if (!aPreSelected.empty()) - module()->getGeomSelection(aPreSelected.first(), mySelectedObject, mySelectedAttribute); + if (!aPreSelected.empty()) { + ModuleBase_ViewerPrsPtr aValue = aPreSelected.first(); + module()->getGeomSelection(aValue, mySelectedObject, mySelectedAttribute); + + PartSet_WidgetPoint2D* aPointWidget = dynamic_cast(anActiveWidget); + if (aPointWidget) { + GeomShapePtr aShape; + aPointWidget->getGeomSelection_(aValue, mySelectedObject, aShape); + } + } restartOperation(); myClickedSketchPoint = std::shared_ptr(); diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index ceb12eff0..56b1e9852 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -704,6 +704,13 @@ void PartSet_WidgetPoint2D::setPreSelection( myPreSelected = ModuleBase_ViewerPrsPtr(); } +void PartSet_WidgetPoint2D::getGeomSelection_(const std::shared_ptr& theValue, + ObjectPtr& theObject, + GeomShapePtr& theShape) +{ + myExternalObjectMgr->getGeomSelection(theValue, theObject, theShape, myWorkshop, sketch(), true); +} + void PartSet_WidgetPoint2D::mouseMoved(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent) { PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); diff --git a/src/PartSet/PartSet_WidgetPoint2d.h b/src/PartSet/PartSet_WidgetPoint2d.h index 06b8e4a37..4c7659deb 100755 --- a/src/PartSet/PartSet_WidgetPoint2d.h +++ b/src/PartSet/PartSet_WidgetPoint2d.h @@ -132,6 +132,14 @@ Q_OBJECT ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent); + /// Return an object and geom shape by the viewer presentation + /// \param thePrs a selection + /// \param theObject an output object + /// \param theShape a shape of the selection + void getGeomSelection_(const std::shared_ptr& theValue, + std::shared_ptr& theObject, + std::shared_ptr& theShape); + signals: /// Signal about selection of an existing vertex from an object void vertexSelected(); -- 2.39.2