From d34fc92202d3758bf3e5167fc0286ce7762b4ffa Mon Sep 17 00:00:00 2001 From: dmv Date: Tue, 11 Mar 2008 10:26:24 +0000 Subject: [PATCH] IPAL19097 npal16768 is not implemented for 'Normal to a face' --- src/MeasureGUI/MeasureGUI_NormaleDlg.cxx | 34 +++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx b/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx index 6714e4fb1..4bc7beb43 100644 --- a/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx @@ -32,6 +32,11 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include #include #include "GEOMImpl_Types.hxx" @@ -177,14 +182,37 @@ void MeasureGUI_NormaleDlg::SelectionIntoArgument() if (!testResult) return; + QString aName = GEOMBase::GetName(aSelectedObject); + if (myEditCurrentArgument == GroupArgs->LineEdit1) { myFace = aSelectedObject; } else if (myEditCurrentArgument == GroupArgs->LineEdit2) { + TopoDS_Shape aShape; + if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) + { + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + TColStd_IndexedMapOfInteger aMap; + aSelMgr->GetIndexes(firstIObject(), aMap); + if (aMap.Extent() == 1) // Local Selection + { + GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId()); + int anIndex = aMap( 1 ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aName += QString(":vertex_%1").arg(anIndex); + } + else // Global Selection + { + if (aShape.ShapeType() != TopAbs_VERTEX) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + } + } + } myPoint = aSelectedObject; } - myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); + myEditCurrentArgument->setText( aName ); displayPreview(); } @@ -211,14 +239,14 @@ void MeasureGUI_NormaleDlg::LineEditReturnPressed() void MeasureGUI_NormaleDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); + globalSelection(GEOM_FACE); if (send == GroupArgs->PushButton1) { myEditCurrentArgument = GroupArgs->LineEdit1; - globalSelection(GEOM_FACE); } else if (send == GroupArgs->PushButton2) { myEditCurrentArgument = GroupArgs->LineEdit2; - globalSelection(GEOM_POINT); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } myEditCurrentArgument->setFocus(); -- 2.39.2