X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTransformationGUI%2FTransformationGUI_ScaleDlg.cxx;h=fe2d72bba7538c27878f03498be86b7bee0e00be;hb=04f3d723da1ae9133d108921c8f10338a9656d12;hp=69732e560db675a9bc772a167cc89ccf2524ad38;hpb=f70f07e7dbec1c3068bb2f5ffd6ce0ca41798091;p=modules%2Fgeom.git diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index 69732e560..fe2d72bba 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -24,7 +24,7 @@ #include "TransformationGUI_ScaleDlg.h" -#include +#include #include #include @@ -33,6 +33,12 @@ #include #include +#include +#include +#include +#include +#include + #include //================================================================================= @@ -82,7 +88,7 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( GeometryGUI* theGeometry double aFactor = 2.0; double SpecificStep = 0.5; /* min, max, step and decimals for spin boxes & initial values */ - initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 ); + initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, SpecificStep, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY GroupPoints->SpinBox_DX->setValue( aFactor ); // Activate Create a Copy mode @@ -108,7 +114,7 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( GeometryGUI* theGeometry connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - setHelpFileName( "scale_transform.htm" ); + setHelpFileName( "scale_operation_page.html" ); Init(); } @@ -189,10 +195,43 @@ 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 ) { + int anIndex = aMap( 1 ); + aName += QString( ":vertex_%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() ); + aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex ); + aSelMgr->clearSelected(); + } + else { + aSelectedObject = aFindedObject; // get Object from study + } + } + else { + if ( aShape.ShapeType() != TopAbs_VERTEX ) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + } + } + } + + myPoint = aSelectedObject; + if ( !testResult || CORBA::is_nil( myPoint ) ) return; - aName = GEOMBase::GetName( myPoint ); } myEditCurrentArgument->setText( aName ); @@ -222,14 +261,14 @@ void TransformationGUI_ScaleDlg::LineEditReturnPressed() void TransformationGUI_ScaleDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); + globalSelection(); if ( send == GroupPoints->PushButton1 ) { myEditCurrentArgument = GroupPoints->LineEdit1; - globalSelection(); } else if ( send == GroupPoints->PushButton2 ) { myEditCurrentArgument = GroupPoints->LineEdit2; - globalSelection( GEOM_POINT ); + localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); } myEditCurrentArgument->setFocus(); @@ -318,16 +357,6 @@ bool TransformationGUI_ScaleDlg::execute( ObjectList& objects ) } -//================================================================================= -// function : closeEvent -// purpose : -//================================================================================= -void TransformationGUI_ScaleDlg::closeEvent( QCloseEvent* e ) -{ - GEOMBase_Skeleton::closeEvent( e ); -} - - //================================================================================= // function : GetFactor() // purpose : @@ -346,3 +375,19 @@ void TransformationGUI_ScaleDlg::CreateCopyModeChanged( bool isCreateCopy ) { mainFrame()->GroupBoxName->setEnabled(isCreateCopy); } + +//================================================================================= +// function : addSubshapeToStudy +// purpose : virtual method to add new SubObjects if local selection +//================================================================================= +void TransformationGUI_ScaleDlg::addSubshapesToStudy() +{ + bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked(); + if ( toCreateCopy ) { + QMap objMap; + + objMap[GroupPoints->LineEdit2->text()] = myPoint; + + addSubshapesToFather( objMap ); + } +}