NPAL16160,NPAL16123: Unify dialogs behaviour, enlarge precision of double numbers displaying.

This commit is contained in:
jfa 2007-06-19 11:28:38 +00:00
parent 4e2f485a8e
commit efc0d6c141
16 changed files with 335 additions and 389 deletions

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
@ -35,17 +35,10 @@
#include <qlabel.h> #include <qlabel.h>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <GC_MakeArcOfCircle.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Precision.hxx>
#include "GEOMImpl_Types.hxx" #include "GEOMImpl_Types.hxx"
#include "utilities.h" #include "utilities.h"
using namespace std;
//================================================================================= //=================================================================================
// class : BasicGUI_ArcDlg() // class : BasicGUI_ArcDlg()
// purpose : Constructs a BasicGUI_ArcDlg which is a child of 'parent', with the // purpose : Constructs a BasicGUI_ArcDlg which is a child of 'parent', with the
@ -58,9 +51,10 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
: GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | : GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ARC"))); SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ARC_CENTER"))); QPixmap image0(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_ARC")));
QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); QPixmap image1(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_ARC_CENTER")));
QPixmap image2(aResMgr->loadPixmap("GEOM",tr("ICON_SELECT")));
setCaption(tr("GEOM_ARC_TITLE")); setCaption(tr("GEOM_ARC_TITLE"));
@ -98,11 +92,12 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
Group3Pnts2->PushButton1->setPixmap(image2); Group3Pnts2->PushButton1->setPixmap(image2);
Group3Pnts2->PushButton2->setPixmap(image2); Group3Pnts2->PushButton2->setPixmap(image2);
Group3Pnts2->PushButton3->setPixmap(image2); Group3Pnts2->PushButton3->setPixmap(image2);
Group3Pnts2->radioButton4->setText(tr("GEOM_REVERSE")); Group3Pnts2->radioButton4->setText(tr("GEOM_REVERSE"));
Layout1->addWidget( Group3Pnts, 2, 0 ); Layout1->addWidget( Group3Pnts, 2, 0 );
Layout1->addWidget( Group3Pnts2, 2, 0 ); Layout1->addWidget( Group3Pnts2, 2, 0 );
/***************************************************************/
setHelpFileName("arc.htm"); setHelpFileName("arc.htm");
@ -126,13 +121,7 @@ BasicGUI_ArcDlg::~BasicGUI_ArcDlg()
void BasicGUI_ArcDlg::Init() void BasicGUI_ArcDlg::Init()
{ {
/* init variables */ /* init variables */
// myGeomGUI->SetState( 0 );
globalSelection( GEOM_POINT );
myConstructorId = -1;
myEditCurrentArgument = Group3Pnts->LineEdit1; myEditCurrentArgument = Group3Pnts->LineEdit1;
myEditCurrentArgument->setFocus();
myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
Group3Pnts2->radioButton4->setChecked(FALSE); Group3Pnts2->radioButton4->setChecked(FALSE);
@ -140,9 +129,9 @@ void BasicGUI_ArcDlg::Init()
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@ -153,7 +142,7 @@ void BasicGUI_ArcDlg::Init()
connect(Group3Pnts->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group3Pnts->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group3Pnts->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group3Pnts->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group3Pnts->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group3Pnts->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group3Pnts2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group3Pnts2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group3Pnts2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group3Pnts2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group3Pnts2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group3Pnts2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
@ -161,19 +150,72 @@ void BasicGUI_ArcDlg::Init()
connect(Group3Pnts2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group3Pnts2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group3Pnts2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group3Pnts2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group3Pnts2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group3Pnts2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group3Pnts2->radioButton4, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int))); connect(Group3Pnts2->radioButton4, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int)));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_ARC" )); initName( tr( "GEOM_ARC" ));
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void BasicGUI_ArcDlg::ConstructorsClicked (int constructorId)
{
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
switch (constructorId)
{
case 0:
{
globalSelection( GEOM_POINT );
Group3Pnts->show();
resize(0, 0);
Group3Pnts2->hide();
Group3Pnts->LineEdit1->setText(Group3Pnts2->LineEdit1->text());
Group3Pnts->LineEdit2->setText(Group3Pnts2->LineEdit2->text());
Group3Pnts->LineEdit3->setText(Group3Pnts2->LineEdit3->text());
myEditCurrentArgument = Group3Pnts->LineEdit1;
break;
}
case 1:
{
globalSelection( GEOM_POINT );
Group3Pnts->hide();
resize(0, 0);
Group3Pnts2->show();
Group3Pnts2->LineEdit1->setText(Group3Pnts->LineEdit1->text());
Group3Pnts2->LineEdit2->setText(Group3Pnts->LineEdit2->text());
Group3Pnts2->LineEdit3->setText(Group3Pnts->LineEdit3->text());
myEditCurrentArgument = Group3Pnts2->LineEdit1;
break;
}
}
myEditCurrentArgument->setFocus();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
if (CORBA::is_nil(myPoint1))
SelectionIntoArgument();
displayPreview();
}
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
@ -184,15 +226,6 @@ void BasicGUI_ArcDlg::ClickOnOk()
ClickOnCancel(); ClickOnCancel();
} }
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void BasicGUI_ArcDlg::ClickOnCancel()
{
GEOMBase_Skeleton::ClickOnCancel();
}
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
@ -203,19 +236,6 @@ bool BasicGUI_ArcDlg::ClickOnApply()
return false; return false;
initName(); initName();
// reset
myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
Group3Pnts->LineEdit1->setText( "" );
Group3Pnts->LineEdit2->setText( "" );
Group3Pnts->LineEdit3->setText( "" );
Group3Pnts2->LineEdit1->setText( "" );
Group3Pnts2->LineEdit2->setText( "" );
Group3Pnts2->LineEdit3->setText( "" );
if (getConstructorId() == 0) myEditCurrentArgument = Group3Pnts->LineEdit1;
if (getConstructorId() == 1) myEditCurrentArgument = Group3Pnts2->LineEdit1;
ConstructorsClicked( getConstructorId() );
return true; return true;
} }
@ -228,21 +248,23 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
{ {
if ((getConstructorId() != 0) && (getConstructorId() != 1)) if ((getConstructorId() != 0) && (getConstructorId() != 1))
return; return;
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
if ( IObjectCount() != 1 ){
if ( IObjectCount() != 1 )
{
switch (getConstructorId()) switch (getConstructorId())
{ {
case 0: case 0:
{ {
if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil();
return; return;
break; break;
} }
case 1: case 1:
{ {
if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil();
@ -250,7 +272,8 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
break; break;
} }
} }
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
@ -281,6 +304,22 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
} }
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void BasicGUI_ArcDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if (send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 ||
send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3)
{
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
@ -310,22 +349,6 @@ void BasicGUI_ArcDlg::SetEditCurrentArgument()
} }
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void BasicGUI_ArcDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if ( send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 ||
send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 )
{
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
//================================================================================= //=================================================================================
// function : ActivateThisDialog() // function : ActivateThisDialog()
// purpose : // purpose :
@ -333,33 +356,13 @@ void BasicGUI_ArcDlg::LineEditReturnPressed()
void BasicGUI_ArcDlg::ActivateThisDialog() void BasicGUI_ArcDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
// myGeomGUI->SetState( 0 );
globalSelection( GEOM_POINT );
myEditCurrentArgument = Group3Pnts->LineEdit1;
myEditCurrentArgument->setFocus();
Group3Pnts->LineEdit1->setText( "" );
Group3Pnts->LineEdit2->setText( "" );
Group3Pnts->LineEdit3->setText( "" );
myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
} }
//=================================================================================
// function : DeactivateActiveDialog()
// purpose : public slot to deactivate if active
//=================================================================================
void BasicGUI_ArcDlg::DeactivateActiveDialog()
{
// myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog();
}
//================================================================================= //=================================================================================
// function : enterEvent() // function : enterEvent()
@ -367,10 +370,11 @@ void BasicGUI_ArcDlg::DeactivateActiveDialog()
//================================================================================= //=================================================================================
void BasicGUI_ArcDlg::enterEvent(QEvent* e) void BasicGUI_ArcDlg::enterEvent(QEvent* e)
{ {
if ( !GroupConstructors->isEnabled() ) if (!GroupConstructors->isEnabled())
ActivateThisDialog(); ActivateThisDialog();
} }
//================================================================================= //=================================================================================
// function : createOperation // function : createOperation
// purpose : // purpose :
@ -410,73 +414,35 @@ bool BasicGUI_ArcDlg::execute( ObjectList& objects )
switch (getConstructorId()) switch (getConstructorId())
{ {
case 0: case 0:
{
if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) )
{ {
if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) ){ anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->
anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->MakeArc(myPoint1, myPoint2, myPoint3); MakeArc(myPoint1, myPoint2, myPoint3);
res = true; res = true;
}
break;
} }
case 1: break;
}
case 1:
{ {
bool Sense; bool Sense;
(Group3Pnts2->radioButton4->isChecked()) ? Sense=true : Sense = false; (Group3Pnts2->radioButton4->isChecked()) ? Sense = true : Sense = false;
if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) ){ if ( !CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2) &&!CORBA::is_nil(myPoint3) )
anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->MakeArcCenter(myPoint1, myPoint2, myPoint3,Sense); {
res = true; anObj = GEOM::GEOM_ICurvesOperations::_narrow(getOperation())->
} MakeArcCenter(myPoint1, myPoint2, myPoint3, Sense);
break; res = true;
}
break;
} }
} }
if ( !anObj->_is_nil() ){ if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
}
return res; return res;
} }
//=================================================================================
// function : closeEvent
// purpose :
//=================================================================================
void BasicGUI_ArcDlg::closeEvent( QCloseEvent* e )
{
GEOMBase_Skeleton::closeEvent( e );
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
{
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
switch (constructorId)
{
case 0:
{
Group3Pnts->show();
resize(0, 0);
Group3Pnts2->hide();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
case 1:
{
Group3Pnts->hide();
resize(0, 0);
Group3Pnts2->show();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
}
displayPreview();
}
//================================================================================= //=================================================================================
// function : ReverseSense() // function : ReverseSense()
// purpose : Orientation of the arc // purpose : Orientation of the arc

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
@ -37,6 +37,7 @@
#else #else
#define BASICGUI_WNT_EXPORT #define BASICGUI_WNT_EXPORT
#endif #endif
//================================================================================= //=================================================================================
// class : BasicGUI_ArcDlg // class : BasicGUI_ArcDlg
// purpose : // purpose :
@ -56,12 +57,10 @@ protected:
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& objects );
virtual void closeEvent( QCloseEvent* e ); private:
private :
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent(QEvent* e);
int myConstructorId;
GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3; GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3;
DlgRef_3Sel_QTD* Group3Pnts; DlgRef_3Sel_QTD* Group3Pnts;
@ -69,12 +68,10 @@ private :
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void DeactivateActiveDialog(); void ConstructorsClicked(int);
void ConstructorsClicked( int );
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();

View File

@ -125,7 +125,7 @@ void BasicGUI_CircleDlg::Init()
double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPntVecR->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, 3); GroupPntVecR->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, DBL_DIGITS_DISPLAY);
GroupPntVecR->SpinBox_DX->SetValue( 100 ); GroupPntVecR->SpinBox_DX->SetValue( 100 );
/* signals and slots connections */ /* signals and slots connections */

