mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-30 20:50:33 +05:00
Implement GUI
This commit is contained in:
parent
3dff858d0d
commit
1355dedeb9
@ -54,6 +54,7 @@ SET( _res_files
|
||||
build_edge_wire.png
|
||||
build_edge_curve.png
|
||||
build_face.png
|
||||
build_face_surface.png
|
||||
build_shell.png
|
||||
build_solid.png
|
||||
build_wire.png
|
||||
|
BIN
resources/build_face_surface.png
Normal file
BIN
resources/build_face_surface.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 682 B |
@ -49,18 +49,20 @@
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
BuildGUI_FaceDlg::BuildGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
|
||||
: GEOMBase_Skeleton( theGeometryGUI, parent )
|
||||
: GEOMBase_Skeleton( theGeometryGUI, parent ),
|
||||
GroupWire (0),
|
||||
myGroupSurf (0)
|
||||
{
|
||||
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BUILD_FACE" ) ) );
|
||||
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
||||
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
||||
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BUILD_FACE" ) ) );
|
||||
QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BUILD_FACE_SURFACE" ) ) );
|
||||
|
||||
setWindowTitle( tr( "GEOM_FACE_TITLE" ) );
|
||||
|
||||
/***************************************************************/
|
||||
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_FACE" ) );
|
||||
mainFrame()->RadioButton1->setIcon( image0 );
|
||||
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->RadioButton2->close();
|
||||
mainFrame()->RadioButton1->setIcon( image1 );
|
||||
mainFrame()->RadioButton2->setIcon( image2 );
|
||||
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
@ -69,11 +71,20 @@ BuildGUI_FaceDlg::BuildGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget* parent
|
||||
GroupWire->GroupBox1->setTitle( tr( "GEOM_FACE_FFW" ) );
|
||||
GroupWire->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
|
||||
GroupWire->CheckButton1->setText( tr( "GEOM_FACE_OPT" ) );
|
||||
GroupWire->PushButton1->setIcon( image1 );
|
||||
GroupWire->PushButton1->setIcon( image0 );
|
||||
|
||||
myGroupSurf = new DlgRef_2Sel(centralWidget());
|
||||
|
||||
myGroupSurf->GroupBox1->setTitle(tr("GEOM_FACE_FROM_SURFACE" ) );
|
||||
myGroupSurf->TextLabel1->setText(tr("GEOM_FACE"));
|
||||
myGroupSurf->TextLabel2->setText(tr("GEOM_WIRE"));
|
||||
myGroupSurf->PushButton1->setIcon(image0);
|
||||
myGroupSurf->PushButton2->setIcon(image0);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
||||
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
||||
layout->addWidget( GroupWire );
|
||||
layout->addWidget(myGroupSurf);
|
||||
/***************************************************************/
|
||||
|
||||
setHelpFileName("create_face_page.html");
|
||||
@ -102,27 +113,79 @@ void BuildGUI_FaceDlg::Init()
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupWire->LineEdit1;
|
||||
GroupWire->LineEdit1->setReadOnly( true );
|
||||
myGroupSurf->LineEdit1->setReadOnly( true );
|
||||
myGroupSurf->LineEdit2->setReadOnly( true );
|
||||
|
||||
GroupWire->CheckButton1->setChecked( true );
|
||||
myWires.clear();
|
||||
|
||||
TColStd_MapOfInteger aMap;
|
||||
aMap.Add( GEOM_EDGE );
|
||||
aMap.Add( GEOM_WIRE );
|
||||
globalSelection( aMap );
|
||||
myFace.nullify();
|
||||
myWire.nullify();
|
||||
|
||||
/* signals and slots connections */
|
||||
connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
|
||||
connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
|
||||
|
||||
connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
connect( GroupWire->LineEdit1, SIGNAL( returnPressed()), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( GroupWire->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( myGroupSurf->LineEdit1, SIGNAL( returnPressed()), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( myGroupSurf->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( myGroupSurf->LineEdit2, SIGNAL( returnPressed()), this, SLOT( LineEditReturnPressed() ) );
|
||||
connect( myGroupSurf->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
initName( tr( "GEOM_FACE" ) );
|
||||
SelectionIntoArgument();
|
||||
|
||||
ConstructorsClicked(0);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
switch (constructorId) {
|
||||
case 0:
|
||||
{
|
||||
TColStd_MapOfInteger aMap;
|
||||
|
||||
aMap.Add(GEOM_EDGE);
|
||||
aMap.Add(GEOM_WIRE);
|
||||
globalSelection(aMap);
|
||||
|
||||
myEditCurrentArgument = GroupWire->LineEdit1;
|
||||
GroupWire->LineEdit1->setText("");
|
||||
GroupWire->show();
|
||||
myGroupSurf->hide();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
globalSelection(GEOM_FACE); // For the first element.
|
||||
|
||||
myEditCurrentArgument = myGroupSurf->LineEdit1;
|
||||
myGroupSurf->LineEdit1->setText("");
|
||||
myGroupSurf->PushButton1->setDown(true);
|
||||
myGroupSurf->PushButton2->setDown(false);
|
||||
GroupWire->hide();
|
||||
myGroupSurf->show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
myWires.clear();
|
||||
myFace.nullify();
|
||||
myWire.nullify();
|
||||
qApp->processEvents();
|
||||
updateGeometry();
|
||||
resize(minimumSizeHint());
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
@ -156,6 +219,7 @@ bool BuildGUI_FaceDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::SelectionIntoArgument()
|
||||
{
|
||||
if (myEditCurrentArgument == GroupWire->LineEdit1) {
|
||||
myEditCurrentArgument->setText( "" );
|
||||
|
||||
QList<TopAbs_ShapeEnum> types;
|
||||
@ -166,6 +230,33 @@ void BuildGUI_FaceDlg::SelectionIntoArgument()
|
||||
QString aName = myWires.count() > 1 ? QString( "%1_objects").arg( myWires.count() ) : GEOMBase::GetName( myWires[0].get() );
|
||||
myEditCurrentArgument->setText( aName );
|
||||
}
|
||||
} else if (myEditCurrentArgument == myGroupSurf->LineEdit1 ||
|
||||
myEditCurrentArgument == myGroupSurf->LineEdit2) {
|
||||
const bool isEditFace = myEditCurrentArgument == myGroupSurf->LineEdit1;
|
||||
const TopAbs_ShapeEnum aType = isEditFace ? TopAbs_FACE : TopAbs_WIRE;
|
||||
GEOM::GeomObjPtr aSelectedObject = getSelected(aType);
|
||||
GEOM::GeomObjPtr &anObj = isEditFace ? myFace : myWire;
|
||||
|
||||
if (aSelectedObject) {
|
||||
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject.get()));
|
||||
anObj = aSelectedObject;
|
||||
} else {
|
||||
myEditCurrentArgument->setText("");
|
||||
anObj.nullify();
|
||||
}
|
||||
|
||||
if (isEditFace) {
|
||||
if (myFace && !myWire) {
|
||||
myGroupSurf->PushButton2->click();
|
||||
}
|
||||
} else {
|
||||
if (!myFace && myWire) {
|
||||
myGroupSurf->PushButton1->click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
displayPreview(true);
|
||||
}
|
||||
|
||||
|
||||
@ -176,18 +267,33 @@ void BuildGUI_FaceDlg::SelectionIntoArgument()
|
||||
void BuildGUI_FaceDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
if ( send != GroupWire->PushButton1 )
|
||||
return;
|
||||
|
||||
if (send == GroupWire->PushButton1) {
|
||||
TColStd_MapOfInteger aMap;
|
||||
aMap.Add( GEOM_EDGE );
|
||||
aMap.Add( GEOM_WIRE );
|
||||
globalSelection( aMap );
|
||||
|
||||
aMap.Add(GEOM_EDGE);
|
||||
aMap.Add(GEOM_WIRE);
|
||||
globalSelection(aMap);
|
||||
myEditCurrentArgument = GroupWire->LineEdit1;
|
||||
}
|
||||
else if (send == myGroupSurf->PushButton1) {
|
||||
globalSelection(GEOM_FACE);
|
||||
myEditCurrentArgument = myGroupSurf->LineEdit1;
|
||||
myGroupSurf->PushButton2->setDown(false);
|
||||
myGroupSurf->LineEdit2->setEnabled(false);
|
||||
}
|
||||
else if (send == myGroupSurf->PushButton2) {
|
||||
globalSelection(GEOM_WIRE);
|
||||
myEditCurrentArgument = myGroupSurf->LineEdit2;
|
||||
myGroupSurf->PushButton1->setDown(false);
|
||||
myGroupSurf->LineEdit1->setEnabled(false);
|
||||
}
|
||||
|
||||
// enable line edit
|
||||
myEditCurrentArgument->setEnabled(true);
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
send->setDown(true);
|
||||
displayPreview(true);
|
||||
}
|
||||
|
||||
|
||||
@ -198,12 +304,11 @@ void BuildGUI_FaceDlg::SetEditCurrentArgument()
|
||||
void BuildGUI_FaceDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
TColStd_MapOfInteger aMap;
|
||||
aMap.Add( GEOM_EDGE );
|
||||
aMap.Add( GEOM_WIRE );
|
||||
globalSelection( aMap );
|
||||
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
ConstructorsClicked(getConstructorId());
|
||||
}
|
||||
|
||||
|
||||
@ -232,7 +337,20 @@ GEOM::GEOM_IOperations_ptr BuildGUI_FaceDlg::createOperation()
|
||||
//=================================================================================
|
||||
bool BuildGUI_FaceDlg::isValid( QString& )
|
||||
{
|
||||
return !myWires.isEmpty();
|
||||
bool ok = false;
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
ok = !myWires.isEmpty();
|
||||
break;
|
||||
case 1:
|
||||
ok = myFace && myWire;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -241,14 +359,32 @@ bool BuildGUI_FaceDlg::isValid( QString& )
|
||||
//=================================================================================
|
||||
bool BuildGUI_FaceDlg::execute( ObjectList& objects )
|
||||
{
|
||||
bool res = false;
|
||||
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
{
|
||||
GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
|
||||
objlist->length( myWires.count() );
|
||||
for ( int i = 0; i < myWires.count(); i++ )
|
||||
objlist[i] = myWires[i].copy();
|
||||
|
||||
GEOM::GEOM_Object_var anObj = anOper->MakeFaceWires( objlist.in(), GroupWire->CheckButton1->isChecked() );
|
||||
objlist->length( myWires.count() );
|
||||
|
||||
for ( int i = 0; i < myWires.count(); i++ ) {
|
||||
objlist[i] = myWires[i].copy();
|
||||
}
|
||||
|
||||
anObj = anOper->MakeFaceWires( objlist.in(), GroupWire->CheckButton1->isChecked() );
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
anObj = anOper->MakeFaceFromSurface(myFace.get(), myWire.get());
|
||||
res = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!anObj->_is_nil()) {
|
||||
objects.push_back(anObj._retn());
|
||||
@ -262,5 +398,5 @@ bool BuildGUI_FaceDlg::execute( ObjectList& objects )
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return res;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
class DlgRef_1Sel1Check;
|
||||
class DlgRef_2Sel;
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_FaceDlg
|
||||
@ -56,10 +57,14 @@ private:
|
||||
|
||||
private:
|
||||
QList<GEOM::GeomObjPtr> myWires;
|
||||
GEOM::GeomObjPtr myFace;
|
||||
GEOM::GeomObjPtr myWire;
|
||||
|
||||
DlgRef_1Sel1Check* GroupWire;
|
||||
DlgRef_2Sel *myGroupSurf;
|
||||
|
||||
private slots:
|
||||
void ConstructorsClicked (int);
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ActivateThisDialog();
|
||||
|
@ -159,6 +159,10 @@
|
||||
<source>ICON_DLG_BUILD_FACE</source>
|
||||
<translation>build_face.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_BUILD_FACE_SURFACE</source>
|
||||
<translation>build_face_surface.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_FACE_HW</source>
|
||||
<translation>face_hw.png</translation>
|
||||
|
@ -691,6 +691,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>GEOM_FACE_FFW</source>
|
||||
<translation>Face creation from wires and/or edges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_FACE_FROM_SURFACE</source>
|
||||
<translation>Face creation from surface bounded by wire</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_FACE_OPT</source>
|
||||
<translation>Try to create a planar face</translation>
|
||||
|
Loading…
Reference in New Issue
Block a user