From b0180f476ce0a3a23087556c9819ba46f4227381 Mon Sep 17 00:00:00 2001 From: dmv Date: Tue, 4 Dec 2007 16:03:11 +0000 Subject: [PATCH] NPAL 16768 Select Vertex from Vertex on Shape --- src/BasicGUI/BasicGUI_ArcDlg.cxx | 33 +++++++- src/BasicGUI/BasicGUI_CircleDlg.cxx | 52 ++++++------- src/BasicGUI/BasicGUI_CurveDlg.cxx | 35 ++++++++- src/BasicGUI/BasicGUI_EllipseDlg.cxx | 33 +++++++- src/BasicGUI/BasicGUI_LineDlg.cxx | 39 ++++++++-- src/BasicGUI/BasicGUI_MarkerDlg.cxx | 6 +- src/BasicGUI/BasicGUI_PlaneDlg.cxx | 53 ++++++------- src/BasicGUI/BasicGUI_PointDlg.cxx | 70 ++++++++--------- src/BasicGUI/BasicGUI_VectorDlg.cxx | 26 ++++++- src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx | 2 - src/GEOMImpl/GEOMImpl_ILocalOperations.cxx | 4 +- src/GenerationGUI/GenerationGUI_PrismDlg.cxx | 75 +++++++++++-------- src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx | 35 +++++++-- src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx | 57 +++++++------- src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx | 55 +++++++------- src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx | 34 +++++++-- src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx | 54 ++++++------- .../TransformationGUI_MirrorDlg.cxx | 3 +- .../TransformationGUI_RotationDlg.cxx | 46 ++++++------ .../TransformationGUI_ScaleDlg.cxx | 35 ++++++++- .../TransformationGUI_TranslationDlg.cxx | 55 ++++++-------- 21 files changed, 494 insertions(+), 308 deletions(-) diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 11052a67d..7c1b8741f 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -33,6 +33,13 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include +#include + #include #include @@ -174,7 +181,7 @@ void BasicGUI_ArcDlg::ConstructorsClicked (int constructorId) { case 0: { - globalSelection( GEOM_POINT ); + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes Group3Pnts->show(); resize(0, 0); @@ -190,7 +197,7 @@ void BasicGUI_ArcDlg::ConstructorsClicked (int constructorId) } case 1: { - globalSelection( GEOM_POINT ); + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes Group3Pnts->hide(); resize(0, 0); @@ -280,11 +287,30 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + // Get Selected object if selected subshape + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } switch (getConstructorId()) { case 0: { - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; @@ -292,7 +318,6 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() } case 1: { - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = aSelectedObject; diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index 602e0d223..fe5ba5a80 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -241,7 +241,9 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) } myEditCurrentArgument->setFocus(); - globalSelection( GEOM_POINT ); + // globalSelection( GEOM_POINT ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_VERTEX ); connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -307,34 +309,27 @@ void BasicGUI_CircleDlg::SelectionIntoArgument() if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); - if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = aSelectedObject; - else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) + // If selected Vertex or Edge on the some Shape Get selection Subshape + TopoDS_Shape aShape; + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - if ( aRes && !aSelectedObject->_is_nil() ) + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + TColStd_IndexedMapOfInteger aMap; + aSelMgr->GetIndexes( anIO, aMap ); + if ( aMap.Extent() == 1 ) { - TopoDS_Shape aShape; - - if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) - { - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes( anIO, aMap ); - if ( aMap.Extent() == 1 ) - { - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations( getStudyId() ); - int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); - myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex); - aSelMgr->clearSelected(); - } - else - myDir = aSelectedObject; - } + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); } } + if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = aSelectedObject; + else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; @@ -367,12 +362,13 @@ void BasicGUI_CircleDlg::SetEditCurrentArgument() if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) { - //globalSelection( GEOM_LINE ); GEOM::GEOM_Object_var anObj; localSelection( anObj, TopAbs_EDGE ); } - else - globalSelection( GEOM_POINT ); + else { + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); + } SelectionIntoArgument(); } diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index 69a25e857..5ad899a0a 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -39,6 +39,12 @@ #include "SALOME_ListIteratorOfListIO.hxx" #include "SALOME_ListIO.hxx" +#include +#include +#include +#include +#include + #include "GEOMImpl_Types.hxx" using namespace std; @@ -106,7 +112,8 @@ void BasicGUI_CurveDlg::Init() myPoints = new GEOM::ListOfGO(); myPoints->length( 0 ); - globalSelection( GEOM_POINT ); + // globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); @@ -275,9 +282,30 @@ void BasicGUI_CurveDlg::SelectionIntoArgument() { //TopoDS_Shape aPointShape; //if ( myGeomBase->GetShape( aSelectedObject, aPointShape, TopAbs_VERTEX ) ) + + TopoDS_Shape aShape; + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) + { + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + TColStd_IndexedMapOfInteger aMap; + aSelMgr->GetIndexes( anIt.Value(), aMap ); + if ( aMap.Extent() == 1 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } + int pos = isPointInList(myOrderedSel,aSelectedObject); if(is_append && pos==-1) - myOrderedSel.push_back(aSelectedObject); + myOrderedSel.push_back(aSelectedObject); + myPoints[i++] = aSelectedObject; } } @@ -314,7 +342,8 @@ void BasicGUI_CurveDlg::ActivateThisDialog() // myGeomGUI->SetState( 0 ); - globalSelection( GEOM_POINT ); + // globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); ConstructorsClicked( getConstructorId() ); } diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index 7103838b5..e36199155 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -32,6 +32,13 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include +#include + #include #include "GEOMImpl_Types.hxx" @@ -101,7 +108,8 @@ void BasicGUI_EllipseDlg::Init() { /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; - globalSelection( GEOM_POINT ); + // globalSelection( GEOM_POINT ); + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes myPoint = myDir = GEOM::GEOM_Object::_nil(); @@ -207,6 +215,25 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + // Get Selected object if selected subshape + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = aSelectedObject; } @@ -228,9 +255,9 @@ void BasicGUI_EllipseDlg::SetEditCurrentArgument() myEditCurrentArgument->setFocus(); if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) - globalSelection( GEOM_LINE ); + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); else - globalSelection( GEOM_POINT ); + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); SelectionIntoArgument(); } diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index 117c519f0..ea8eea98e 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -33,6 +33,12 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include + #include #include "GEOMImpl_Types.hxx" @@ -117,7 +123,7 @@ void BasicGUI_LineDlg::Init() myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); // myGeomGUI->SetState( 0 ); - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); @@ -173,7 +179,13 @@ bool BasicGUI_LineDlg::ClickOnApply() { if ( !onAccept() ) return false; - + GroupPoints->LineEdit1->setText( "" ); + GroupPoints->LineEdit2->setText( "" ); + GroupFaces->LineEdit1->setText( "" ); + GroupFaces->LineEdit2->setText( "" ); + myPoint1 = myPoint2 = myFace1 = myFace2 = GEOM::GEOM_Object::_nil(); + myEditCurrentArgument = GroupPoints->LineEdit1; + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select vertex on all shapes initName(); return true; } @@ -193,7 +205,6 @@ void BasicGUI_LineDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument->setText(""); myPoint1 = GEOM::GEOM_Object::_nil(); myPoint2 = GEOM::GEOM_Object::_nil(); - globalSelection( GEOM_POINT ); GroupPoints->show(); GroupFaces->hide(); break; @@ -205,7 +216,6 @@ void BasicGUI_LineDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument->setText(""); myFace1 = GEOM::GEOM_Object::_nil(); myFace2 = GEOM::GEOM_Object::_nil(); - globalSelection( GEOM_FACE ); GroupPoints->hide(); GroupFaces->show(); break; @@ -240,6 +250,24 @@ void BasicGUI_LineDlg::SelectionIntoArgument() if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) myFace1 = aSelectedObject; @@ -293,7 +321,8 @@ void BasicGUI_LineDlg::ActivateThisDialog() SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); // myGeomGUI->SetState( 0 ); - globalSelection( GEOM_POINT ); + // globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setFocus(); diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.cxx b/src/BasicGUI/BasicGUI_MarkerDlg.cxx index 17f6d25b4..00a843430 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.cxx +++ b/src/BasicGUI/BasicGUI_MarkerDlg.cxx @@ -258,7 +258,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) //PAL6669: resize(0, 0); Group2->show(); - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); myEditCurrentArgument = Group2->LineEdit1; Group2->LineEdit1->setText(""); Group2->LineEdit2->setText(""); @@ -558,14 +558,16 @@ void BasicGUI_MarkerDlg::SetEditCurrentArgument() else if(send == Group2->PushButton1) { myEditCurrentArgument = Group2->LineEdit1; globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } else if(send == Group2->PushButton2) { myEditCurrentArgument = Group2->LineEdit2; globalSelection( GEOM_LINE ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } else if(send == Group2->PushButton3) { myEditCurrentArgument = Group2->LineEdit3; - globalSelection( GEOM_LINE ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } myEditCurrentArgument->setFocus(); diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index c3a3ddd4f..a6f6c7965 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -216,7 +216,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId) GroupPntDir->LineEdit2->setText(tr("")); /* for the first argument */ - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); break; } case 1: /* plane from 3 points */ @@ -232,7 +232,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId) Group3Pnts->LineEdit3->setText(""); /* for the first argument */ - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); break; } case 2: /* plane from a planar face selection */ @@ -320,39 +320,31 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument() if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject; - else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) { - if ( aRes && !aSelectedObject->_is_nil() ) - { - 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 ) - { - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations( getStudyId() ); - int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); - myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex); - aSelMgr->clearSelected(); - } - else - myDir = aSelectedObject; - } - } - } + else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace = aSelectedObject; } - displayPreview(); } @@ -375,7 +367,6 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument() myEditCurrentArgument->setFocus(); if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) { - //globalSelection( GEOM_LINE ); GEOM::GEOM_Object_var anObj; localSelection( anObj, TopAbs_EDGE ); } @@ -387,7 +378,7 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument() globalSelection( aMap ); } else - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); SelectionIntoArgument(); } diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 93d2fb470..213577ce0 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -253,7 +253,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument->setText(""); myRefPoint = GEOM::GEOM_Object::_nil(); - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); GroupXYZ->hide(); GroupOnCurve->hide(); @@ -268,7 +268,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument->setText(""); myEdge = GEOM::GEOM_Object::_nil(); - globalSelection( GEOM_EDGE ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); GroupXYZ->hide(); GroupRefPoint->hide(); @@ -285,7 +285,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) myLine1 = GEOM::GEOM_Object::_nil(); myLine2 = GEOM::GEOM_Object::_nil(); - globalSelection( GEOM_EDGE ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); GroupXYZ->hide(); GroupRefPoint->hide(); @@ -366,36 +366,32 @@ void BasicGUI_PointDlg::SelectionIntoArgument() Standard_Boolean aRes = Standard_False; Handle(SALOME_InteractiveObject) anIO = firstIObject(); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + QString aName = GEOMBase::GetName( aSelectedObject ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } if ( id == 0 ) { - // get CORBA reference to data object - TopoDS_Shape aShape = myGeomGUI->GetShapeReader().GetShape - ( myGeomGUI->GetGeomGen(), aSelectedObject ); - if ( aShape.IsNull() ) - return; - - if ( aShape.ShapeType() != TopAbs_VERTEX ) - { - TColStd_IndexedMapOfInteger aMap; - LightApp_Application* anApp = - (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - anApp->selectionMgr()->GetIndexes( anIO, aMap ); - - if ( aMap.Extent() == 1 ) - { - int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); - - if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX ) - return; - } - else - return; - } + if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX ) + return; gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); GroupXYZ->SpinBox_DX->SetValue( aPnt.X() ); @@ -405,22 +401,22 @@ void BasicGUI_PointDlg::SelectionIntoArgument() else if ( id == 1 ) { myRefPoint = aSelectedObject; - GroupRefPoint->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); + GroupRefPoint->LineEdit1->setText( aName ); } else if ( id == 2 ) { myEdge = aSelectedObject; - GroupOnCurve->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); + GroupOnCurve->LineEdit1->setText( aName ); } else if ( id == 3 ) { if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) { myLine1 = aSelectedObject; - GroupLineIntersection->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); + GroupLineIntersection->LineEdit1->setText( aName ); } else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) { myLine2 = aSelectedObject; - GroupLineIntersection->LineEdit2->setText( GEOMBase::GetName( aSelectedObject ) ); + GroupLineIntersection->LineEdit2->setText( aName ); } } } @@ -459,28 +455,28 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() GroupRefPoint->LineEdit1->setFocus(); myEditCurrentArgument = GroupRefPoint->LineEdit1; - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } else if ( send == GroupOnCurve->PushButton1 ) { GroupOnCurve->LineEdit1->setFocus(); myEditCurrentArgument = GroupOnCurve->LineEdit1; - globalSelection( GEOM_EDGE ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } else if ( send == GroupLineIntersection->PushButton1 ) { GroupLineIntersection->LineEdit1->setFocus(); myEditCurrentArgument = GroupLineIntersection->LineEdit1; - globalSelection( GEOM_EDGE ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } else if ( send == GroupLineIntersection->PushButton2 ) { GroupLineIntersection->LineEdit2->setFocus(); myEditCurrentArgument = GroupLineIntersection->LineEdit2; - globalSelection( GEOM_EDGE ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } } diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index 79a4f90c2..e045fb66a 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -33,6 +33,12 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include + #include #include "GEOMImpl_Types.hxx" @@ -186,7 +192,7 @@ void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId ) GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; @@ -271,6 +277,24 @@ void BasicGUI_VectorDlg::SelectionIntoArgument() if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; } diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx index 7cfa245d0..4b3c61917 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -372,13 +372,11 @@ void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument() myEditCurrentArgument = Group2->LineEdit1; GEOM::GEOM_Object_var anObj; localSelection( anObj, TopAbs_EDGE ); - //globalSelection( GEOM_LINE ); } else if(send == Group2->PushButton2) { myEditCurrentArgument = Group2->LineEdit2; GEOM::GEOM_Object_var anObj; localSelection( anObj, TopAbs_EDGE ); - //globalSelection( GEOM_LINE ); } myEditCurrentArgument->setFocus(); diff --git a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx index 14ef16443..77dc109a0 100644 --- a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx @@ -768,8 +768,8 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdges } } catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); return NULL; } diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index a677f3a46..c6141aa2b 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -284,42 +284,38 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_ptr aSelectedObject = - GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if (!testResult) return; + myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } + if (myEditCurrentArgument == GroupPoints->LineEdit1) { myBase = aSelectedObject; myOkBase = true; } else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - if ( testResult && !aSelectedObject->_is_nil() ) - { - 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 ) - { - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations( getStudyId() ); - int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); - myVec = aShapesOp->GetSubShape(aSelectedObject, anIndex); - aSelMgr->clearSelected(); - } - else - myVec = aSelectedObject; - - myOkVec = true; - } - } + myVec = aSelectedObject; + myOkVec = true; } myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); } @@ -347,6 +343,26 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() if (!testResult || CORBA::is_nil( aSelectedObject )) return; + myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } + if (myEditCurrentArgument == GroupPoints2->LineEdit1) { myBase = aSelectedObject; myOkBase = true; @@ -360,7 +376,6 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() myOkPnt2 = true; } - myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); } displayPreview(); @@ -414,12 +429,12 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument() else if (send == GroupPoints2->PushButton2) { GroupPoints2->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints2->LineEdit2; - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } else if (send == GroupPoints2->PushButton3) { GroupPoints2->LineEdit3->setFocus(); myEditCurrentArgument = GroupPoints2->LineEdit3; - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } myEditCurrentArgument->setFocus(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index 7230ca6a5..aa4ad1b91 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -33,6 +33,12 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include + #include #include "GEOMImpl_Types.hxx" @@ -166,7 +172,8 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId) { case 0: { - globalSelection( GEOM_POINT ); + // globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); GroupDimensions->hide(); resize(0, 0); @@ -246,14 +253,31 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument() if(!testResult || CORBA::is_nil( aSelectedObject )) return; - + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } if(myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1 = aSelectedObject; else if(myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2 = aSelectedObject; - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); - displayPreview(); } @@ -271,7 +295,8 @@ void PrimitiveGUI_BoxDlg::SetEditCurrentArgument() else if(send == GroupPoints->PushButton2) myEditCurrentArgument = GroupPoints->LineEdit2; - globalSelection( GEOM_POINT ); + // globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); myEditCurrentArgument->setFocus(); SelectionIntoArgument(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index 92c1474fc..8a7659e1d 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -186,7 +186,8 @@ void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId) { case 0 : { - globalSelection( GEOM_POINT ); + // globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); GroupDimensions->hide(); resize(0, 0); GroupPoints->show(); @@ -274,35 +275,30 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument() if(!testResult || CORBA::is_nil( aSelectedObject )) return; + TopoDS_Shape aShape; + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - if ( testResult && !aSelectedObject->_is_nil() ) - { - 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 ) - { - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations( getStudyId() ); - int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); - myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex); - aSelMgr->clearSelected(); - } - else - myDir = aSelectedObject; - } - } - } - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myDir = aSelectedObject; + displayPreview(); } @@ -317,12 +313,13 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument() if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; - globalSelection( GEOM_POINT ); + // globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } else if(send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; // globalSelection( GEOM_LINE ); - GEOM::GEOM_Object_var anObj; + GEOM::GEOM_Object_var anObj; localSelection( anObj, TopAbs_EDGE ); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index 25db439b8..168a25159 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -179,7 +179,8 @@ void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId) { case 0 : { - globalSelection( GEOM_POINT ); + // globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); GroupDimensions->hide(); resize(0, 0); @@ -269,35 +270,30 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() if(!testResult || CORBA::is_nil( aSelectedObject )) return; - + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - if ( testResult && !aSelectedObject->_is_nil() ) - { - 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 ) - { - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations( getStudyId() ); - int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); - myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex); - aSelMgr->clearSelected(); - } - else - myDir = aSelectedObject; - } - } - } - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myDir = aSelectedObject; displayPreview(); } @@ -312,7 +308,8 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument() if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; - globalSelection( GEOM_POINT ); + // globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } else if(send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index f7a79b152..b1b56fea6 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -33,6 +33,12 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include + #include #include "GEOMImpl_Types.hxx" @@ -151,7 +157,7 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId) { case 0: { - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); GroupDimensions->hide(); resize(0, 0); GroupPoints->show(); @@ -237,10 +243,28 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument() if (!testResult || CORBA::is_nil( aSelectedObject )) return; - + + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } myPoint = aSelectedObject; - myEditCurrentArgument->setText( GEOMBase::GetName( myPoint ) ); - + displayPreview(); } @@ -271,7 +295,7 @@ void PrimitiveGUI_SphereDlg::SetEditCurrentArgument() if(send == GroupPoints->PushButton1) { GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); SelectionIntoArgument(); } } diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index 6f561260a..dad4b531f 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -179,7 +179,7 @@ void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId) { case 0: { - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); GroupDimensions->hide(); resize(0, 0); @@ -262,35 +262,30 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument() if (!testResult || CORBA::is_nil( aSelectedObject )) return; + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - if ( testResult && !aSelectedObject->_is_nil() ) - { - 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 ) - { - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations( getStudyId() ); - int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); - myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex); - aSelMgr->clearSelected(); - } - else - myDir = aSelectedObject; - } - } - } - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myDir = aSelectedObject; + displayPreview(); } @@ -321,11 +316,10 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument() if (send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } else if (send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; - // globalSelection( GEOM_LINE ); GEOM::GEOM_Object_var anObj; localSelection( anObj, TopAbs_EDGE ); } diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index 4e555b021..b5d2df706 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -304,7 +304,8 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument() { case 0: { - globalSelection( GEOM_POINT ); + // globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); break; } case 1: diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index 30790bb59..5f2a52909 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -269,31 +269,28 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() if(!testResult || CORBA::is_nil( aSelectedObject )) return; - if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) { - if ( testResult && !aSelectedObject->_is_nil() ) + aName = GEOMBase::GetName( aSelectedObject ); + TopoDS_Shape aShape; + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { - 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 ) { - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes( firstIObject(), aMap ); - if ( aMap.Extent() == 1 ) - { - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations( getStudyId() ); - int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); - myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex); - aSelMgr->clearSelected(); - } - else - myAxis = aSelectedObject; + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); } } - } + + if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) + myAxis = aSelectedObject; else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) myCentPoint = aSelectedObject; else if(myEditCurrentArgument == GroupPoints->LineEdit4) @@ -301,7 +298,6 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() else if(myEditCurrentArgument == GroupPoints->LineEdit5) myPoint2 = aSelectedObject; - aName = GEOMBase::GetName( aSelectedObject ); } myEditCurrentArgument->setText( aName ); @@ -329,17 +325,17 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument() localSelection( anObj, TopAbs_EDGE ); } else - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } else if (send == GroupPoints->PushButton4) { myEditCurrentArgument = GroupPoints->LineEdit4; - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } else if (send == GroupPoints->PushButton5) { myEditCurrentArgument = GroupPoints->LineEdit5; - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } myEditCurrentArgument->setFocus(); diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index 44ec3615a..e24173dcf 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -33,6 +33,12 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include + #include #include @@ -194,10 +200,33 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument() return; } Standard_Boolean testResult = Standard_False; - myPoint = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + aName = GEOMBase::GetName( aSelectedObject ); + + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } + + myPoint = aSelectedObject; + if(!testResult || CORBA::is_nil( myPoint )) return; - aName = GEOMBase::GetName( myPoint ); + } myEditCurrentArgument->setText( aName ); @@ -235,7 +264,7 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument() } else if(send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } myEditCurrentArgument->setFocus(); diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index 659819a76..24dc59016 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -283,38 +283,32 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument() if (!testResult || CORBA::is_nil( aSelectedObject )) return; - if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) - myPoint1 = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) { - if ( testResult && !aSelectedObject->_is_nil() ) - { - 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 ) - { - GEOM::GEOM_IShapesOperations_var aShapesOp = - getGeomEngine()->GetIShapesOperations( getStudyId() ); + TopoDS_Shape aShape; + aName = GEOMBase::GetName( aSelectedObject ); + 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 ) + { + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); int anIndex = aMap( 1 ); TopTools_IndexedMapOfShape aShapes; TopExp::MapShapes( aShape, aShapes ); aShape = aShapes.FindKey( anIndex ); - myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelMgr->clearSelected(); - } - else - myVector = aSelectedObject; - } - } - } + } + } + + if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) + myPoint1 = aSelectedObject; + else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) + myVector = aSelectedObject; else if (myEditCurrentArgument == GroupPoints->LineEdit3) myPoint2 = aSelectedObject; - - aName = GEOMBase::GetName( aSelectedObject ); } myEditCurrentArgument->setText( aName ); @@ -352,16 +346,13 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument() else if (send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; if (getConstructorId() == 1) - globalSelection( GEOM_POINT ); - else { - //globalSelection( GEOM_LINE ); - GEOM::GEOM_Object_var anObj; - localSelection( anObj, TopAbs_EDGE ); - } + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + else + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } else if (send == GroupPoints->PushButton3) { myEditCurrentArgument = GroupPoints->LineEdit3; - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } myEditCurrentArgument->setFocus(); -- 2.39.2