View File

@ -114,8 +114,8 @@ void BasicGUI_EllipseDlg::Init()
double aMajorR( 200. ), aMinorR( 100. ); double aMajorR( 200. ), aMinorR( 100. );
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator( 0.001, COORD_MAX, step, 3 ); GroupPoints->SpinBox_DX->RangeStepAndValidator( 0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY );
GroupPoints->SpinBox_DY->RangeStepAndValidator( 0.001, COORD_MAX, step, 3 ); GroupPoints->SpinBox_DY->RangeStepAndValidator( 0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY );
GroupPoints->SpinBox_DX->SetValue( aMajorR ); GroupPoints->SpinBox_DX->SetValue( aMajorR );
GroupPoints->SpinBox_DY->SetValue( aMinorR ); GroupPoints->SpinBox_DY->SetValue( aMinorR );

View File

@ -176,7 +176,7 @@ void BasicGUI_MarkerDlg::Init()
for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter ) for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter )
{ {
anIter.data()->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, 3 ); anIter.data()->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY );
connect( anIter.data(), SIGNAL( valueChanged( double ) ), connect( anIter.data(), SIGNAL( valueChanged( double ) ),
this, SLOT( onValueChanged( double ) ) ); this, SLOT( onValueChanged( double ) ) );
} }

