From: dmv Date: Wed, 28 Nov 2007 08:18:23 +0000 (+0000) Subject: NPAL 16768 (Definition of Vector form Edge) X-Git-Tag: V3_2_9rc2~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b86f9dd299f86efc45a9d0eb86151f5835bcb18c;p=modules%2Fgeom.git NPAL 16768 (Definition of Vector form Edge) --- diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index 0fcbcb236..602e0d223 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -33,8 +33,17 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include #include +#include +#include +#include +#include + +#include + #include "GEOMImpl_Types.hxx" #include "GEOM_Object.hxx" #include "GEOM_Engine.hxx" @@ -293,13 +302,39 @@ void BasicGUI_CircleDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = aSelectedObject; - else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = aSelectedObject; + else if ( myEditCurrentArgument == GroupPntVecR->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( 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; + } + } + } else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; @@ -330,8 +365,12 @@ void BasicGUI_CircleDlg::SetEditCurrentArgument() myEditCurrentArgument->setFocus(); - if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) - globalSelection( GEOM_LINE ); + if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) + { + //globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); + } else globalSelection( GEOM_POINT ); SelectionIntoArgument(); diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index 62711faa6..c3a3ddd4f 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -35,6 +35,13 @@ #include +#include +#include +#include +#include +#include +#include + #include #include "GEOMImpl_Types.hxx" @@ -314,7 +321,32 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument() { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject; - else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = 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 == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; @@ -342,8 +374,11 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument() myEditCurrentArgument->setFocus(); - if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) - globalSelection( GEOM_LINE ); + if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) { + //globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); + } else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) { //globalSelection( GEOM_PLANE ); TColStd_MapOfInteger aMap; diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx index 97a7421c2..7cfa245d0 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -43,6 +43,9 @@ #include #include #include +#include +#include +#include // QT Includes #include @@ -209,7 +212,9 @@ void BasicGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId) } case 1: { - globalSelection( GEOM_LINE ); + //globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); Group1->hide(); Group3->hide(); @@ -285,6 +290,7 @@ bool BasicGUI_WorkingPlaneDlg::ClickOnApply() void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); + QString aName; const int id = getConstructorId(); if ( IObjectCount() != 1 ) { @@ -306,14 +312,45 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() if(!aRes || CORBA::is_nil( aSelectedObject )) return; + aName = GEOMBase::GetName( aSelectedObject ); + if(myEditCurrentArgument == Group1->LineEdit1) myFace = aSelectedObject; - else if(myEditCurrentArgument == Group2->LineEdit1) - myVectX = aSelectedObject; - else if(myEditCurrentArgument == Group2->LineEdit2) - myVectZ = aSelectedObject; + else if(myEditCurrentArgument == Group2->LineEdit1 || myEditCurrentArgument == Group2->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 ); + aName = aName + " Edge_" + QString::number( anIndex ); + if(myEditCurrentArgument == Group2->LineEdit1) + myVectX = aShapesOp->GetSubShape(aSelectedObject, anIndex); + else + myVectZ = aShapesOp->GetSubShape(aSelectedObject, anIndex); + } + else { + if(myEditCurrentArgument == Group2->LineEdit1) + myVectX = aSelectedObject; + else + myVectZ = aSelectedObject; + } + aSelMgr->clearSelected(); + } + } + } - myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); + myEditCurrentArgument->setText( aName ); updateWPlane(); } @@ -333,11 +370,15 @@ void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument() } else if(send == Group2->PushButton1) { myEditCurrentArgument = Group2->LineEdit1; - globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); + //globalSelection( GEOM_LINE ); } else if(send == Group2->PushButton2) { myEditCurrentArgument = Group2->LineEdit2; - globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); + //globalSelection( GEOM_LINE ); } myEditCurrentArgument->setFocus(); diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index 242408d4f..01ca3094e 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -36,6 +36,11 @@ #include #include +#include +#include +#include +#include +#include #include #include #if OCC_VERSION_MAJOR >= 5 @@ -128,7 +133,7 @@ void GenerationGUI_PipeDlg::Init() initName(tr("GEOM_PIPE")); - globalSelection( GEOM_ALLSHAPES ); + // globalSelection( GEOM_ALLSHAPES ); } @@ -199,12 +204,33 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() else if(myEditCurrentArgument == GroupPoints->LineEdit2) { myOkPath = false; - if(!GEOMBase::GetShape(aSelectedObject, S) || - !(S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE) ) + if( !GEOMBase::GetShape(aSelectedObject, S) ) return; - myPath = aSelectedObject; - myOkPath = true; + if ( testResult && !aSelectedObject->_is_nil() && aSelectedObject != myBase) + { + 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( S, aShapes ); + S = aShapes.FindKey( anIndex ); + if ( S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE ) { + myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex); + myOkPath = true; + aSelMgr->clearSelected(); + } + } + else if ( S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE ) { + myPath = aSelectedObject; + myOkPath = true; + } + } } myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -223,10 +249,13 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument() if(send == GroupPoints->PushButton1) { GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; + globalSelection( GEOM_ALLSHAPES ); } else if(send == GroupPoints->PushButton2) { GroupPoints->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit2; + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); } SelectionIntoArgument(); } diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index 61072b77a..8d42bda6f 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -33,6 +33,13 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include +#include + #include #include @@ -287,10 +294,33 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() myOkBase = true; } else if (myEditCurrentArgument == GroupPoints->LineEdit2) { - myVec = aSelectedObject; - myOkVec = true; + 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; + } + } } - myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); } else // getConstructorId()==1 - extrusion using 2 points @@ -372,7 +402,9 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument() else if (send == GroupPoints->PushButton2) { GroupPoints->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit2; - globalSelection( GEOM_LINE ); + // globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, 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 7d8a7dc08..2f063f194 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -33,6 +33,13 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include +#include + #include #include #include @@ -229,8 +236,32 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() myOkBase = true; } else if(myEditCurrentArgument == GroupPoints->LineEdit2) { - myAxis = aSelectedObject; - myOkAxis = true; + 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 ); + myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + else + myAxis = aSelectedObject; + + myOkAxis = true; + } + } } myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -254,7 +285,9 @@ void GenerationGUI_RevolDlg::SetEditCurrentArgument() else if(send == GroupPoints->PushButton2) { GroupPoints->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit2; - globalSelection( GEOM_LINE ); + //globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); } SelectionIntoArgument(); } diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx index 09f278b25..ef57e4f47 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.cxx +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -331,15 +331,6 @@ void GroupGUI_GroupDlg::SelectionIntoArgument() aSelMgr->selectedSubOwners(aMap); if (aMap.size() == 1) aMapIndex = aMap.begin().data(); - if (aMap.size() == 0) { - Standard_Boolean aResult = Standard_False; - GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); - if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { - localSelection( anObj, getShapeType() ); - } - - } } } diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index fd7f05cd6..92c1474fc 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -33,6 +33,13 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include +#include + #include #include "GEOMImpl_Types.hxx" @@ -269,10 +276,32 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument() if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) - myDir = 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 ) ); displayPreview(); } @@ -292,7 +321,9 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument() } else if(send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; - globalSelection( GEOM_LINE ); + // globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); } myEditCurrentArgument->setFocus(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index 6c2b1b726..25db439b8 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -33,6 +33,13 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include +#include + #include #include "GEOMImpl_Types.hxx" @@ -265,11 +272,32 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) - myDir = 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 ) ); - displayPreview(); } @@ -288,7 +316,9 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument() } else if(send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; - globalSelection( GEOM_LINE ); + // globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); } myEditCurrentArgument->setFocus(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index 1f4279bca..6f561260a 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -33,6 +33,13 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include +#include + #include #include "GEOMImpl_Types.hxx" @@ -257,9 +264,32 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument() if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) - myDir = 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 ) ); displayPreview(); } @@ -295,7 +325,9 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument() } else if (send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; - globalSelection( GEOM_LINE ); + // globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); } myEditCurrentArgument->setFocus(); diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index 5e6868836..4e555b021 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -33,6 +33,13 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include +#include + #include #include @@ -229,10 +236,33 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument() return; } Standard_Boolean testResult = Standard_False; - myArgument = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); + myArgument = aSelectedObject; if(!testResult || CORBA::is_nil( myArgument )) return; - aName = GEOMBase::GetName( myArgument ); + + 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 ); + myArgument = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + } + } + aName = GEOMBase::GetName( aSelectedObject ); } myEditCurrentArgument->setText( aName ); @@ -279,7 +309,9 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument() } case 1: { - globalSelection( GEOM_LINE ); + //globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); break; } case 2: diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 1311eb899..1b6f1c3b4 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -33,6 +33,13 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include +#include + #include #include @@ -285,9 +292,32 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() myEditCurrentArgument == GroupDimensions->LineEdit1) myBase = aSelectedObject; else if (myEditCurrentArgument == GroupPoints->LineEdit2 || - myEditCurrentArgument == GroupDimensions->LineEdit2) - myVector = aSelectedObject; - + myEditCurrentArgument == GroupDimensions->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 ); + myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + else + myVector = aSelectedObject; + } + } + } myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); displayPreview(); @@ -308,7 +338,9 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() } else if(send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; - globalSelection( GEOM_LINE ); + // globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); } else if(send == GroupDimensions->PushButton1) { myEditCurrentArgument = GroupDimensions->LineEdit1; @@ -316,7 +348,9 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() } else if(send == GroupDimensions->PushButton2) { myEditCurrentArgument = GroupDimensions->LineEdit2; - globalSelection( GEOM_LINE ); + // globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); } myEditCurrentArgument->setFocus(); diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index 7f5e33c15..3b5e094bc 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -33,6 +33,13 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include +#include + #include #include "GEOMImpl_Types.hxx" @@ -302,10 +309,39 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() myEditCurrentArgument == GroupDimensions->LineEdit1) myBase = aSelectedObject; else if (myEditCurrentArgument == GroupPoints->LineEdit2 || - myEditCurrentArgument == GroupDimensions->LineEdit2) - myVectorU = aSelectedObject; - else if (myEditCurrentArgument == GroupDimensions->LineEdit3) - myVectorV = aSelectedObject; + myEditCurrentArgument == GroupDimensions->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit3 ) { + 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 ); + aSelMgr->clearSelected(); + if ( myEditCurrentArgument == GroupDimensions->LineEdit3 ) + myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex); + else + myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex); + } + else + if ( myEditCurrentArgument == GroupDimensions->LineEdit3 ) + myVectorV = aSelectedObject; + else + myVectorU = aSelectedObject; + } + } + } myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -327,7 +363,9 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() } else if(send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; - globalSelection( GEOM_LINE ); + // globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); } else if(send == GroupDimensions->PushButton1) { myEditCurrentArgument = GroupDimensions->LineEdit1; @@ -335,11 +373,15 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() } else if(send == GroupDimensions->PushButton2) { myEditCurrentArgument = GroupDimensions->LineEdit2; - globalSelection( GEOM_LINE ); + // globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); } else if(send == GroupDimensions->PushButton3) { myEditCurrentArgument = GroupDimensions->LineEdit3; - globalSelection( GEOM_LINE ); + // globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); } myEditCurrentArgument->setFocus(); diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index 51b85c60b..30790bb59 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -33,6 +33,13 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include +#include + #include #include @@ -262,8 +269,31 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() if(!testResult || CORBA::is_nil( aSelectedObject )) return; - if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) - myAxis = aSelectedObject; + if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) { + 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 ); + myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + else + myAxis = aSelectedObject; + } + } + } else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) myCentPoint = aSelectedObject; else if(myEditCurrentArgument == GroupPoints->LineEdit4) @@ -293,8 +323,13 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument() } else if(send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; - getConstructorId() == 0 ? globalSelection( GEOM_LINE ) : - globalSelection( GEOM_POINT ); + if (getConstructorId() == 0) { + //globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); + } + else + globalSelection( GEOM_POINT ); } else if (send == GroupPoints->PushButton4) { diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index aa29811d3..659819a76 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -33,6 +33,13 @@ #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" +#include +#include +#include +#include +#include +#include + #include #include @@ -278,8 +285,32 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument() if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) myPoint1 = aSelectedObject; - else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) - myVector = 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() ); + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex); + aSelMgr->clearSelected(); + } + else + myVector = aSelectedObject; + } + } + } else if (myEditCurrentArgument == GroupPoints->LineEdit3) myPoint2 = aSelectedObject; @@ -320,8 +351,13 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument() } else if (send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; - getConstructorId() == 1 ? globalSelection( GEOM_POINT ) : - globalSelection( GEOM_LINE ); + if (getConstructorId() == 1) + globalSelection( GEOM_POINT ); + else { + //globalSelection( GEOM_LINE ); + GEOM::GEOM_Object_var anObj; + localSelection( anObj, TopAbs_EDGE ); + } } else if (send == GroupPoints->PushButton3) { myEditCurrentArgument = GroupPoints->LineEdit3;