2004-01-07 20:46:21 +05:00
|
|
|
// GEOM GEOMGUI : GUI for Geometry component
|
|
|
|
//
|
|
|
|
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
|
|
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2.1 of the License.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
//
|
2006-06-01 17:32:40 +06:00
|
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
2004-01-07 20:46:21 +05:00
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// File : BasicGUI_PlaneDlg.cxx
|
|
|
|
// Author : Lucien PIGNOLONI
|
|
|
|
// Module : GEOM
|
|
|
|
// $Header$
|
|
|
|
|
|
|
|
#include "BasicGUI_PlaneDlg.h"
|
2005-06-02 13:17:09 +06:00
|
|
|
|
|
|
|
#include "SUIT_Desktop.h"
|
|
|
|
#include "SUIT_Session.h"
|
|
|
|
#include "SalomeApp_Application.h"
|
2005-11-03 13:30:14 +05:00
|
|
|
#include "LightApp_SelectionMgr.h"
|
2005-06-02 13:17:09 +06:00
|
|
|
|
|
|
|
#include <qlabel.h>
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
#include "GEOMImpl_Types.hxx"
|
2004-06-16 21:24:55 +06:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2004-01-07 20:46:21 +05:00
|
|
|
//=================================================================================
|
|
|
|
// class : BasicGUI_PlaneDlg()
|
|
|
|
// purpose : Constructs a BasicGUI_PlaneDlg which is a child of 'parent', with the
|
|
|
|
// name 'name' and widget flags set to 'f'.
|
|
|
|
// The dialog will by default be modeless, unless you set 'modal' to
|
|
|
|
// TRUE to construct a modal dialog.
|
|
|
|
//=================================================================================
|
2006-05-06 14:44:32 +06:00
|
|
|
BasicGUI_PlaneDlg::BasicGUI_PlaneDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
|
|
|
|
const char* name, bool modal, WFlags fl)
|
|
|
|
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
|
|
|
|
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
2004-01-07 20:46:21 +05:00
|
|
|
{
|
2005-06-02 13:17:09 +06:00
|
|
|
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_PV")));
|
|
|
|
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_3PNTS")));
|
|
|
|
QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_FACE")));
|
|
|
|
QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
2004-01-07 20:46:21 +05:00
|
|
|
|
|
|
|
setCaption(tr("GEOM_PLANE_TITLE"));
|
|
|
|
|
|
|
|
/***************************************************************/
|
|
|
|
GroupConstructors->setTitle(tr("GEOM_PLANE"));
|
|
|
|
RadioButton1->setPixmap(image0);
|
|
|
|
RadioButton2->setPixmap(image1);
|
|
|
|
RadioButton3->setPixmap(image2);
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
GroupPntDir = new DlgRef_2Sel1Spin(this, "GroupPointDirection");
|
|
|
|
GroupPntDir->GroupBox1->setTitle(tr("GEOM_PLANE_PV"));
|
|
|
|
GroupPntDir->TextLabel1->setText(tr("GEOM_POINT"));
|
|
|
|
GroupPntDir->TextLabel2->setText(tr("GEOM_VECTOR"));
|
|
|
|
GroupPntDir->TextLabel3->setText(tr("GEOM_PLANE_SIZE"));
|
|
|
|
GroupPntDir->PushButton1->setPixmap(image3);
|
|
|
|
GroupPntDir->PushButton2->setPixmap(image3);
|
|
|
|
GroupPntDir->LineEdit1->setReadOnly( true );
|
|
|
|
GroupPntDir->LineEdit2->setReadOnly( true );
|
|
|
|
|
|
|
|
Group3Pnts = new DlgRef_3Sel1Spin(this, "Group3Pnts");
|
|
|
|
Group3Pnts->GroupBox1->setTitle(tr("GEOM_3_POINTS"));
|
|
|
|
Group3Pnts->TextLabel1->setText(tr("GEOM_POINT1"));
|
|
|
|
Group3Pnts->TextLabel2->setText(tr("GEOM_POINT2"));
|
|
|
|
Group3Pnts->TextLabel3->setText(tr("GEOM_POINT3"));
|
|
|
|
Group3Pnts->TextLabel4->setText(tr("GEOM_PLANE_SIZE"));
|
|
|
|
Group3Pnts->PushButton1->setPixmap(image3);
|
|
|
|
Group3Pnts->PushButton2->setPixmap(image3);
|
|
|
|
Group3Pnts->PushButton3->setPixmap(image3);
|
|
|
|
|
|
|
|
Group3Pnts->LineEdit1->setReadOnly( true );
|
|
|
|
Group3Pnts->LineEdit2->setReadOnly( true );
|
|
|
|
Group3Pnts->LineEdit3->setReadOnly( true );
|
2004-01-07 20:46:21 +05:00
|
|
|
|
|
|
|
GroupFace = new DlgRef_1Sel1Spin(this, "GroupFace");
|
|
|
|
GroupFace->GroupBox1->setTitle(tr("GEOM_FACE"));
|
|
|
|
GroupFace->TextLabel1->setText(tr("GEOM_SELECTION"));
|
|
|
|
GroupFace->TextLabel2->setText(tr("GEOM_PLANE_SIZE"));
|
|
|
|
GroupFace->PushButton1->setPixmap(image3);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
GroupFace->LineEdit1->setReadOnly( true );
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
Layout1->addWidget(GroupPntDir, 2, 0);
|
|
|
|
Layout1->addWidget(Group3Pnts, 2, 0);
|
|
|
|
Layout1->addWidget(GroupFace, 2, 0);
|
2004-01-07 20:46:21 +05:00
|
|
|
/***************************************************************/
|
|
|
|
|
2006-05-06 14:44:32 +06:00
|
|
|
setHelpFileName("plane.htm");
|
|
|
|
|
2004-01-07 20:46:21 +05:00
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ~BasicGUI_PlaneDlg()
|
|
|
|
// purpose : Destroys the object and frees any allocated resources
|
|
|
|
//=================================================================================
|
|
|
|
BasicGUI_PlaneDlg::~BasicGUI_PlaneDlg()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : Init()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void BasicGUI_PlaneDlg::Init()
|
|
|
|
{
|
|
|
|
/* init variables */
|
2004-12-01 15:39:14 +05:00
|
|
|
myEditCurrentArgument = GroupPntDir->LineEdit1;
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil();
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2006-05-06 14:44:32 +06:00
|
|
|
// myGeomGUI->SetState( 0 );
|
2004-01-07 20:46:21 +05:00
|
|
|
|
|
|
|
/* Get setting of step value from file configuration */
|
2005-06-02 13:17:09 +06:00
|
|
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
|
|
|
double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
double aTrimSize = 2000.0;
|
2004-01-07 20:46:21 +05:00
|
|
|
|
|
|
|
/* min, max, step and decimals for spin boxes */
|
2004-12-01 15:39:14 +05:00
|
|
|
GroupPntDir->SpinBox_DX->RangeStepAndValidator( 0.001, 10000000.0, aStep, 3 );
|
|
|
|
GroupPntDir->SpinBox_DX->SetValue( aTrimSize );
|
|
|
|
Group3Pnts->SpinBox_DX->RangeStepAndValidator(0.001, 10000000.0, aStep, 3);
|
|
|
|
Group3Pnts->SpinBox_DX->SetValue( aTrimSize );
|
|
|
|
GroupFace->SpinBox_DX->RangeStepAndValidator(0.001, 10000000.0, aStep, 3);
|
|
|
|
GroupFace->SpinBox_DX->SetValue( aTrimSize );
|
2004-01-07 20:46:21 +05:00
|
|
|
|
|
|
|
/* signals and slots connections */
|
2004-12-01 15:39:14 +05:00
|
|
|
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
|
2006-05-06 14:44:32 +06:00
|
|
|
connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
|
|
|
|
connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2004-01-07 20:46:21 +05:00
|
|
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
|
|
|
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
2004-12-01 15:39:14 +05:00
|
|
|
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
|
|
|
|
|
|
|
|
connect(GroupPntDir->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
|
|
|
connect(GroupPntDir->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
|
|
|
connect(Group3Pnts->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
|
|
|
connect(Group3Pnts->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
|
|
|
connect(Group3Pnts->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
|
|
|
connect(GroupFace->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
|
|
|
|
|
|
|
connect(GroupPntDir->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
|
|
|
connect(GroupPntDir->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
|
|
|
connect(Group3Pnts->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
|
|
|
connect(Group3Pnts->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
|
|
|
connect(Group3Pnts->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
2004-01-07 20:46:21 +05:00
|
|
|
connect(GroupFace->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
connect(GroupPntDir->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
|
|
|
connect(Group3Pnts->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
2004-01-07 20:46:21 +05:00
|
|
|
connect(GroupFace->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
|
|
|
|
2006-05-06 14:44:32 +06:00
|
|
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPntDir->SpinBox_DX, SLOT(SetStep(double)));
|
|
|
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Pnts->SpinBox_DX, SLOT(SetStep(double)));
|
|
|
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupFace->SpinBox_DX, SLOT(SetStep(double)));
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2005-06-02 13:17:09 +06:00
|
|
|
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
initName( tr( "GEOM_PLANE" ) );
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
Group3Pnts->hide();
|
|
|
|
GroupFace->hide();
|
|
|
|
ConstructorsClicked( 0 );
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ConstructorsClicked()
|
|
|
|
// purpose : Radio button management
|
|
|
|
//=================================================================================
|
|
|
|
void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
|
|
|
|
{
|
2005-06-02 13:17:09 +06:00
|
|
|
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
|
2004-12-01 15:39:14 +05:00
|
|
|
myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil();
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
switch ( constructorId )
|
|
|
|
{
|
2004-01-07 20:46:21 +05:00
|
|
|
case 0: /* plane from a point and a direction (vector, edge...) */
|
|
|
|
{
|
2004-12-01 15:39:14 +05:00
|
|
|
Group3Pnts->hide();
|
|
|
|
GroupFace->hide();
|
|
|
|
resize(0, 0);
|
|
|
|
GroupPntDir->show();
|
|
|
|
|
|
|
|
myEditCurrentArgument = GroupPntDir->LineEdit1;
|
|
|
|
GroupPntDir->LineEdit1->setText(tr(""));
|
|
|
|
GroupPntDir->LineEdit2->setText(tr(""));
|
|
|
|
|
|
|
|
/* for the first argument */
|
|
|
|
globalSelection( GEOM_POINT );
|
|
|
|
break;
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
2004-12-01 15:39:14 +05:00
|
|
|
case 1: /* plane from 3 points */
|
2004-01-07 20:46:21 +05:00
|
|
|
{
|
2004-12-01 15:39:14 +05:00
|
|
|
GroupPntDir->hide();
|
|
|
|
GroupFace->hide();
|
|
|
|
resize(0, 0);
|
|
|
|
Group3Pnts->show();
|
|
|
|
|
|
|
|
myEditCurrentArgument = Group3Pnts->LineEdit1;
|
|
|
|
Group3Pnts->LineEdit1->setText("");
|
|
|
|
Group3Pnts->LineEdit2->setText("");
|
|
|
|
Group3Pnts->LineEdit3->setText("");
|
|
|
|
|
|
|
|
/* for the first argument */
|
|
|
|
globalSelection( GEOM_POINT );
|
|
|
|
break;
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
case 2: /* plane from a planar face selection */
|
|
|
|
{
|
2004-12-01 15:39:14 +05:00
|
|
|
GroupPntDir->hide();
|
|
|
|
Group3Pnts->hide();
|
|
|
|
resize(0, 0);
|
|
|
|
GroupFace->show();
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
myEditCurrentArgument = GroupFace->LineEdit1;
|
|
|
|
GroupFace->LineEdit1->setText(tr(""));
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
/* for the first argument */
|
|
|
|
globalSelection( GEOM_PLANE );
|
|
|
|
break;
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
}
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
myEditCurrentArgument->setFocus();
|
2005-06-02 13:17:09 +06:00
|
|
|
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
|
|
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ClickOnOk()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void BasicGUI_PlaneDlg::ClickOnOk()
|
|
|
|
{
|
2004-12-01 15:39:14 +05:00
|
|
|
if ( ClickOnApply() )
|
|
|
|
ClickOnCancel();
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ClickOnApply()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
bool BasicGUI_PlaneDlg::ClickOnApply()
|
2004-01-07 20:46:21 +05:00
|
|
|
{
|
2004-12-01 15:39:14 +05:00
|
|
|
if ( !onAccept() )
|
|
|
|
return false;
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
initName();
|
|
|
|
ConstructorsClicked( getConstructorId() );
|
|
|
|
return true;
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//=======================================================================
|
|
|
|
// function : ClickOnCancel()
|
|
|
|
// purpose :
|
|
|
|
//=======================================================================
|
|
|
|
void BasicGUI_PlaneDlg::ClickOnCancel()
|
|
|
|
{
|
|
|
|
GEOMBase_Skeleton::ClickOnCancel();
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : SelectionIntoArgument()
|
|
|
|
// purpose : Called when selection has changed
|
|
|
|
//=================================================================================
|
|
|
|
void BasicGUI_PlaneDlg::SelectionIntoArgument()
|
|
|
|
{
|
2004-12-01 15:39:14 +05:00
|
|
|
myEditCurrentArgument->setText("");
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2005-06-02 13:17:09 +06:00
|
|
|
if ( IObjectCount() != 1 )
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
|
|
|
if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil();
|
|
|
|
else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil();
|
|
|
|
else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = 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 == GroupFace->LineEdit1 ) myFace = GEOM::GEOM_Object::_nil();
|
|
|
|
return;
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
// nbSel == 1
|
|
|
|
Standard_Boolean aRes = Standard_False;
|
2005-06-02 13:17:09 +06:00
|
|
|
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
|
2004-12-01 15:39:14 +05:00
|
|
|
if ( !CORBA::is_nil( aSelectedObject ) && aRes )
|
|
|
|
{
|
|
|
|
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
|
|
|
|
if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject;
|
|
|
|
else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = aSelectedObject;
|
|
|
|
else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = aSelectedObject;
|
|
|
|
else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = aSelectedObject;
|
|
|
|
else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject;
|
|
|
|
else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace = aSelectedObject;
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
displayPreview();
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : SetEditCurrentArgument()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void BasicGUI_PlaneDlg::SetEditCurrentArgument()
|
|
|
|
{
|
|
|
|
QPushButton* send = (QPushButton*)sender();
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
if ( send == GroupPntDir->PushButton1 ) myEditCurrentArgument = GroupPntDir->LineEdit1;
|
|
|
|
else if ( send == GroupPntDir->PushButton2 ) myEditCurrentArgument = GroupPntDir->LineEdit2;
|
|
|
|
else if ( send == Group3Pnts->PushButton1 ) myEditCurrentArgument = Group3Pnts->LineEdit1;
|
|
|
|
else if ( send == Group3Pnts->PushButton2 ) myEditCurrentArgument = Group3Pnts->LineEdit2;
|
|
|
|
else if ( send == Group3Pnts->PushButton3 ) myEditCurrentArgument = Group3Pnts->LineEdit3;
|
|
|
|
else if ( send == GroupFace->PushButton1 ) myEditCurrentArgument = GroupFace->LineEdit1;
|
|
|
|
|
|
|
|
myEditCurrentArgument->setFocus();
|
|
|
|
|
|
|
|
if ( myEditCurrentArgument == GroupPntDir->LineEdit2 )
|
|
|
|
globalSelection( GEOM_LINE );
|
|
|
|
else if ( myEditCurrentArgument == GroupFace->LineEdit1 )
|
|
|
|
globalSelection( GEOM_PLANE );
|
|
|
|
else
|
|
|
|
globalSelection( GEOM_POINT );
|
|
|
|
|
|
|
|
SelectionIntoArgument();
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : LineEditReturnPressed()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void BasicGUI_PlaneDlg::LineEditReturnPressed()
|
|
|
|
{
|
2004-12-01 15:39:14 +05:00
|
|
|
QLineEdit* send = (QLineEdit*)sender();
|
|
|
|
if ( send == GroupPntDir->LineEdit1 ||
|
|
|
|
send == GroupPntDir->LineEdit2 ||
|
|
|
|
send == Group3Pnts->LineEdit1 ||
|
|
|
|
send == Group3Pnts->LineEdit2 ||
|
|
|
|
send == Group3Pnts->LineEdit3 ||
|
|
|
|
send == GroupFace->LineEdit1 )
|
|
|
|
{
|
|
|
|
myEditCurrentArgument = send;
|
|
|
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ActivateThisDialog()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void BasicGUI_PlaneDlg::ActivateThisDialog()
|
|
|
|
{
|
|
|
|
GEOMBase_Skeleton::ActivateThisDialog();
|
2005-06-02 13:17:09 +06:00
|
|
|
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
|
|
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2006-05-06 14:44:32 +06:00
|
|
|
// myGeomGUI->SetState( 0 );
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
ConstructorsClicked( getConstructorId() );
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//=================================================================================
|
|
|
|
// function : DeactivateActiveDialog()
|
|
|
|
// purpose : public slot to deactivate if active
|
|
|
|
//=================================================================================
|
|
|
|
void BasicGUI_PlaneDlg::DeactivateActiveDialog()
|
|
|
|
{
|
2006-05-06 14:44:32 +06:00
|
|
|
// myGeomGUI->SetState( -1 );
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOMBase_Skeleton::DeactivateActiveDialog();
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : enterEvent()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void BasicGUI_PlaneDlg::enterEvent(QEvent* e)
|
|
|
|
{
|
2004-12-01 15:39:14 +05:00
|
|
|
if ( !GroupConstructors->isEnabled() )
|
|
|
|
ActivateThisDialog();
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ValueChangedInSpinBox()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void BasicGUI_PlaneDlg::ValueChangedInSpinBox(double newValue)
|
|
|
|
{
|
2004-12-01 15:39:14 +05:00
|
|
|
displayPreview();
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//=================================================================================
|
|
|
|
// function : getSize()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
double BasicGUI_PlaneDlg::getSize() const
|
|
|
|
{
|
|
|
|
switch ( getConstructorId() )
|
|
|
|
{
|
|
|
|
case 0 : return GroupPntDir->SpinBox_DX->GetValue();
|
|
|
|
case 1 : return Group3Pnts->SpinBox_DX->GetValue();
|
|
|
|
case 2 : return GroupFace->SpinBox_DX->GetValue();
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
2004-12-01 15:39:14 +05:00
|
|
|
return 0.;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : createOperation
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
GEOM::GEOM_IOperations_ptr BasicGUI_PlaneDlg::createOperation()
|
|
|
|
{
|
2006-05-06 14:44:32 +06:00
|
|
|
return myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() );
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//=================================================================================
|
|
|
|
// function : isEqual
|
|
|
|
// purpose : it may also be needed to check for min distance between gp_Pnt-s...
|
|
|
|
//=================================================================================
|
|
|
|
static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 )
|
|
|
|
{
|
|
|
|
return thePnt1->_is_equivalent( thePnt2 );
|
|
|
|
}
|
2004-01-07 20:46:21 +05:00
|
|
|
|
|
|
|
//=================================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
// function : isValid
|
2004-01-07 20:46:21 +05:00
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
bool BasicGUI_PlaneDlg::isValid( QString& msg )
|
2004-01-07 20:46:21 +05:00
|
|
|
{
|
2004-12-01 15:39:14 +05:00
|
|
|
const int id = getConstructorId();
|
|
|
|
if ( getSize() <= 0 )
|
|
|
|
{
|
|
|
|
msg = QString( "Please, enter size greater than 0." );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if ( id == 0 )
|
|
|
|
return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir );
|
|
|
|
else if ( id == 1 )
|
|
|
|
return !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) &&
|
|
|
|
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
|
|
|
|
else if ( id == 2 )
|
|
|
|
return !CORBA::is_nil( myFace );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : execute
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
bool BasicGUI_PlaneDlg::execute( ObjectList& objects )
|
|
|
|
{
|
|
|
|
bool res = false;
|
|
|
|
|
|
|
|
GEOM::GEOM_Object_var anObj;
|
|
|
|
|
|
|
|
switch ( getConstructorId() )
|
|
|
|
{
|
|
|
|
case 0 :
|
|
|
|
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlanePntVec( myPoint, myDir, getSize() );
|
|
|
|
res = true;
|
|
|
|
break;
|
|
|
|
case 1 :
|
|
|
|
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlaneThreePnt( myPoint1, myPoint2, myPoint3, getSize() );
|
|
|
|
res = true;
|
|
|
|
break;
|
|
|
|
case 2 :
|
|
|
|
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlaneFace( myFace, getSize() );
|
|
|
|
res = true;
|
|
|
|
break;
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
if ( !anObj->_is_nil() )
|
|
|
|
objects.push_back( anObj._retn() );
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : closeEvent
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void BasicGUI_PlaneDlg::closeEvent( QCloseEvent* e )
|
|
|
|
{
|
|
|
|
GEOMBase_Skeleton::closeEvent( e );
|
2004-01-07 20:46:21 +05:00
|
|
|
}
|
2004-12-01 15:39:14 +05:00
|
|
|
|