View File

@ -138,11 +138,11 @@ void BasicGUI_PlaneDlg::Init()
double aTrimSize = 2000.0; double aTrimSize = 2000.0;
/* min, max, step and decimals for spin boxes */ /* min, max, step and decimals for spin boxes */
GroupPntDir->SpinBox_DX->RangeStepAndValidator( 0.001, COORD_MAX, aStep, 3 ); GroupPntDir->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, DBL_DIGITS_DISPLAY);
GroupPntDir->SpinBox_DX->SetValue( aTrimSize ); GroupPntDir->SpinBox_DX->SetValue( aTrimSize );
Group3Pnts->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, 3); Group3Pnts->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, DBL_DIGITS_DISPLAY);
Group3Pnts->SpinBox_DX->SetValue( aTrimSize ); Group3Pnts->SpinBox_DX->SetValue( aTrimSize );
GroupFace->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, 3); GroupFace->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, aStep, DBL_DIGITS_DISPLAY);
GroupFace->SpinBox_DX->SetValue( aTrimSize ); GroupFace->SpinBox_DX->SetValue( aTrimSize );
/* signals and slots connections */ /* signals and slots connections */

View File

@ -118,9 +118,9 @@ void BasicGUI_VectorDlg::Init()
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
/* min, max, step and decimals for spin boxes */ /* min, max, step and decimals for spin boxes */
GroupDimensions->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupDimensions->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
double dx( 0. ), dy( 0. ), dz( 200. ); double dx( 0. ), dy( 0. ), dz( 200. );
GroupDimensions->SpinBox_DX->SetValue( dx ); GroupDimensions->SpinBox_DX->SetValue( dx );

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
@ -42,7 +42,7 @@
//================================================================================= //=================================================================================
// class : GenerationGUI_PrismDlg() // class : GenerationGUI_PrismDlg()
// purpose : Constructs a GenerationGUI_PrismDlg which is a child of 'parent', with the // purpose : Constructs a GenerationGUI_PrismDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'. // name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
@ -103,7 +103,7 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWid
// purpose : Destroys the object and frees any allocated resources // purpose : Destroys the object and frees any allocated resources
//================================================================================= //=================================================================================
GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg() GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg()
{ {
// no need to delete child widgets, Qt does it all for us // no need to delete child widgets, Qt does it all for us
} }
@ -123,14 +123,15 @@ void GenerationGUI_PrismDlg::Init()
GroupPoints2->LineEdit2->setReadOnly( true ); GroupPoints2->LineEdit2->setReadOnly( true );
GroupPoints2->LineEdit3->setReadOnly( true ); GroupPoints2->LineEdit3->setReadOnly( true );
myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil();
myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false; myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DX->SetValue(100.0); GroupPoints->SpinBox_DX->SetValue(100.0);
/* signals and slots connections */ /* signals and slots connections */
@ -146,9 +147,10 @@ void GenerationGUI_PrismDlg::Init()
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
@ -160,8 +162,8 @@ void GenerationGUI_PrismDlg::Init()
connect(GroupPoints2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName(tr("GEOM_EXTRUSION")); initName(tr("GEOM_EXTRUSION"));
ConstructorsClicked(0); ConstructorsClicked(0);
@ -178,50 +180,48 @@ void GenerationGUI_PrismDlg::ConstructorsClicked(int constructorId)
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
switch (constructorId) switch (constructorId)
{
case 0:
{ {
case 0: globalSelection( GEOM_ALLSHAPES );
{
globalSelection( GEOM_POINT );
GroupPoints2->hide(); GroupPoints2->hide();
resize(0, 0); resize(0, 0);
GroupPoints->show(); GroupPoints->show();
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit1->setText(GroupPoints2->LineEdit1->text()); // keep base
GroupPoints->LineEdit2->setText(""); GroupPoints->LineEdit2->setText("");
GroupPoints2->LineEdit1->setText(""); myVec = GEOM::GEOM_Object::_nil();
GroupPoints2->LineEdit2->setText(""); myOkVec = false;
GroupPoints2->LineEdit3->setText("");
myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil();
myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
break; break;
}
case 1:
{
globalSelection( GEOM_ALLSHAPES );
GroupPoints->hide();
resize(0, 0);
GroupPoints2->show();
myEditCurrentArgument = GroupPoints2->LineEdit1;
GroupPoints2->LineEdit1->setText("");
GroupPoints2->LineEdit2->setText("");
GroupPoints2->LineEdit3->setText("");
myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil();
myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
GroupPoints->LineEdit1->setText("");
GroupPoints->LineEdit2->setText("");
break;
}
} }
case 1:
{
globalSelection( GEOM_ALLSHAPES );
GroupPoints->hide();
resize(0, 0);
GroupPoints2->show();
myEditCurrentArgument = GroupPoints2->LineEdit1;
GroupPoints2->LineEdit1->setText(GroupPoints->LineEdit1->text()); // keep base
GroupPoints2->LineEdit2->setText("");
GroupPoints2->LineEdit3->setText("");
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
myOkPnt1 = myOkPnt2 = false;
break;
}
}
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if (!myOkBase)
SelectionIntoArgument();
} }
@ -287,7 +287,6 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
} }
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
displayPreview();
} }
else // getConstructorId()==1 - extrusion using 2 points else // getConstructorId()==1 - extrusion using 2 points
{ {
@ -327,8 +326,9 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
} }
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
displayPreview();
} }
displayPreview();
} }
@ -398,7 +398,7 @@ void GenerationGUI_PrismDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
@ -450,7 +450,12 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation()
//================================================================================= //=================================================================================
bool GenerationGUI_PrismDlg::isValid( QString& ) bool GenerationGUI_PrismDlg::isValid( QString& )
{ {
return myOkBase && ( myOkVec || (myOkPnt1 && myOkPnt2) ); if (getConstructorId() == 0)
// by vector and height
return (myOkBase && myOkVec);
// by two points
return (myOkBase && myOkPnt1 && myOkPnt2);
} }
//================================================================================= //=================================================================================
@ -461,10 +466,10 @@ bool GenerationGUI_PrismDlg::execute( ObjectList& objects )
{ {
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() )
{ {
case 0: case 0:
{ {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePrismVecH(myBase, myVec, getHeight()); MakePrismVecH(myBase, myVec, getHeight());
break; break;

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
@ -51,15 +51,15 @@ protected:
virtual bool isValid( QString& msg ); virtual bool isValid( QString& msg );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& objects );
private : private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent(QEvent* e);
double getHeight() const; double getHeight() const;
GEOM::GEOM_Object_var myBase; /* Base shape */ GEOM::GEOM_Object_var myBase; /* Base shape */
GEOM::GEOM_Object_var myVec; /* Vector, defining the direction */ GEOM::GEOM_Object_var myVec; /* Vector, defining the direction */
GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points for extrusion */ GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points for extrusion */
bool myOkBase; bool myOkBase;
bool myOkVec; bool myOkVec;
bool myOkPnt1; bool myOkPnt1;
@ -71,11 +71,12 @@ private :
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ActivateThisDialog(); void ActivateThisDialog();
void ConstructorsClicked(int);
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ConstructorsClicked(int);
void ValueChangedInSpinBox(); void ValueChangedInSpinBox();
void onReverse(); void onReverse();
}; };

View File

@ -114,7 +114,7 @@ void GenerationGUI_RevolDlg::Init()
double SpecificStep = 5; double SpecificStep = 5;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DX->SetValue(45.0); GroupPoints->SpinBox_DX->SetValue(45.0);
/* signals and slots connections */ /* signals and slots connections */

View File

@ -117,9 +117,9 @@ void PrimitiveGUI_BoxDlg::Init()
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
/* min, max, step and decimals for spin boxes */ /* min, max, step and decimals for spin boxes */
GroupDimensions->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupDimensions->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
double initValue = 200.0; double initValue = 200.0;
GroupDimensions->SpinBox_DX->SetValue(initValue); GroupDimensions->SpinBox_DX->SetValue(initValue);

View File

@ -119,12 +119,12 @@ void PrimitiveGUI_ConeDlg::Init()
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(0.000, COORD_MAX, step, 3); GroupPoints->SpinBox_DX->RangeStepAndValidator(0.000, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DY->RangeStepAndValidator(0.000, COORD_MAX, step, 3); GroupPoints->SpinBox_DY->RangeStepAndValidator(0.000, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupPoints->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.000, COORD_MAX, step, 3); GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.000, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.000, COORD_MAX, step, 3); GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.000, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupDimensions->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
double aRadius1(100.0), aRadius2(0.0), aHeight(300.0); double aRadius1(100.0), aRadius2(0.0), aHeight(300.0);
GroupPoints->SpinBox_DX->SetValue(aRadius1); GroupPoints->SpinBox_DX->SetValue(aRadius1);

View File

@ -118,13 +118,13 @@ void PrimitiveGUI_CylinderDlg::Init()
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
/* First constructor : radius */ /* First constructor : radius */
GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY);
/* First constructor : algebric height */ /* First constructor : algebric height */
GroupPoints->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupPoints->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
/* Second constructor : radius */ /* Second constructor : radius */
GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY);
/* Second constructor : algebric height */ /* Second constructor : algebric height */
GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupDimensions->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DX->SetValue(100.0); GroupPoints->SpinBox_DX->SetValue(100.0);
GroupPoints->SpinBox_DY->SetValue(300.0); GroupPoints->SpinBox_DY->SetValue(300.0);

