mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-28 18:30:36 +05:00
Implementation of GUI
This commit is contained in:
parent
e20a386aa8
commit
c087e1bee8
@ -22,13 +22,13 @@ sphere1 = geompy.MakeSpherePntR(p1, 100)
|
||||
faces2 = geompy.SubShapeAllSorted(sphere1, GEOM.FACE)
|
||||
face2 = faces2[0]
|
||||
|
||||
# perform edge extention
|
||||
# perform edge extension
|
||||
resEdge1 = geompy.ExtendEdge(edge1, 0.2, 0.8)
|
||||
resEdge2 = geompy.ExtendEdge(edge1, -0.3, 1.3)
|
||||
resEdge3 = geompy.ExtendEdge(edge2, 0.5, 1)
|
||||
resEdge4 = geompy.ExtendEdge(edge2, 0.2, 0.5)
|
||||
|
||||
# perform face extention
|
||||
# perform face extension
|
||||
resFace1 = geompy.ExtendFace(face1, 0.2, 0.8, -0.3, 1.3)
|
||||
resFace2 = geompy.ExtendFace(face1, 0, 0.5, 1, 2)
|
||||
resFace3 = geompy.ExtendFace(face2, 0.2, 0.8, 0.3, 0.7)
|
||||
|
@ -427,6 +427,14 @@
|
||||
<source>ICON_DLG_PROJECTION</source>
|
||||
<translation>projection.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_EXTEND_EDGE</source>
|
||||
<translation>filling.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_EXTEND_FACE</source>
|
||||
<translation>projection.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_PARTITION</source>
|
||||
<translation>partition.png</translation>
|
||||
@ -1095,6 +1103,10 @@
|
||||
<source>ICO_PROJECTION</source>
|
||||
<translation>projection.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_EXTENSION</source>
|
||||
<translation>filling.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_ORIGIN_AND_VECTORS</source>
|
||||
<translation>origin_and_vectors.png</translation>
|
||||
|
@ -4980,6 +4980,18 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>STB_GET_SHARED_SHAPES</source>
|
||||
<translation>Get shared shapes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_EXTENSION</source>
|
||||
<translation>Extend Edge or Face</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_EXTENSION</source>
|
||||
<translation>Extension</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_EXTENSION</source>
|
||||
<translation>Extend Edge or Face</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_PUBLISH_RESULT_GRP</source>
|
||||
<translation>Advanced options</translation>
|
||||
@ -7030,4 +7042,47 @@ Do you want to create new material?</translation>
|
||||
<translation>All interferences</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TransformationGUI_ExtensionDlg</name>
|
||||
<message>
|
||||
<source>GEOM_EXTENSION_TITLE</source>
|
||||
<translation>Extension of Edge or Face</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_EXTENSION</source>
|
||||
<translation>Extension</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_EXTENSION_MIN</source>
|
||||
<translation>First Parameter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_EXTENSION_MAX</source>
|
||||
<translation>Last Parameter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_EXTENSION_MIN_U</source>
|
||||
<translation>First U-Parameter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_EXTENSION_MAX_U</source>
|
||||
<translation>Last U-Parameter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_EXTENSION_MIN_V</source>
|
||||
<translation>First V-Parameter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_EXTENSION_MAX_V</source>
|
||||
<translation>Last V-Parameter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_EXTENSION_EDGE_NAME</source>
|
||||
<translation>ExtendedEdge</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_EXTENSION_FACE_NAME</source>
|
||||
<translation>ExtendedFace</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -587,6 +587,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
|
||||
case GEOMOp::OpMultiTranslate: // MENU TRANSFORMATION - MULTI-TRANSLATION
|
||||
case GEOMOp::OpMultiRotate: // MENU TRANSFORMATION - MULTI-ROTATION
|
||||
case GEOMOp::OpReimport: // CONTEXT(POPUP) MENU - RELOAD_IMPORTED
|
||||
case GEOMOp::OpExtension: // MENU TRANSFORMATION - EXTENSION
|
||||
libName = "TransformationGUI";
|
||||
break;
|
||||
case GEOMOp::OpPartition: // MENU OPERATION - PARTITION
|
||||
@ -963,6 +964,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createGeomAction( GEOMOp::OpProjection, "PROJECTION" );
|
||||
createGeomAction( GEOMOp::OpMultiTranslate, "MUL_TRANSLATION" );
|
||||
createGeomAction( GEOMOp::OpMultiRotate, "MUL_ROTATION" );
|
||||
createGeomAction( GEOMOp::OpExtension, "EXTENSION" );
|
||||
|
||||
createGeomAction( GEOMOp::OpPartition, "PARTITION" );
|
||||
createGeomAction( GEOMOp::OpArchimede, "ARCHIMEDE" );
|
||||
@ -1200,6 +1202,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createMenu( GEOMOp::OpScale, transId, -1 );
|
||||
createMenu( GEOMOp::OpOffset, transId, -1 );
|
||||
createMenu( GEOMOp::OpProjection, transId, -1 );
|
||||
createMenu( GEOMOp::OpExtension, transId, -1 );
|
||||
createMenu( separator(), transId, -1 );
|
||||
createMenu( GEOMOp::OpMultiTranslate, transId, -1 );
|
||||
createMenu( GEOMOp::OpMultiRotate, transId, -1 );
|
||||
@ -1372,6 +1375,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createTool( GEOMOp::OpScale, transTbId );
|
||||
createTool( GEOMOp::OpOffset, transTbId );
|
||||
createTool( GEOMOp::OpProjection, transTbId );
|
||||
createTool( GEOMOp::OpExtension, transTbId );
|
||||
createTool( separator(), transTbId );
|
||||
createTool( GEOMOp::OpMultiTranslate, transTbId );
|
||||
createTool( GEOMOp::OpMultiRotate, transTbId );
|
||||
|
@ -142,6 +142,7 @@ namespace GEOMOp {
|
||||
OpMultiRotate = 3607, // MENU OPERATIONS - TRANSFORMATION - MULTI-ROTATION
|
||||
OpReimport = 3608, // POPUP MENU - RELOAD IMPORTED
|
||||
OpProjection = 3609, // MENU OPERATIONS - TRANSFORMATION - PROJECTION
|
||||
OpExtension = 3610, // MENU OPERATIONS - TRANSFORMATION - EXTENSION
|
||||
// OperationGUI ----------------//--------------------------------
|
||||
OpPartition = 3700, // MENU OPERATION - PARTITION
|
||||
OpArchimede = 3701, // MENU OPERATION - ARCHIMEDE
|
||||
|
@ -66,6 +66,7 @@ SET(_uic_files
|
||||
|
||||
SET(TransformationGUI_HEADERS
|
||||
TransformationGUI.h
|
||||
TransformationGUI_ExtensionDlg.h
|
||||
TransformationGUI_MultiTranslationDlg.h
|
||||
TransformationGUI_MultiRotationDlg.h
|
||||
TransformationGUI_TranslationDlg.h
|
||||
@ -79,6 +80,7 @@ SET(TransformationGUI_HEADERS
|
||||
|
||||
# header files / to be processed by moc
|
||||
SET(_moc_HEADERS
|
||||
TransformationGUI_ExtensionDlg.h
|
||||
TransformationGUI_MultiTranslationDlg.h
|
||||
TransformationGUI_MultiRotationDlg.h
|
||||
TransformationGUI_TranslationDlg.h
|
||||
@ -100,6 +102,7 @@ QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
|
||||
|
||||
SET(TransformationGUI_SOURCES
|
||||
TransformationGUI.cxx
|
||||
TransformationGUI_ExtensionDlg.cxx
|
||||
TransformationGUI_MultiTranslationDlg.cxx
|
||||
TransformationGUI_MultiRotationDlg.cxx
|
||||
TransformationGUI_TranslationDlg.cxx
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <SalomeApp_Study.h>
|
||||
#include <SALOME_ListIteratorOfListIO.hxx>
|
||||
|
||||
#include "TransformationGUI_ExtensionDlg.h" // Method EXTENSION
|
||||
#include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION
|
||||
#include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION
|
||||
#include "TransformationGUI_TranslationDlg.h" // Method TRANSLATION
|
||||
@ -151,6 +152,9 @@ bool TransformationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
|
||||
} // for (; aSelIt.More(); aSelIt.Next())
|
||||
}
|
||||
break;
|
||||
case GEOMOp::OpExtension: // EXTENSION
|
||||
aDlg = new TransformationGUI_ExtensionDlg( getGeometryGUI(), parent );
|
||||
break;
|
||||
default:
|
||||
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
|
||||
break;
|
||||
|
411
src/TransformationGUI/TransformationGUI_ExtensionDlg.cxx
Normal file
411
src/TransformationGUI/TransformationGUI_ExtensionDlg.cxx
Normal file
@ -0,0 +1,411 @@
|
||||
// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 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, or (at your option) any later version.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
// File : TransformationGUI_ExtensionDlg.cxx
|
||||
// Author : Sergey KHROMOV, Open CASCADE S.A.S.
|
||||
|
||||
#include "TransformationGUI_ExtensionDlg.h"
|
||||
#include <GEOMBase.h>
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <SalomeApp_DoubleSpinBox.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// class : TransformationGUI_ExtensionDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
TransformationGUI_ExtensionDlg::TransformationGUI_ExtensionDlg
|
||||
(GeometryGUI* theGeometryGUI, QWidget* parent,
|
||||
bool modal, Qt::WindowFlags fl)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
|
||||
myObjLbl (0),
|
||||
myUMinLbl (0),
|
||||
myUMaxLbl (0),
|
||||
myVMinLbl (0),
|
||||
myVMaxLbl (0),
|
||||
mySelButton (0),
|
||||
myEditObjName (0),
|
||||
myUMinSpinBox (0),
|
||||
myUMaxSpinBox (0),
|
||||
myVMinSpinBox (0),
|
||||
myVMaxSpinBox (0)
|
||||
{
|
||||
QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_EXTEND_EDGE")));
|
||||
QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_EXTEND_FACE")));
|
||||
|
||||
setWindowTitle(tr("GEOM_EXTENSION_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
mainFrame()->GroupConstructors->setTitle(tr ("GEOM_EXTENSION"));
|
||||
mainFrame()->RadioButton1->setIcon(image1);
|
||||
mainFrame()->RadioButton2->setIcon(image2);
|
||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
QGroupBox *aGrp = new QGroupBox(tr("GEOM_ARGUMENTS"));
|
||||
|
||||
myObjLbl = new QLabel;
|
||||
myUMinLbl = new QLabel;
|
||||
myUMaxLbl = new QLabel;
|
||||
myVMinLbl = new QLabel;
|
||||
myVMaxLbl = new QLabel;
|
||||
mySelButton = new QPushButton;
|
||||
myEditObjName = new QLineEdit;
|
||||
myUMinSpinBox = new SalomeApp_DoubleSpinBox;
|
||||
myUMaxSpinBox = new SalomeApp_DoubleSpinBox;
|
||||
myVMinSpinBox = new SalomeApp_DoubleSpinBox;
|
||||
myVMaxSpinBox = new SalomeApp_DoubleSpinBox;
|
||||
|
||||
myVMinLbl->setText(tr("GEOM_EXTENSION_MIN_V"));
|
||||
myVMaxLbl->setText(tr("GEOM_EXTENSION_MAX_V"));
|
||||
mySelButton->setIcon(image0);
|
||||
|
||||
QGridLayout *aGrpLayout = new QGridLayout(aGrp);
|
||||
|
||||
aGrpLayout->setMargin(9);
|
||||
aGrpLayout->setSpacing(6);
|
||||
aGrpLayout->addWidget(myObjLbl, 0, 0);
|
||||
aGrpLayout->addWidget(myUMinLbl, 1, 0);
|
||||
aGrpLayout->addWidget(myUMaxLbl, 2, 0);
|
||||
aGrpLayout->addWidget(myVMinLbl, 3, 0);
|
||||
aGrpLayout->addWidget(myVMaxLbl, 4, 0);
|
||||
aGrpLayout->addWidget(mySelButton, 0, 1);
|
||||
aGrpLayout->addWidget(myEditObjName, 0, 2);
|
||||
aGrpLayout->addWidget(myUMinSpinBox, 1, 1, 1, 2);
|
||||
aGrpLayout->addWidget(myUMaxSpinBox, 2, 1, 1, 2);
|
||||
aGrpLayout->addWidget(myVMinSpinBox, 3, 1, 1, 2);
|
||||
aGrpLayout->addWidget(myVMaxSpinBox, 4, 1, 1, 2);
|
||||
|
||||
myVMinLbl->hide();
|
||||
myVMaxLbl->hide();
|
||||
myVMinSpinBox->hide();
|
||||
myVMaxSpinBox->hide();
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(aGrp);
|
||||
/***************************************************************/
|
||||
|
||||
setHelpFileName("create_extension_page.html");
|
||||
|
||||
/* Initialisations */
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ~GenerationGUI_FillingDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
TransformationGUI_ExtensionDlg::~TransformationGUI_ExtensionDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ExtensionDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
showOnlyPreviewControl();
|
||||
myEditCurrentArgument = myEditObjName;
|
||||
|
||||
double aStep = 0.1;
|
||||
/* min, max, step and decimals for spin boxes & initial values */
|
||||
initSpinBox(myUMinSpinBox, -MAX_NUMBER, MAX_NUMBER, aStep, "parametric_precision");
|
||||
initSpinBox(myUMaxSpinBox, -MAX_NUMBER, MAX_NUMBER, aStep, "parametric_precision");
|
||||
initSpinBox(myVMinSpinBox, -MAX_NUMBER, MAX_NUMBER, aStep, "parametric_precision");
|
||||
initSpinBox(myVMaxSpinBox, -MAX_NUMBER, MAX_NUMBER, aStep, "parametric_precision");
|
||||
|
||||
myUMinSpinBox->setValue(0.);
|
||||
myUMaxSpinBox->setValue(1.);
|
||||
myVMinSpinBox->setValue(0.);
|
||||
myVMaxSpinBox->setValue(1.);
|
||||
|
||||
/* 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(mySelButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(myUMinSpinBox, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(myUMaxSpinBox, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(myVMinSpinBox, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
connect(myVMaxSpinBox, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||
|
||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
|
||||
|
||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
initName(tr("GEOM_EXTENSION_EDGE_NAME"));
|
||||
resize(100,100);
|
||||
|
||||
ConstructorsClicked(0);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetDoubleSpinBoxStep()
|
||||
// purpose : Double spin box management
|
||||
//=================================================================================
|
||||
void TransformationGUI_ExtensionDlg::SetDoubleSpinBoxStep(double step)
|
||||
{
|
||||
myUMinSpinBox->setSingleStep(step);
|
||||
myUMaxSpinBox->setSingleStep(step);
|
||||
myVMinSpinBox->setSingleStep(step);
|
||||
myVMaxSpinBox->setSingleStep(step);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void TransformationGUI_ExtensionDlg::ConstructorsClicked (int constructorId)
|
||||
{
|
||||
switch (constructorId) {
|
||||
case 0: // Extend edge
|
||||
{
|
||||
TColStd_MapOfInteger aMap;
|
||||
|
||||
aMap.Add(GEOM_EDGE);
|
||||
globalSelection(aMap);
|
||||
|
||||
myObjLbl->setText(tr("GEOM_EDGE"));
|
||||
myUMinLbl->setText(tr("GEOM_EXTENSION_MIN"));
|
||||
myUMaxLbl->setText(tr("GEOM_EXTENSION_MAX"));
|
||||
myVMinLbl->hide();
|
||||
myVMaxLbl->hide();
|
||||
myVMinSpinBox->hide();
|
||||
myVMaxSpinBox->hide();
|
||||
|
||||
initName(tr("GEOM_EXTENSION_EDGE_NAME"));
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // Extend face
|
||||
{
|
||||
TColStd_MapOfInteger aMap;
|
||||
|
||||
aMap.Add(GEOM_FACE);
|
||||
globalSelection(aMap);
|
||||
|
||||
myObjLbl->setText(tr("GEOM_FACE"));
|
||||
myUMinLbl->setText(tr("GEOM_EXTENSION_MIN_U"));
|
||||
myUMaxLbl->setText(tr("GEOM_EXTENSION_MAX_U"));
|
||||
myVMinLbl->show();
|
||||
myVMaxLbl->show();
|
||||
myVMinSpinBox->show();
|
||||
myVMaxSpinBox->show();
|
||||
|
||||
initName(tr("GEOM_EXTENSION_FACE_NAME"));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
myBase.nullify();
|
||||
qApp->processEvents();
|
||||
updateGeometry();
|
||||
resize(minimumSizeHint());
|
||||
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ExtensionDlg::ClickOnOk()
|
||||
{
|
||||
setIsApplyAndClose(true);
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_ExtensionDlg::ClickOnApply()
|
||||
{
|
||||
if (!onAccept())
|
||||
return false;
|
||||
|
||||
initName();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
//=================================================================================
|
||||
void TransformationGUI_ExtensionDlg::SelectionIntoArgument()
|
||||
{
|
||||
erasePreview();
|
||||
myEditCurrentArgument->setText("");
|
||||
|
||||
if (myEditCurrentArgument == myEditObjName) {
|
||||
const TopAbs_ShapeEnum aType =
|
||||
getConstructorId() == 0 ? TopAbs_EDGE: TopAbs_FACE;
|
||||
GEOM::GeomObjPtr aSelectedObject = getSelected(aType);
|
||||
|
||||
if (aSelectedObject) {
|
||||
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject.get()));
|
||||
myBase = aSelectedObject;
|
||||
} else {
|
||||
myBase.nullify();
|
||||
}
|
||||
}
|
||||
|
||||
processPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ExtensionDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
if (send == mySelButton) {
|
||||
myEditObjName->setFocus();
|
||||
myEditCurrentArgument = myEditObjName;
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ExtensionDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
ConstructorsClicked(getConstructorId());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ExtensionDlg::enterEvent(QEvent*)
|
||||
{
|
||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ValueChangedInSpinBox()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_ExtensionDlg::ValueChangedInSpinBox(double newValue)
|
||||
{
|
||||
processPreview();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : createOperation
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
GEOM::GEOM_IOperations_ptr TransformationGUI_ExtensionDlg::createOperation()
|
||||
{
|
||||
return getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_ExtensionDlg::isValid(QString& msg)
|
||||
{
|
||||
bool ok = (myUMinSpinBox->isValid(msg, !IsPreview()) &&
|
||||
myUMaxSpinBox->isValid(msg, !IsPreview()) &&
|
||||
myVMinSpinBox->isValid(msg, !IsPreview()) &&
|
||||
myVMaxSpinBox->isValid(msg, !IsPreview()) &&
|
||||
myBase);
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : execute
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool TransformationGUI_ExtensionDlg::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:
|
||||
anObj = anOper->ExtendEdge(myBase.get(), myUMinSpinBox->value(),
|
||||
myUMaxSpinBox->value());
|
||||
res = true;
|
||||
break;
|
||||
case 1:
|
||||
anObj = anOper->ExtendFace(myBase.get(), myUMinSpinBox->value(),
|
||||
myUMaxSpinBox->value(),
|
||||
myVMinSpinBox->value(),
|
||||
myVMaxSpinBox->value());
|
||||
res = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!anObj->_is_nil()) {
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
83
src/TransformationGUI/TransformationGUI_ExtensionDlg.h
Normal file
83
src/TransformationGUI/TransformationGUI_ExtensionDlg.h
Normal file
@ -0,0 +1,83 @@
|
||||
// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 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, or (at your option) any later version.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
// File : TransformationGUI_ExtensionDlg.h
|
||||
// Author : Sergey KHROMOV, Open CASCADE S.A.S.
|
||||
//
|
||||
#ifndef TRANSFORMATIONGUI_EXTENSIONDLG_H
|
||||
#define TRANSFORMATIONGUI_EXTENSIONDLG_H
|
||||
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
class DlgRef_3Sel4Spin2Check;
|
||||
|
||||
/**
|
||||
* This is a dialog for ExtendEdge and ExtendFace functionality
|
||||
*/
|
||||
class TransformationGUI_ExtensionDlg : public GEOMBase_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TransformationGUI_ExtensionDlg(GeometryGUI*, QWidget* = 0,
|
||||
bool = false, Qt::WindowFlags = 0);
|
||||
~TransformationGUI_ExtensionDlg();
|
||||
|
||||
protected:
|
||||
// redefined from GEOMBase_Helper
|
||||
virtual GEOM::GEOM_IOperations_ptr createOperation();
|
||||
virtual bool isValid( QString& );
|
||||
virtual bool execute( ObjectList& );
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent(QEvent *);
|
||||
|
||||
private:
|
||||
|
||||
QLabel *myObjLbl;
|
||||
QLabel *myUMinLbl;
|
||||
QLabel *myUMaxLbl;
|
||||
QLabel *myVMinLbl;
|
||||
QLabel *myVMaxLbl;
|
||||
QPushButton *mySelButton;
|
||||
QLineEdit *myEditObjName;
|
||||
SalomeApp_DoubleSpinBox *myUMinSpinBox;
|
||||
SalomeApp_DoubleSpinBox *myUMaxSpinBox;
|
||||
SalomeApp_DoubleSpinBox *myVMinSpinBox;
|
||||
SalomeApp_DoubleSpinBox *myVMaxSpinBox;
|
||||
GEOM::GeomObjPtr myBase;
|
||||
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ActivateThisDialog();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ValueChangedInSpinBox( double );
|
||||
void ConstructorsClicked( int );
|
||||
void SetDoubleSpinBoxStep( double );
|
||||
};
|
||||
|
||||
#endif // TRANSFORMATIONGUI_EXTENSIONDLG_H
|
Loading…
Reference in New Issue
Block a user