From: dmv Date: Fri, 21 May 2010 12:19:52 +0000 (+0000) Subject: 0020882: EDF 1341 GEOM: Unadapted behaviour of the viewer when using the sketcher X-Git-Tag: translate_resources_09Jul10~21 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4d896c08e8e3206210653ad0ce1f51dc6c01d5d2;p=modules%2Fgeom.git 0020882: EDF 1341 GEOM: Unadapted behaviour of the viewer when using the sketcher --- diff --git a/doc/salome/gui/GEOM/images/neo-scetcher1.png b/doc/salome/gui/GEOM/images/neo-scetcher1.png index d0d5d7132..2205805bd 100755 Binary files a/doc/salome/gui/GEOM/images/neo-scetcher1.png and b/doc/salome/gui/GEOM/images/neo-scetcher1.png differ diff --git a/doc/salome/gui/GEOM/images/neo-scetcher2.png b/doc/salome/gui/GEOM/images/neo-scetcher2.png index 9097ffc07..cec5c57b4 100755 Binary files a/doc/salome/gui/GEOM/images/neo-scetcher2.png and b/doc/salome/gui/GEOM/images/neo-scetcher2.png differ diff --git a/doc/salome/gui/GEOM/input/creating_sketcher.doc b/doc/salome/gui/GEOM/input/creating_sketcher.doc index 2da54f5fa..c93f5f3ff 100644 --- a/doc/salome/gui/GEOM/input/creating_sketcher.doc +++ b/doc/salome/gui/GEOM/input/creating_sketcher.doc @@ -54,13 +54,14 @@ is predefined and is equal to 90 degrees); \b Buttons: -"Sketch Validation" button applies the wire, only red part will be built by "Sketch Validation". +"Restore" button orientates the viewer correspondingly to the chosen working plane and fits the scene to show all its objects. +\n "Sketch Validation" button applies the wire, only red part will be built by "Sketch Validation". \n "Sketch Closure" will close the Sketch by straight line from last red part and apply it. \n Dialog Box: \image html neo-scetcher1.png - +
\image html neo-scetcher2.png \n Example: diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index d1a4ff9e8..d9cded4fd 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -105,12 +105,17 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, /***************************************************************/ GroupBox1 = new QGroupBox(tr("GEOM_CS"), this); - QGridLayout* OwnLayout = new QGridLayout(GroupBox1); - OwnLayout->setSpacing(6); - OwnLayout->setMargin(11); + QHBoxLayout* planeLayout = new QHBoxLayout(GroupBox1); + planeLayout->setSpacing(6); + planeLayout->setMargin(11); ComboBox1 = new QComboBox(GroupBox1); - OwnLayout->addWidget(ComboBox1); + ComboBox1->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) ); + planeLayout->addWidget(ComboBox1); + + planeButton = new QPushButton (GroupBox1); + planeButton->setText( tr( "GEOM_SKETCHER_RESTORE" ) ); + planeLayout->addWidget(planeButton); topLayout->addWidget(GroupBox1); topLayout->addWidget( MainWidget ); @@ -233,6 +238,7 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, connect( Group4Spin->SpinBox_DS, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ); connect( ComboBox1, SIGNAL( activated( int ) ), this, SLOT( SelectionIntoArgument() ) ); + connect( planeButton, SIGNAL( clicked() ), this, SLOT( ActivateLocalCS() ) ); connect( myGeometryGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); @@ -352,7 +358,7 @@ void EntityGUI_SketcherDlg::Init() FindLocalCS(); resize(100,100); - + ActivateLocalCS(); GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); } @@ -896,6 +902,12 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() double tmpY = myY; myX = myLastX1; myY = myLastY1; + // printf ("\nmyX = %f myY = %f", myX, myY); + // printf ("\nmyLastX1 = %f myLastY1 = %f", myLastX1, myLastY1); + // printf ("\nmyLastX2 = %f myLastY2 = %f", myLastX2, myLastY2); + + if ( sender() == ComboBox1 ) + ActivateLocalCS(); LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr(); SALOME_ListIO aSelList; @@ -1747,7 +1759,7 @@ void EntityGUI_SketcherDlg::FindLocalCS() //================================================================================= // function : GetActiveLocalCS() -// purpose : Find All Coordinates systems in study +// purpose : Get Working plane //================================================================================= gp_Ax3 EntityGUI_SketcherDlg::GetActiveLocalCS() { @@ -1757,7 +1769,15 @@ gp_Ax3 EntityGUI_SketcherDlg::GetActiveLocalCS() gp_Ax3 aLCS = myLCSList.at(ind); - myGeometryGUI->SetWorkingPlane( aLCS ); - myGeometryGUI->ActiveWorkingPlane(); return aLCS; } + +//================================================================================= +// function : ActivateLocalCS() +// purpose : Activate & Fit Working plane +//================================================================================= +void EntityGUI_SketcherDlg::ActivateLocalCS() +{ + myGeometryGUI->SetWorkingPlane( GetActiveLocalCS() ); + myGeometryGUI->ActiveWorkingPlane(); +} diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.h b/src/EntityGUI/EntityGUI_SketcherDlg.h index 8e3eaceb0..0c0f631ac 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.h +++ b/src/EntityGUI/EntityGUI_SketcherDlg.h @@ -145,6 +145,7 @@ private: QGroupBox* GroupBox1; QComboBox* ComboBox1; + QPushButton* planeButton; GeometryGUI* myGeometryGUI; @@ -184,6 +185,7 @@ private slots: void SetDoubleSpinBoxStep( double ); void FindLocalCS(); gp_Ax3 GetActiveLocalCS(); + void ActivateLocalCS(); }; #endif // ENTITYGUI_SKETCHERDLG_H diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index b54be9129..ade11bc38 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -1555,6 +1555,10 @@ Please, select face, shell or solid and try again GEOM_SKETCHER_EL Element Type + + GEOM_SKETCHER_RESTORE + Restore + GEOM_SKETCHER_LENGTH Length diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 855e3b6d8..19e6515c4 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -1278,7 +1278,7 @@ void GeometryGUI::viewManagers( QStringList& lst ) const void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm ) { - if ( vm->getType() == OCCViewer_Viewer::Type() ) + if ( vm && vm->getType() == OCCViewer_Viewer::Type() ) { qDebug( "connect" ); connect( vm, SIGNAL( keyPress ( SUIT_ViewWindow*, QKeyEvent* ) ),