View File

@ -112,8 +112,8 @@ void PrimitiveGUI_SphereDlg::Init()
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
/* min, max, step and decimals for spin boxes */ /* min, max, step and decimals for spin boxes */
GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DX->SetValue(100.0); GroupPoints->SpinBox_DX->SetValue(100.0);
GroupDimensions->SpinBox_DX->SetValue(100.0); GroupDimensions->SpinBox_DX->SetValue(100.0);

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
@ -39,23 +39,22 @@
#include "utilities.h" #include "utilities.h"
using namespace std;
//================================================================================= //=================================================================================
// class : PrimitiveGUI_TorusDlg() // class : PrimitiveGUI_TorusDlg()
// purpose : Constructs a PrimitiveGUI_TorusDlg which is a child of 'parent', with the // purpose : Constructs a PrimitiveGUI_TorusDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'. // name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg(GeometryGUI* theGeometryGUI, QWidget* parent, PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, bool modal, WFlags fl) const char* name, bool modal, WFlags fl)
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize | : GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_PV"))); SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_DXYZ"))); QPixmap image0(aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TORUS_PV")));
QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); QPixmap image1(aResMgr->loadPixmap("GEOM", tr("ICON_DLG_TORUS_DXYZ")));
QPixmap image2(aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
setCaption(tr("GEOM_TORUS_TITLE")); setCaption(tr("GEOM_TORUS_TITLE"));
@ -83,8 +82,8 @@ PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg(GeometryGUI* theGeometryGUI, QWidge
Layout1->addWidget(GroupDimensions, 2, 0); Layout1->addWidget(GroupDimensions, 2, 0);
/***************************************************************/ /***************************************************************/
setHelpFileName("turus.htm"); setHelpFileName("turus.htm");
Init(); Init();
} }
@ -109,7 +108,7 @@ void PrimitiveGUI_TorusDlg::Init()
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true );
myPoint = myDir = GEOM::GEOM_Object::_nil(); myPoint = myDir = GEOM::GEOM_Object::_nil();
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
@ -117,10 +116,10 @@ void PrimitiveGUI_TorusDlg::Init()
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, step, 3); GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, 3); GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, step, 3); GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DX->SetValue(300.0); GroupPoints->SpinBox_DX->SetValue(300.0);
GroupPoints->SpinBox_DY->SetValue(100.0); GroupPoints->SpinBox_DY->SetValue(100.0);
@ -130,6 +129,7 @@ void PrimitiveGUI_TorusDlg::Init()
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
@ -143,14 +143,18 @@ void PrimitiveGUI_TorusDlg::Init()
connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); GroupPoints->SpinBox_DY, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), GroupDimensions->SpinBox_DX, SLOT(SetStep(double)));
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
GroupDimensions->SpinBox_DY, SLOT(SetStep(double)));
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_TORUS" ) ); initName( tr( "GEOM_TORUS" ) );
ConstructorsClicked(0); ConstructorsClicked(0);
} }
@ -162,36 +166,39 @@ void PrimitiveGUI_TorusDlg::Init()
//================================================================================= //=================================================================================
void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId) void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId)
{ {
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
switch(constructorId)
{
case 0 :
{
globalSelection( GEOM_LINE );
GroupDimensions->hide(); switch (constructorId)
resize(0, 0); {
GroupPoints->show(); case 0:
{
myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection( GEOM_POINT );
GroupPoints->LineEdit1->setText(tr(""));
GroupPoints->LineEdit2->setText(tr("")); GroupDimensions->hide();
myPoint = myDir = GEOM::GEOM_Object::_nil(); resize(0, 0);
GroupPoints->show();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); myEditCurrentArgument = GroupPoints->LineEdit1;
break ; GroupPoints->LineEdit1->setText(tr(""));
} GroupPoints->LineEdit2->setText(tr(""));
case 1 : myPoint = myDir = GEOM::GEOM_Object::_nil();
{
GroupPoints->hide(); connect(myGeomGUI->getApp()->selectionMgr(),
resize( 0, 0 ); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
GroupDimensions->show(); SelectionIntoArgument();
break ; break;
}
} }
case 1:
{
GroupPoints->hide();
resize(0, 0);
GroupDimensions->show();
break;
}
}
displayPreview(); displayPreview();
} }
@ -217,21 +224,10 @@ bool PrimitiveGUI_TorusDlg::ClickOnApply()
return false; return false;
initName(); initName();
ConstructorsClicked( getConstructorId() );
return true; return true;
} }
//=======================================================================
// function : ClickOnCancel()
// purpose :
//=======================================================================
void PrimitiveGUI_TorusDlg::ClickOnCancel()
{
GEOMBase_Skeleton::ClickOnCancel();
}
//================================================================================= //=================================================================================
// function : SelectionIntoArgument() // function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case // purpose : Called when selection as changed or other case
@ -240,36 +236,51 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
{ {
if ( getConstructorId() != 0 ) if ( getConstructorId() != 0 )
return; return;
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
if(IObjectCount() != 1) if (IObjectCount() != 1)
{ {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint = GEOM::GEOM_Object::_nil(); myPoint = GEOM::GEOM_Object::_nil();
else if(myEditCurrentArgument == GroupPoints->LineEdit2) else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myDir = GEOM::GEOM_Object::_nil(); myDir = GEOM::GEOM_Object::_nil();
return; return;
} }
/* nbSel == 1 */ /* nbSel == 1 */
Standard_Boolean testResult = Standard_False; Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if(!testResult || CORBA::is_nil( aSelectedObject )) if (!testResult || CORBA::is_nil( aSelectedObject ))
return; return;
if(myEditCurrentArgument == GroupPoints->LineEdit1) if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint = aSelectedObject; myPoint = aSelectedObject;
else if(myEditCurrentArgument == GroupPoints->LineEdit2) else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myDir = aSelectedObject; myDir = aSelectedObject;
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
displayPreview(); displayPreview();
} }
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void PrimitiveGUI_TorusDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if (send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2)
{
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
@ -277,37 +288,21 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
void PrimitiveGUI_TorusDlg::SetEditCurrentArgument() void PrimitiveGUI_TorusDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) { if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection( GEOM_POINT ); globalSelection( GEOM_POINT );
} }
else if(send == GroupPoints->PushButton2) { else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_LINE ); globalSelection( GEOM_LINE );
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
} }
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void PrimitiveGUI_TorusDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2)
{
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
//================================================================================= //=================================================================================
// function : ActivateThisDialog() // function : ActivateThisDialog()
// purpose : // purpose :
@ -315,9 +310,10 @@ void PrimitiveGUI_TorusDlg::LineEditReturnPressed()
void PrimitiveGUI_TorusDlg::ActivateThisDialog() void PrimitiveGUI_TorusDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
} }
@ -333,16 +329,6 @@ void PrimitiveGUI_TorusDlg::enterEvent(QEvent* e)
} }
//=================================================================================
// function : DeactivateActiveDialog()
// purpose : public slot to deactivate if active
//=================================================================================
void PrimitiveGUI_TorusDlg::DeactivateActiveDialog()
{
GEOMBase_Skeleton::DeactivateActiveDialog();
}
//================================================================================= //=================================================================================
// function : ValueChangedInSpinBox // function : ValueChangedInSpinBox
// purpose : // purpose :
@ -380,22 +366,25 @@ bool PrimitiveGUI_TorusDlg::isValid( QString& msg )
bool PrimitiveGUI_TorusDlg::execute( ObjectList& objects ) bool PrimitiveGUI_TorusDlg::execute( ObjectList& objects )
{ {
bool res = false; bool res = false;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() )
{ {
case 0 : case 0:
{
if (!CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir )){
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2());
res = true;
}
break;
}
case 1 :
{ {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeTorusRR(getRadius1(), getRadius2()); if (!CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ))
{
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2());
res = true;
}
break;
}
case 1:
{
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
MakeTorusRR(getRadius1(), getRadius2());
res = true; res = true;
break; break;
} }
@ -408,16 +397,6 @@ bool PrimitiveGUI_TorusDlg::execute( ObjectList& objects )
} }
//=================================================================================
// function : closeEvent
// purpose :
//=================================================================================
void PrimitiveGUI_TorusDlg::closeEvent( QCloseEvent* e )
{
GEOMBase_Skeleton::closeEvent( e );
}
//================================================================================= //=================================================================================
// function : getRadius1() // function : getRadius1()
// purpose : // purpose :

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
@ -52,11 +52,10 @@ protected:
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& objects );
virtual void closeEvent( QCloseEvent* e );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent(QEvent* e);
double getRadius1() const; double getRadius1() const;
double getRadius2() const; double getRadius2() const;
@ -65,12 +64,11 @@ private:
DlgRef_2Sel2Spin* GroupPoints; DlgRef_2Sel2Spin* GroupPoints;
DlgRef_2Spin* GroupDimensions; DlgRef_2Spin* GroupDimensions;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ClickOnCancel();
void ActivateThisDialog(); void ActivateThisDialog();
void DeactivateActiveDialog();
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();