From aeed1a0e704674bf18c055a0271eb7f136996b60 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 16 Jan 2017 18:30:21 +0300 Subject: [PATCH] Issue #1787 : isAxisSelected() is workaround and should be replaced on code to make coincidence to existing external feature. --- src/PartSet/PartSet_Tools.cpp | 33 --------------------------- src/PartSet/PartSet_Tools.h | 7 ------ src/PartSet/PartSet_WidgetPoint2d.cpp | 11 --------- 3 files changed, 51 deletions(-) diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index b5b5163ff..de6b4bdea 100755 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -563,16 +563,6 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); ResultPtr aRes = std::dynamic_pointer_cast(theObject); - /// check external line created on Trihedron Axis - /// selection of a point on external edge referenced to AIS_Trihedron axis - /// should be prohibited or point should be replaced to "Origin". The second - /// case is implemented because of not correct AIS_Trihedron origin point highlight - /// When AIS is corrected(exactly priority of origin and stayed vertex by highlight) - /// the next check should be moved to Partset 2d point widget in isValidSelectionCustom - bool isAxis = isAxisSelected(theObject); - if (isAxis) - aRes = ResultPtr(); // to rely on code below that found the Origin result - // if there is no object, // it means that this is the origin point: search it in the module document if (!aRes.get()) { @@ -628,29 +618,6 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap return ResultPtr(); } -bool PartSet_Tools::isAxisSelected(const ObjectPtr& theObject) -{ - bool isAxis = false; - ResultPtr aRes = std::dynamic_pointer_cast(theObject); - if (aRes.get()) { - // check if result belongs to external feature - // in this case we should use as a result reference of external feature - FeaturePtr aResFeature = ModelAPI_Feature::feature(aRes); - std::shared_ptr aSPFeature = - std::dynamic_pointer_cast(aResFeature); - if (aSPFeature.get() && aSPFeature->isExternal()) { - AttributeSelectionPtr aAttr = aResFeature->selection( - SketchPlugin_SketchEntity::EXTERNAL_ID()); - if (aAttr) { /// check if the result is Axis - ResultPtr anExternalRes = std::dynamic_pointer_cast(aAttr->context()); - FeaturePtr aResFeature = ModelAPI_Feature::feature(anExternalRes); - isAxis = aResFeature->getKind() == "Axis"; //ConstructionPlugin_Axis::ID() - } - } - } - return isAxis; -} - bool PartSet_Tools::isContainPresentation(const QList& theSelected, const ModuleBase_ViewerPrsPtr& thePrs) { diff --git a/src/PartSet/PartSet_Tools.h b/src/PartSet/PartSet_Tools.h index 63812a712..b4b26139c 100755 --- a/src/PartSet/PartSet_Tools.h +++ b/src/PartSet/PartSet_Tools.h @@ -180,13 +180,6 @@ public: CompositeFeaturePtr theSketch, const bool theTemporary = false); - - /// Checks if the shape is Origin, the conditions are the shape is a vertex and - /// selected feature is an external feature created on Axis - /// \param theObject a selected object in the viewer - /// \return boolean value - static bool isAxisSelected(const ObjectPtr& theObject); - /// Checks whether the list of selected presentations contains the given one /// \param theSelected a list of presentations /// \param thePrs a presentation to be found diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index 8c7d1031b..3ce8252b1 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -487,17 +487,6 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo anOrphanPoint = isOrphanPoint(aFixedFeature, mySketch, aX, aY); } } - else { - // point is taken from mouse event and set in attribute. - // It should be done before setting - // coinident constraint to the external line. If a point is created, it should be - // in the mouse clicked point - gp_Pnt aPoint = - PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView()); - double aX, anY; - PartSet_Tools::convertTo2D(aPoint, mySketch, aView, aX, anY); - setPoint(aX, anY); - } } if (aFixedObject.get()) setConstraintWith(aFixedObject); -- 2.39.2