X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTransformationGUI%2FTransformationGUI_MirrorDlg.cxx;h=8fc57aa678f362c60fb2006a97e254757dc126d8;hb=04f3d723da1ae9133d108921c8f10338a9656d12;hp=fb662e83c689b20a1974b8e590cd03a2b4d9b091;hpb=8491fee81c315f2063e1753ea7b2cd5bc90e6a14;p=modules%2Fgeom.git diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index fb662e83c..8fc57aa67 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -34,6 +34,13 @@ #include #include +#include +#include +#include +#include +#include +#include + #include //================================================================================= @@ -77,7 +84,7 @@ TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg( GeometryGUI* theGeomet layout->addWidget( GroupPoints ); /***************************************************************/ - setHelpFileName( "mirror_image.htm" ); + setHelpFileName( "mirror_operation_page.html" ); Init(); } @@ -217,10 +224,52 @@ 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 ); + + aName = GEOMBase::GetName( aSelectedObject ); + + if ( testResult && !aSelectedObject->_is_nil() ) { + TopoDS_Shape aShape; + if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { + TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; + if ( getConstructorId() == 1 ) + aNeedType = TopAbs_EDGE; + else if ( getConstructorId() == 2 ) + aNeedType = TopAbs_FACE; + + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); + TColStd_IndexedMapOfInteger aMap; + aSelMgr->GetIndexes( firstIObject(), aMap ); + if ( aMap.Extent() == 1 ) { + int anIndex = aMap( 1 ); + if ( aNeedType == TopAbs_VERTEX ) + aName += QString( ":vertex_%1" ).arg( anIndex ); + else + aName += QString( ":edge_%1" ).arg( anIndex ); + + //Find SubShape Object in Father + GEOM::GEOM_Object_var aFindedObject = findObjectInFather( aSelectedObject, aName ); + + if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study + GEOM::GEOM_IShapesOperations_var aShapesOp = + getGeomEngine()->GetIShapesOperations( getStudyId() ); + myArgument = aShapesOp->GetSubShape( aSelectedObject, anIndex ); + } + else { + myArgument = aFindedObject; // get Object from study + } + } + else { + if ( aShape.ShapeType() != aNeedType ) { + myArgument = GEOM::GEOM_Object::_nil(); + aName = ""; + } + } + } + } } myEditCurrentArgument->setText( aName ); @@ -250,19 +299,19 @@ void TransformationGUI_MirrorDlg::LineEditReturnPressed() void TransformationGUI_MirrorDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); + globalSelection(); if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; - globalSelection(); } else if ( send == GroupPoints->PushButton2 ) { myEditCurrentArgument = GroupPoints->LineEdit2; switch ( getConstructorId() ) { case 0: - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); break; case 1: - globalSelection( GEOM_LINE ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); break; case 2: globalSelection( GEOM_PLANE ); @@ -394,20 +443,34 @@ bool TransformationGUI_MirrorDlg::execute( ObjectList& objects ) } //================================================================================= -// function : closeEvent +// function : CreateCopyModeChanged() // purpose : //================================================================================= -void TransformationGUI_MirrorDlg::closeEvent( QCloseEvent* e ) +void TransformationGUI_MirrorDlg::CreateCopyModeChanged( bool isCreateCopy ) { - GEOMBase_Skeleton::closeEvent( e ); + mainFrame()->GroupBoxName->setEnabled( isCreateCopy ); } - //================================================================================= -// function : CreateCopyModeChanged() -// purpose : +// function : addSubshapeToStudy +// purpose : virtual method to add new SubObjects if local selection //================================================================================= -void TransformationGUI_MirrorDlg::CreateCopyModeChanged( bool isCreateCopy ) +void TransformationGUI_MirrorDlg::addSubshapesToStudy() { - mainFrame()->GroupBoxName->setEnabled( isCreateCopy ); + bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked(); + if ( toCreateCopy ) { + QMap objMap; + + switch ( getConstructorId() ) { + case 0: + objMap[GroupPoints->LineEdit2->text()] = myArgument; + break; + case 1: + objMap[GroupPoints->LineEdit2->text()] = myArgument; + break; + case 2: + return; + } + addSubshapesToFather( objMap ); + } }