From: dmv Date: Wed, 19 Dec 2007 10:06:25 +0000 (+0000) Subject: IPAL 18221 correct names and selection engine on NPAL 16768 X-Git-Tag: V3_2_9sp1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e8b2a375db7f6709be0b920874efc4500b457728;p=modules%2Fgeom.git IPAL 18221 correct names and selection engine on NPAL 16768 --- diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 7c1b8741f..636d9efb6 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -287,9 +287,9 @@ 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; + QString aName = GEOMBase::GetName( aSelectedObject ); if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); @@ -300,13 +300,14 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() 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(); + aName.append( ":vertex_" + QString::number( anIndex ) ); } } + + myEditCurrentArgument->setText( aName ); + switch (getConstructorId()) { case 0: diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index 5ad899a0a..b310190a3 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -30,6 +30,7 @@ #include "SUIT_Desktop.h" #include "SUIT_Session.h" #include "SalomeApp_Application.h" +#include "SalomeApp_Study.h" #include "LightApp_SelectionMgr.h" #include @@ -270,61 +271,97 @@ void BasicGUI_CurveDlg::SelectionIntoArgument() myEditCurrentArgument->setText(""); Standard_Boolean aRes = Standard_False; - int i = 0; int IOC = IObjectCount(); - bool is_append = myPoints->length() < IOC; // if true - add point, else remove - myPoints->length( IOC ); // this length may be greater than number of objects, + // bool is_append = myPoints->length() < IOC; // if true - add point, else remove + // myPoints->length( IOC ); // this length may be greater than number of objects, // that will actually be put into myPoints - for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + SalomeApp_Application* app = + dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + _PTR(Study) aDStudy = appStudy->studyDS(); + GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + + int anIndex; + TopoDS_Shape aShape; + TColStd_IndexedMapOfInteger aMapIndexes; + GEOM::GEOM_Object_var anObject; + std::list aList; + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected, QString::null, false ); + + for ( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() ) { GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - //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 ) + aSelMgr->GetIndexes( anIt.Value(), aMapIndexes ); + + if ( aMapIndexes.Extent() > 0 ) { - 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); - - myPoints[i++] = aSelectedObject; + for (int ii=1; ii <= aMapIndexes.Extent(); ii++) { + anIndex = aMapIndexes(ii); + QString aName = GEOMBase::GetName( aSelectedObject ); + aName = aName + ":vertex_" + QString::number( anIndex ); + anObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + //Find Object in study + _PTR(SObject) obj ( aDStudy->FindObjectID( anIt.Value()->getEntry() ) ); + bool inStudy = false; + for (_PTR(ChildIterator) iit (aDStudy->NewChildIterator(obj)); iit->More(); iit->Next()) { + _PTR(SObject) child (iit->Value()); + QString aChildName = child->GetName(); + if (aChildName == aName) { + inStudy = true; + CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(iit->Value()); + anObject = GEOM::GEOM_Object::_narrow( corbaObj ); + } + } + + if (!inStudy) + GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy), + anObject, aName, aSelectedObject); + + int pos = isPointInList(myOrderedSel, anObject); + if (pos==-1) { + myOrderedSel.push_back(anObject); + } + // if (!inStudy) + aList.push_back(anObject); + } + } else { // aMap.Extent() == 0 + int pos = isPointInList(myOrderedSel,aSelectedObject); + if(pos==-1) + myOrderedSel.push_back(aSelectedObject); + aList.push_back(aSelectedObject); + } + } } } - myPoints->length( i ); // this is the right length, smaller of equal to the previously set + myPoints->length( aList.size() ); + + int k=0; + for (list::iterator j=aList.begin();j!=aList.end();j++) + myPoints[k++] = *j; + if(IOC == 0) myOrderedSel.clear(); else - removeUnnecessaryPnt(myOrderedSel,myPoints); + removeUnnecessaryPnt(myOrderedSel, myPoints); - if(myOrderedSel.size() == myPoints->length()){ - int k=0; - for (list::iterator j=myOrderedSel.begin();j!=myOrderedSel.end();j++) - myPoints[k++] = *j; - } else { - //cout << "ERROR: Ordered sequence size != selection sequence size! ("<length()<<")"<LineEdit1->setText( QString::number( i ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) ); + // if ( myOrderedSel.size() == myPoints->length() ) { + myPoints->length( myOrderedSel.size() ); + k=0; + for (list::iterator j=myOrderedSel.begin();j!=myOrderedSel.end();j++) + myPoints[k++] = *j; + // } + + if ( myPoints->length() > 0 ) + GroupPoints->LineEdit1->setText( QString::number( myPoints->length() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) ); displayPreview(); } diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index e36199155..007c1990d 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -108,8 +108,7 @@ void BasicGUI_EllipseDlg::Init() { /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; - // globalSelection( GEOM_POINT ); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); myPoint = myDir = GEOM::GEOM_Object::_nil(); @@ -214,9 +213,10 @@ void BasicGUI_EllipseDlg::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; + QString aName = GEOMBase::GetName( aSelectedObject ); + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); @@ -227,13 +227,17 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() 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); + if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + aName.append( ":edge_" + QString::number( anIndex ) ); + else + aName.append( ":vertex_" + QString::number( anIndex ) ); aSelMgr->clearSelected(); } } + + myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = aSelectedObject; } @@ -249,6 +253,7 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() void BasicGUI_EllipseDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); + globalSelection( GEOM_POINT ); if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1; else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2; diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index ea8eea98e..11132227f 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -200,6 +200,7 @@ void BasicGUI_LineDlg::ConstructorsClicked(int constructorId) { case 0: { + globalSelection(GEOM_POINT); // to break previous local selection localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setText(""); @@ -211,6 +212,7 @@ void BasicGUI_LineDlg::ConstructorsClicked(int constructorId) } case 1: { + globalSelection(GEOM_PLANE); // to break previous local selection localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); myEditCurrentArgument = GroupFaces->LineEdit1; myEditCurrentArgument->setText(""); @@ -249,8 +251,9 @@ void BasicGUI_LineDlg::SelectionIntoArgument() GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); TopoDS_Shape aShape; + QString aName = GEOMBase::GetName( aSelectedObject ); + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); @@ -261,13 +264,17 @@ void BasicGUI_LineDlg::SelectionIntoArgument() GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); + if ( myEditCurrentArgument == GroupFaces->LineEdit1 || + myEditCurrentArgument == GroupFaces->LineEdit2 ) + aName.append( ":face_" + QString::number( anIndex ) ); + else + aName.append( ":vertex_" + QString::number( anIndex ) ); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelMgr->clearSelected(); } } + myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) myFace1 = aSelectedObject; @@ -321,7 +328,6 @@ void BasicGUI_LineDlg::ActivateThisDialog() SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); // myGeomGUI->SetState( 0 ); - // globalSelection( GEOM_POINT ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); myEditCurrentArgument = GroupPoints->LineEdit1; diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index a6f6c7965..0bc6784e8 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -216,6 +216,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId) GroupPntDir->LineEdit2->setText(tr("")); /* for the first argument */ + globalSelection( GEOM_POINT ); // to break previous local selection localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); break; } @@ -232,6 +233,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId) Group3Pnts->LineEdit3->setText(""); /* for the first argument */ + globalSelection( GEOM_POINT ); // to break previous local selection localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); break; } @@ -246,7 +248,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId) GroupFace->LineEdit1->setText(tr("")); /* for the first argument */ - //globalSelection( GEOM_PLANE ); + globalSelection( GEOM_PLANE ); TColStd_MapOfInteger aMap; aMap.Add( GEOM_PLANE ); aMap.Add( GEOM_MARKER ); @@ -319,8 +321,9 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument() GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); TopoDS_Shape aShape; + QString aName = GEOMBase::GetName( aSelectedObject ); + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); @@ -331,13 +334,17 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument() 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); + if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) + aName.append( ":edge_" + QString::number( anIndex ) ); + else + aName.append( ":vertex_" + QString::number( anIndex ) ); + aSelMgr->clearSelected(); } } + myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject; else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; @@ -356,6 +363,7 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument() void BasicGUI_PlaneDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); + globalSelection( GEOM_POINT ); if ( send == GroupPntDir->PushButton1 ) myEditCurrentArgument = GroupPntDir->LineEdit1; else if ( send == GroupPntDir->PushButton2 ) myEditCurrentArgument = GroupPntDir->LineEdit2; @@ -366,12 +374,10 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument() myEditCurrentArgument->setFocus(); - if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) { - GEOM::GEOM_Object_var anObj; - localSelection( anObj, TopAbs_EDGE ); - } + if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) { - //globalSelection( GEOM_PLANE ); + globalSelection( GEOM_PLANE ); TColStd_MapOfInteger aMap; aMap.Add( GEOM_PLANE ); aMap.Add( GEOM_MARKER ); diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 9756daf06..dc932e2a4 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -240,6 +240,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) { case 0: { + globalSelection( GEOM_POINT); // to break previous local selection localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); GroupRefPoint->hide(); @@ -254,7 +255,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument = GroupRefPoint->LineEdit1; myEditCurrentArgument->setText(""); myRefPoint = GEOM::GEOM_Object::_nil(); - + globalSelection( GEOM_POINT); // to break previous local selection localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); GroupXYZ->hide(); @@ -269,7 +270,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument = GroupOnCurve->LineEdit1; myEditCurrentArgument->setText(""); myEdge = GEOM::GEOM_Object::_nil(); - + globalSelection( GEOM_LINE); // to break previous local selection localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); GroupXYZ->hide(); @@ -286,7 +287,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) GroupLineIntersection->LineEdit2->setText(""); myLine1 = GEOM::GEOM_Object::_nil(); myLine2 = GEOM::GEOM_Object::_nil(); - + globalSelection( GEOM_EDGE); // to break previous local selection localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); GroupXYZ->hide(); @@ -373,25 +374,30 @@ void BasicGUI_PointDlg::SelectionIntoArgument() { 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); - } - } + { + 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 ); + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + if ( id == 2 || id == 3 ) + aName.append( ":edge_" + QString::number( anIndex ) ); + else + aName.append( ":vertex_" + QString::number( anIndex ) ); + aSelMgr->clearSelected(); + } + } + if ( id == 0 ) { - if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX ) - return; + GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ); + + if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX ) + return; gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); GroupXYZ->SpinBox_DX->SetValue( aPnt.X() ); @@ -449,6 +455,7 @@ void BasicGUI_PointDlg::LineEditReturnPressed() void BasicGUI_PointDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); + globalSelection( GEOM_POINT); // to break previous local selection if ( send == GroupRefPoint->PushButton1 ) { diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index e045fb66a..534e02591 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -276,8 +276,9 @@ void BasicGUI_VectorDlg::SelectionIntoArgument() GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); TopoDS_Shape aShape; + QString aName = GEOMBase::GetName( aSelectedObject ); + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); @@ -288,13 +289,13 @@ void BasicGUI_VectorDlg::SelectionIntoArgument() GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); + aName.append( ":vertex_" + QString::number( anIndex ) ); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelMgr->clearSelected(); } } + myEditCurrentArgument->setText( aName ); + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; } diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 36e0dbd4b..680043394 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -239,7 +239,7 @@ msgstr "Warning" #: GeometryGUI.cxx:3854 msgid "GEOM_REALLY_DELETE" -msgstr "Do you really want to delete this %1 object(s): %2" +msgstr "Do you really want to delete this %1 object(s):" # #============================================================================== diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index 01ca3094e..f08661953 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -199,6 +199,7 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() return; myBase = aSelectedObject; + myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); myOkBase = true; } else if(myEditCurrentArgument == GroupPoints->LineEdit2) { @@ -211,28 +212,25 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() { LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); TColStd_IndexedMapOfInteger aMap; + QString aName = GEOMBase::GetName( aSelectedObject ); 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( S, aShapes ); - S = aShapes.FindKey( anIndex ); - if ( S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE ) { - myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex); - myOkPath = true; - aSelMgr->clearSelected(); - } + myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aName.append( ":edge_" + QString::number( anIndex ) ); + myOkPath = true; + aSelMgr->clearSelected(); } - else if ( S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE ) { + else { myPath = aSelectedObject; myOkPath = true; } + myEditCurrentArgument->setText( aName ); } } - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); displayPreview(); } diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index c6141aa2b..cc417d0f5 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -289,8 +289,8 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() if (!testResult) return; - myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); TopoDS_Shape aShape; + QString aName = GEOMBase::GetName( aSelectedObject ); if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); @@ -301,10 +301,8 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() 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); + aName.append( ":edge_" + QString::number( anIndex ) ); aSelMgr->clearSelected(); } } @@ -317,7 +315,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() myVec = aSelectedObject; myOkVec = true; } - myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); + myEditCurrentArgument->setText( aName ); } else // getConstructorId()==1 - extrusion using 2 points { @@ -343,8 +341,9 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() if (!testResult || CORBA::is_nil( aSelectedObject )) return; - myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); + QString aName = GEOMBase::GetName( aSelectedObject ); TopoDS_Shape aShape; + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); @@ -355,14 +354,14 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() 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); + aName.append( ":vertex_" + QString::number( anIndex ) ); aSelMgr->clearSelected(); } } + myEditCurrentArgument->setText( aName ); + if (myEditCurrentArgument == GroupPoints2->LineEdit1) { myBase = aSelectedObject; myOkBase = true; @@ -408,6 +407,7 @@ void GenerationGUI_PrismDlg::LineEditReturnPressed() void GenerationGUI_PrismDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); + globalSelection( GEOM_POINT ); // to break previous local selection if (send == GroupPoints->PushButton1) { GroupPoints->LineEdit1->setFocus(); @@ -417,9 +417,7 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument() else if (send == GroupPoints->PushButton2) { GroupPoints->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit2; - // globalSelection( GEOM_LINE ); - GEOM::GEOM_Object_var anObj; - localSelection( anObj, TopAbs_EDGE ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } else if (send == GroupPoints2->PushButton1) { GroupPoints2->LineEdit1->setFocus(); diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index 2f063f194..fa1d703ff 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -221,6 +221,7 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); + QString aName = GEOMBase::GetName( aSelectedObject ); if (!testResult) return; @@ -250,9 +251,7 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); + aName.append( ":edge_" + QString::number( anIndex ) ); myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelMgr->clearSelected(); } @@ -263,7 +262,7 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() } } } - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + myEditCurrentArgument->setText( aName ); displayPreview(); } @@ -286,8 +285,7 @@ void GenerationGUI_RevolDlg::SetEditCurrentArgument() GroupPoints->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit2; //globalSelection( GEOM_LINE ); - GEOM::GEOM_Object_var anObj; - localSelection( anObj, TopAbs_EDGE ); + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); } SelectionIntoArgument(); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index aa4ad1b91..84f861301 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -254,8 +254,8 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument() if(!testResult || CORBA::is_nil( aSelectedObject )) return; - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); TopoDS_Shape aShape; + QString aName = GEOMBase::GetName( aSelectedObject ); if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); @@ -266,13 +266,14 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument() GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); + aName.append( ":vertex_" + QString::number( anIndex ) ); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelMgr->clearSelected(); } } + + myEditCurrentArgument->setText( aName ); + if(myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1 = aSelectedObject; else if(myEditCurrentArgument == GroupPoints->LineEdit2) diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index 8a7659e1d..659471593 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -276,7 +276,8 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument() return; TopoDS_Shape aShape; - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + QString aName = GEOMBase::GetName( aSelectedObject ); + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); @@ -287,13 +288,16 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument() GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); + if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + aName.append( ":edge_" + QString::number( anIndex ) ); + else + aName.append( ":vertex_" + QString::number( anIndex ) ); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelMgr->clearSelected(); } } + myEditCurrentArgument->setText( aName ); + if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = aSelectedObject; else if (myEditCurrentArgument == GroupPoints->LineEdit2) @@ -313,14 +317,13 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument() if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; - // globalSelection( GEOM_POINT ); + globalSelection( GEOM_POINT ); // to break prvious local selection 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 ); + globalSelection( GEOM_LINE );// to break prvious local selection + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } myEditCurrentArgument->setFocus(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index 168a25159..e741b4f7b 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -271,7 +271,7 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() if(!testResult || CORBA::is_nil( aSelectedObject )) return; - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + QString aName = GEOMBase::GetName( aSelectedObject ); TopoDS_Shape aShape; if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { @@ -283,13 +283,16 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); + if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + aName.append( ":edge_" + QString::number( anIndex ) ); + else + aName.append( ":vertex_" + QString::number( anIndex ) ); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelMgr->clearSelected(); } } + myEditCurrentArgument->setText( aName ); + if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = aSelectedObject; else if (myEditCurrentArgument == GroupPoints->LineEdit2) @@ -308,14 +311,13 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument() if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; - // globalSelection( GEOM_POINT ); + globalSelection( GEOM_POINT ); // to break previous local selection 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 ); + globalSelection( GEOM_LINE ); // to break previous local selection + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); } myEditCurrentArgument->setFocus(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index b1b56fea6..e0a7c5f33 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -244,7 +244,7 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument() if (!testResult || CORBA::is_nil( aSelectedObject )) return; - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + QString aName = GEOMBase::GetName( aSelectedObject ); TopoDS_Shape aShape; if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { @@ -256,13 +256,13 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument() GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); + aName.append( ":vertex_" + QString::number( anIndex ) ); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelMgr->clearSelected(); } } + + myEditCurrentArgument->setText( aName ); myPoint = aSelectedObject; displayPreview(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index dad4b531f..4e2451665 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -262,7 +262,7 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument() if (!testResult || CORBA::is_nil( aSelectedObject )) return; - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + QString aName = GEOMBase::GetName( aSelectedObject ); TopoDS_Shape aShape; if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { @@ -274,13 +274,16 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument() GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); + if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + aName.append( ":edge_" + QString::number( anIndex ) ); + else + aName.append( ":vertex_" + QString::number( anIndex ) ); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelMgr->clearSelected(); } } + myEditCurrentArgument->setText( aName ); + if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = aSelectedObject; else if (myEditCurrentArgument == GroupPoints->LineEdit2) @@ -313,6 +316,7 @@ void PrimitiveGUI_TorusDlg::LineEditReturnPressed() void PrimitiveGUI_TorusDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); + globalSelection( GEOM_POINT ); // to break previous local selection if (send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1;