0020882: EDF 1341 GEOM: Unadapted behaviour of the viewer when using the sketcher

This commit is contained in:
dmv 2010-05-21 12:19:52 +00:00
parent 2a228cfc11
commit 4d896c08e8
7 changed files with 38 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -54,13 +54,14 @@ is predefined and is equal to 90 degrees);</li>
\b Buttons: \b Buttons:
<b>"Sketch Validation"</b> button applies the wire, only red part will be built by "Sketch Validation". <b>"Restore"</b> button orientates the viewer correspondingly to the chosen working plane and fits the scene to show all its objects.
\n <b>"Sketch Validation"</b> button applies the wire, only red part will be built by "Sketch Validation".
\n <b>"Sketch Closure"</b> will close the Sketch by straight line from last red part and apply it. \n <b>"Sketch Closure"</b> will close the Sketch by straight line from last red part and apply it.
\n <b>Dialog Box:</b> \n <b>Dialog Box:</b>
\image html neo-scetcher1.png \image html neo-scetcher1.png
<br>
\image html neo-scetcher2.png \image html neo-scetcher2.png
\n <b>Example:</b> \n <b>Example:</b>

View File

@ -105,12 +105,17 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent,
/***************************************************************/ /***************************************************************/
GroupBox1 = new QGroupBox(tr("GEOM_CS"), this); GroupBox1 = new QGroupBox(tr("GEOM_CS"), this);
QGridLayout* OwnLayout = new QGridLayout(GroupBox1); QHBoxLayout* planeLayout = new QHBoxLayout(GroupBox1);
OwnLayout->setSpacing(6); planeLayout->setSpacing(6);
OwnLayout->setMargin(11); planeLayout->setMargin(11);
ComboBox1 = new QComboBox(GroupBox1); 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(GroupBox1);
topLayout->addWidget( MainWidget ); 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( Group4Spin->SpinBox_DS, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( ComboBox1, SIGNAL( activated( int ) ), this, SLOT( SelectionIntoArgument() ) ); connect( ComboBox1, SIGNAL( activated( int ) ), this, SLOT( SelectionIntoArgument() ) );
connect( planeButton, SIGNAL( clicked() ), this, SLOT( ActivateLocalCS() ) );
connect( myGeometryGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) ); connect( myGeometryGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
@ -352,7 +358,7 @@ void EntityGUI_SketcherDlg::Init()
FindLocalCS(); FindLocalCS();
resize(100,100); resize(100,100);
ActivateLocalCS();
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
} }
@ -896,6 +902,12 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument()
double tmpY = myY; double tmpY = myY;
myX = myLastX1; myX = myLastX1;
myY = myLastY1; 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(); LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList; SALOME_ListIO aSelList;
@ -1747,7 +1759,7 @@ void EntityGUI_SketcherDlg::FindLocalCS()
//================================================================================= //=================================================================================
// function : GetActiveLocalCS() // function : GetActiveLocalCS()
// purpose : Find All Coordinates systems in study // purpose : Get Working plane
//================================================================================= //=================================================================================
gp_Ax3 EntityGUI_SketcherDlg::GetActiveLocalCS() gp_Ax3 EntityGUI_SketcherDlg::GetActiveLocalCS()
{ {
@ -1757,7 +1769,15 @@ gp_Ax3 EntityGUI_SketcherDlg::GetActiveLocalCS()
gp_Ax3 aLCS = myLCSList.at(ind); gp_Ax3 aLCS = myLCSList.at(ind);
myGeometryGUI->SetWorkingPlane( aLCS );
myGeometryGUI->ActiveWorkingPlane();
return aLCS; return aLCS;
} }
//=================================================================================
// function : ActivateLocalCS()
// purpose : Activate & Fit Working plane
//=================================================================================
void EntityGUI_SketcherDlg::ActivateLocalCS()
{
myGeometryGUI->SetWorkingPlane( GetActiveLocalCS() );
myGeometryGUI->ActiveWorkingPlane();
}

View File

@ -145,6 +145,7 @@ private:
QGroupBox* GroupBox1; QGroupBox* GroupBox1;
QComboBox* ComboBox1; QComboBox* ComboBox1;
QPushButton* planeButton;
GeometryGUI* myGeometryGUI; GeometryGUI* myGeometryGUI;
@ -184,6 +185,7 @@ private slots:
void SetDoubleSpinBoxStep( double ); void SetDoubleSpinBoxStep( double );
void FindLocalCS(); void FindLocalCS();
gp_Ax3 GetActiveLocalCS(); gp_Ax3 GetActiveLocalCS();
void ActivateLocalCS();
}; };
#endif // ENTITYGUI_SKETCHERDLG_H #endif // ENTITYGUI_SKETCHERDLG_H

View File

@ -1555,6 +1555,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_SKETCHER_EL</source> <source>GEOM_SKETCHER_EL</source>
<translation>Element Type</translation> <translation>Element Type</translation>
</message> </message>
<message>
<source>GEOM_SKETCHER_RESTORE</source>
<translation>Restore</translation>
</message>
<message> <message>
<source>GEOM_SKETCHER_LENGTH</source> <source>GEOM_SKETCHER_LENGTH</source>
<translation>Length</translation> <translation>Length</translation>

View File

@ -1278,7 +1278,7 @@ void GeometryGUI::viewManagers( QStringList& lst ) const
void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm ) void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm )
{ {
if ( vm->getType() == OCCViewer_Viewer::Type() ) if ( vm && vm->getType() == OCCViewer_Viewer::Type() )
{ {
qDebug( "connect" ); qDebug( "connect" );
connect( vm, SIGNAL( keyPress ( SUIT_ViewWindow*, QKeyEvent* ) ), connect( vm, SIGNAL( keyPress ( SUIT_ViewWindow*, QKeyEvent* ) ),