DCQ : New GEOM Architecture

This commit is contained in:
yfr 2003-10-03 09:50:25 +00:00
parent 66dbb45c38
commit 9f66a04c1c
157 changed files with 0 additions and 39535 deletions

View File

@ -1,128 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : BooleanGUI.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
using namespace std;
#include "BooleanGUI.h"
#include "QAD_Application.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include "GeometryGUI_FuseDlg.h" // Method FUSE
#include "GeometryGUI_CommonDlg.h" // Method COMMON
#include "GeometryGUI_CutDlg.h" // Method CUT
#include "GeometryGUI_SectionDlg.h" // Method SECTION
//=======================================================================
// function : BooleanGUI()
// purpose : Constructor
//=======================================================================
BooleanGUI::BooleanGUI() :
QObject()
{
myGeomGUI = GeometryGUI::GetGeometryGUI();
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
}
//=======================================================================
// function : ~BooleanGUI()
// purpose : Destructor
//=======================================================================
BooleanGUI::~BooleanGUI()
{
}
//=======================================================================
// function : OnGUIEvent()
// purpose :
//=======================================================================
bool BooleanGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
{
myGeomGUI->EmitSignalDeactivateDialog();
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
switch (theCommandID)
{
case 4011: // FUSE
{
GeometryGUI_FuseDlg *aDlg = new GeometryGUI_FuseDlg(parent, "", this, Sel);
break;
}
case 4012: // COMMON
{
GeometryGUI_CommonDlg *aDlg = new GeometryGUI_CommonDlg(parent, "", this, Sel);
break;
}
case 4013: // CUT
{
GeometryGUI_CutDlg *aDlg = new GeometryGUI_CutDlg(parent, "", this, Sel);
break;
}
case 4014: // SECTION
{
GeometryGUI_SectionDlg *aDlg = new GeometryGUI_SectionDlg(parent, "", this, Sel);
break;
}
default:
{
parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break;
}
}
return true;
}
//=======================================================================
// function : MakeBooleanAndDisplay()
// purpose :
//=======================================================================
void BooleanGUI::MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2, const short operation)
{
try {
GEOM::GEOM_Shape_ptr result = myGeom->MakeBoolean(Shape1, Shape2, operation);
if(result->_is_nil()) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
return;
}
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result);
Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type);
result->NameType(type);
if (myGeomGUI->Display(result, ""))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
}
catch (const SALOME::SALOME_Exception& S_ex) {
QtCatchCorbaException(S_ex);
}
return;
}

View File

@ -1,58 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : BooleanGUI.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef BOOLEANGUI_H
#define BOOLEANGUI_H
#include "GeometryGUI.h"
//=================================================================================
// class : BooleanGUI
// purpose :
//=================================================================================
class BooleanGUI : public QObject
{
Q_OBJECT /* for QT compatibility */
public :
BooleanGUI();
~BooleanGUI();
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1,
GEOM::GEOM_Shape_ptr Shape2,
const short operation);
private:
GeometryGUI* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
};
#endif

View File

@ -1,349 +0,0 @@
# This is a Qt message file in .po format. Each msgid starts with
# a scope. This scope should *NOT* be translated - eg. translating
# from French to English, "Foo::Bar" would be translated to "Pub",
# not "Foo::Pub".
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2001-06-14 09:11:49 PM CEST\n"
"PO-Revision-Date: 2003-09-22 16:39+0200\n"
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
#Select
msgid "ICON_SELECT"
msgstr "select1.png"
#: QAD_ObjectBrowser.cxx:140
msgid "ICON_OBJBROWSER_Geometry"
msgstr "geometry.png"
#: QAD_ObjectBrowser.cxx:140
msgid "ICON_OBJBROWSER_COMPOUND"
msgstr "tree_compound.png"
#: QAD_ObjectBrowser.cxx:140
msgid "ICON_OBJBROWSER_COMPSOLID"
msgstr "tree_compsolid.png"
#: QAD_ObjectBrowser.cxx:140
msgid "ICON_OBJBROWSER_EDGE"
msgstr "tree_edge.png"
#: QAD_ObjectBrowser.cxx:140
msgid "ICON_OBJBROWSER_FACE"
msgstr "tree_face.png"
#: QAD_ObjectBrowser.cxx:140
msgid "ICON_OBJBROWSER_SHAPE"
msgstr "tree_shape.png"
#: QAD_ObjectBrowser.cxx:140
msgid "ICON_OBJBROWSER_SHELL"
msgstr "tree_shell.png"
#: QAD_ObjectBrowser.cxx:140
msgid "ICON_OBJBROWSER_SOLID"
msgstr "tree_solid.png"
#: QAD_ObjectBrowser.cxx:140
msgid "ICON_OBJBROWSER_VERTEX"
msgstr "tree_vertex.png"
#: QAD_ObjectBrowser.cxx:140
msgid "ICON_OBJBROWSER_WIRE"
msgstr "tree_wire.png"
#BoxDlg
msgid "ICON_DLG_BOX_2P"
msgstr "box2points.png"
#BoxDlg
msgid "ICON_DLG_BOX_DXYZ"
msgstr "boxdxyz.png"
#CylinderDlg
msgid "ICON_DLG_CYLINDER_PV"
msgstr "cylinderpointvector.png"
#CylinderDlg
msgid "ICON_DLG_CYLINDER_DXYZ"
msgstr "cylinderdxyz.png"
#SphereDlg
msgid "ICON_DLG_SPHERE_P"
msgstr "spherepoint.png"
#SphereDlg
msgid "ICON_DLG_SPHERE_DXYZ"
msgstr "spheredxyz.png"
#torusDlg
msgid "ICON_DLG_TORUS_PV"
msgstr "toruspointvector.png"
#ConeDlg
msgid "ICON_DLG_CONE_PV"
msgstr "conepointvector.png"
#torusDlg
msgid "ICON_DLG_TORUS_DXYZ"
msgstr "torusdxyz.png"
#ConeDlg
msgid "ICON_DLG_CONE_DXYZ"
msgstr "conedxyz.png"
#LineDlg
msgid "ICON_DLG_LINE_2P"
msgstr "line2points.png"
#LineDlg
msgid "ICON_DLG_LINE_EDGE"
msgstr "lineedge.png"
#LineDlg
msgid "ICON_DLG_LINE_PV"
msgstr "linepointvector.png"
#CircleDlg
msgid "ICON_DLG_CIRCLE_PV"
msgstr "circlepointvector.png"
#VectorDlg
msgid "ICON_DLG_VECTOR_2P"
msgstr "vector2points.png"
#vectorDlg
msgid "ICON_DLG_VECTOR_DXYZ"
msgstr "vectordxyz.png"
#PlaneDlg
msgid "ICON_DLG_PLANE_DXYZ"
msgstr "planedxyz.png"
#PlaneDlg
msgid "ICON_DLG_PLANE_FACE"
msgstr "planeface.png"
#PlaneDlg
msgid "ICON_DLG_PLANE_PV"
msgstr "planepointvector.png"
#WorkingPlaneDlg
msgid "ICON_DLG_WPLANE_FACE"
msgstr "planeworkingface.png"
#PointDlg
msgid "ICON_DLG_POINT"
msgstr "point2.png"
#PoinDlg
msgid "ICON_DLG_POINT_EDGE"
msgstr "pointonedge.png"
#ArcDlg
msgid "ICON_DLG_ARC"
msgstr "arc.png"
#ArchimedeDlg
msgid "ICON_DLG_ARCHIMEDE"
msgstr "archimede.png"
#PartitionDlg
msgid "ICON_DLG_PARTITION"
msgstr "partition.png"
#PartitionDlg
msgid "ICON_DLG_PARTITION_KEEP_FACES"
msgstr "partitionkeep.png"
#CenterMassDlg
msgid "ICON_DLG_CENTERMASS"
msgstr "centergravity.png"
#BoundingBoxDlg
msgid "ICON_DLG_BOUNDING_BOX"
msgstr "bounding.png"
#CommonDlg
msgid "ICON_DLG_COMMON"
msgstr "common.png"
#CompoundDlg
msgid "ICON_DLG_BUILD_COMPOUND"
msgstr "build_compound.png"
#CutDlg
msgid "ICON_DLG_CUT"
msgstr "cut.png"
#EdgeDlg
msgid "ICON_DLG_BUILD_EDGE"
msgstr "build_edge.png"
#FaceDlg
msgid "ICON_DLG_BUILD_FACE"
msgstr "build_face.png"
#ShellDlg
msgid "ICON_DLG_BUILD_SHELL"
msgstr "build_shell.png"
#SolidDlg
msgid "ICON_DLG_BUILD_SOLID"
msgstr "build_solid.png"
#WireDlg
msgid "ICON_DLG_BUILD_WIRE"
msgstr "build_wire.png"
#FillingDlg
msgid "ICON_DLG_FILLING"
msgstr "filling.png"
#FuseDlg
msgid "ICON_DLG_FUSE"
msgstr "fuse.png"
#InertiaDlg
msgid "ICON_DLG_INERTIA"
msgstr "axisinertia.png"
#ToleranceDlg
msgid "ICON_DLG_TOLERANCE"
msgstr "tolerance.png"
#BasicPropertiesDlg
msgid "ICON_DLG_BASICPROPERTIES"
msgstr "basicproperties.png"
#WhatisDlg
msgid "ICON_DLG_WHATIS"
msgstr "whatis.png"
#MinDistDlg
msgid "ICON_DLG_MINDIST"
msgstr "mindist.png"
#MirrorDlg
msgid "ICON_DLG_MIRROR"
msgstr "mirrorPlane.png"
#TranslationDlg
msgid "ICON_DLG_TRANSLATION"
msgstr "translation.png"
#RotationDlg
msgid "ICON_DLG_ROTATION"
msgstr "rotate.png"
#ScaleDlg
msgid "ICON_DLG_SCALE"
msgstr "scale.png"
#OrientationDlg
msgid "ICON_DLG_ORIENTATION"
msgstr "orientation.png"
#SewingDlg
msgid "ICON_DLG_SEWING"
msgstr "sewing.png"
#PipeDlg
msgid "ICON_DLG_PIPE"
msgstr "pipe.png"
#PrismDlg
msgid "ICON_DLG_PRISM"
msgstr "prism.png"
#RevolutionDlg
msgid "ICON_DLG_REVOL"
msgstr "revol.png"
#SectionDlg
msgid "ICON_DLG_SECTION"
msgstr "section.png"
#SubShapeDlg
msgid "ICON_DLG_SUBSHAPE"
msgstr "subshape.png"
#FilletDlg
msgid "ICON_DLG_FILLET"
msgstr "fillet.png"
#ChamferDlg
msgid "ICON_DLG_CHAMFER"
msgstr "chamfer.png"
#FilletDlg
msgid "ICON_DLG_FILLET_ALL"
msgstr "filletall.png"
#ChamferDlg
msgid "ICON_DLG_CHAMFER_ALL"
msgstr "chamferall.png"
#FilletDlg
msgid "ICON_DLG_FILLET_EDGE"
msgstr "filletedge.png"
#ChamferDlg
msgid "ICON_DLG_CHAMFER_EDGE"
msgstr "chamferedge.png"
#FilletDlg
msgid "ICON_DLG_FILLET_FACE"
msgstr "filletface.png"
#ChamferDlg
msgid "ICON_DLG_CHAMFER_FACE"
msgstr "chamferface.png"
#ChamferDlg
msgid "ICON_DLG_CHECKSHAPE"
msgstr "check.png"
#SupressFaceDlg
msgid "ICON_DLG_SUPRESS_FACE"
msgstr "supressface.png"
#SupressHoleDlg
msgid "ICON_DLG_SUPRESS_HOLE"
msgstr "supresshole.png"
#SupressHoleDlg
msgid "ICON_DLG_SUPRESS_HOLE_FACE_SHELL"
msgstr "supressHolesOnFaceShell.png"
#MultiTranslationDlg
msgid "ICON_DLG_MULTITRANSLATION_SIMPLE"
msgstr "multitranslationsimple.png"
#MultiTranslationDlg
msgid "ICON_DLG_MULTITRANSLATION"
msgstr "multitranslation.png"
#MultiTranslationDlg
msgid "ICON_DLG_MULTITRANSLATION_DOUBLE"
msgstr "multitranslationdouble.png"
#MultiRotationDlg
msgid "ICON_DLG_MULTIROTATION_SIMPLE"
msgstr "multirotationsimple.png"
#MultiRotationDlg
msgid "ICON_DLG_MULTIROTATION"
msgstr "multirotation.png"
#MultiRotationDlg
msgid "ICON_DLG_MULTIROTATION_DOUBLE"
msgstr "multirotationdouble.png"
#EllipseDlg
msgid "ICON_DLG_ELLIPSE_PV"
msgstr "ellipsepointvector.png"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,54 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_1Sel1Spin.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#include "GeometryGUI_1Sel1Spin.h"
#include <qlayout.h>
#include <qspinbox.h>
#include <qgroupbox.h>
/*
* Constructs a GeometryGUI_1Sel1Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
GeometryGUI_1Sel1Spin::GeometryGUI_1Sel1Spin(QWidget* parent, const char* name, WFlags fl)
:GeometryGUI_1Sel1Spin_QTD(parent, name, fl)
{
SpinBox1->close(TRUE);
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout2->addWidget(SpinBox_DX, 0, 1);
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_1Sel1Spin::~GeometryGUI_1Sel1Spin()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,47 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_1Sel1Spin.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_1SEL1SPIN_H
#define GEOMETRYGUI_1SEL1SPIN_H
#include "GeometryGUI_1Sel1Spin_QTD.h"
#include "GeometryGUI_SpinBox.h"
class GeometryGUI_1Sel1Spin : public GeometryGUI_1Sel1Spin_QTD
{
Q_OBJECT
public:
GeometryGUI_1Sel1Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_1Sel1Spin();
GeometryGUI_SpinBox* SpinBox_DX;
};
#endif // GEOMETRYGUI_1SEL1SPIN_H

View File

@ -1,89 +0,0 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_1Sel1Spin_QTD.ui'
**
** Created: mar sep 23 16:05:08 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_1Sel1Spin_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_1Sel1Spin_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_1Sel1Spin_QTD::GeometryGUI_1Sel1Spin_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_1Sel1Spin_QTD" );
resize( 129, 87 );
setCaption( trUtf8( "GeometryGUI_1Sel1Spin_QTD" ) );
GeometryGUI_1Sel1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_1Sel1Spin_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
PushButton1->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton1, 0, 1 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
Layout1->addWidget( LineEdit1, 0, 2 );
Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2");
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
TextLabel2->setText( trUtf8( "TL2" ) );
Layout2->addWidget( TextLabel2, 0, 0 );
SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
Layout2->addWidget( SpinBox1, 0, 1 );
Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 );
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 2, 2 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_1Sel1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_1Sel1Spin_QTD::~GeometryGUI_1Sel1Spin_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,46 +0,0 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_1Sel1Spin_QTD.ui'
**
** Created: mar sep 23 16:05:08 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_1SEL1SPIN_QTD_H
#define GEOMETRYGUI_1SEL1SPIN_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QSpinBox;
class GeometryGUI_1Sel1Spin_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_1Sel1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_1Sel1Spin_QTD();
QGroupBox* GroupBox1;
QPushButton* PushButton1;
QLabel* TextLabel1;
QLineEdit* LineEdit1;
QLabel* TextLabel2;
QSpinBox* SpinBox1;
protected:
QGridLayout* GeometryGUI_1Sel1Spin_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
QGridLayout* Layout2;
};
#endif // GEOMETRYGUI_1SEL1SPIN_QTD_H

View File

@ -1,67 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_1Sel4Spin.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#include "GeometryGUI_1Sel4Spin.h"
#include <qlayout.h>
#include <qspinbox.h>
#include <qgroupbox.h>
/*
* Constructs a GeometryGUI_1Sel4Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
GeometryGUI_1Sel4Spin::GeometryGUI_1Sel4Spin(QWidget* parent, const char* name, WFlags fl)
:GeometryGUI_1Sel4Spin_QTD(parent, name, fl)
{
SpinBox1->close(TRUE);
SpinBox2->close(TRUE);
SpinBox3->close(TRUE);
SpinBox4->close(TRUE);
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout3->addWidget(SpinBox_DX, 0, 2);
SpinBox_DY = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DY");
Layout3->addWidget(SpinBox_DY, 0, 4);
SpinBox_DZ = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DZ");
Layout3->addWidget(SpinBox_DZ, 0, 6);
SpinBox_S = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_S");
Layout4->addWidget(SpinBox_S, 0, 1);
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_1Sel4Spin::~GeometryGUI_1Sel4Spin()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,51 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_1Sel4Spin.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_1SEL4SPIN_H
#define GEOMETRYGUI_1SEL4SPIN_H
#include "GeometryGUI_1Sel4Spin_QTD.h"
#include "GeometryGUI_SpinBox.h"
class GeometryGUI_1Sel4Spin : public GeometryGUI_1Sel4Spin_QTD
{
Q_OBJECT
public:
GeometryGUI_1Sel4Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_1Sel4Spin();
GeometryGUI_SpinBox* SpinBox_DX;
GeometryGUI_SpinBox* SpinBox_DY;
GeometryGUI_SpinBox* SpinBox_DZ;
GeometryGUI_SpinBox* SpinBox_S;
};
#endif // GEOMETRYGUI_1SEL4SPIN_H

View File

@ -1,132 +0,0 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_1Sel4Spin_QTD.ui'
**
** Created: mar sep 23 16:05:09 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_1Sel4Spin_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_1Sel4Spin_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_1Sel4Spin_QTD::GeometryGUI_1Sel4Spin_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_1Sel4Spin_QTD" );
resize( 284, 119 );
setCaption( trUtf8( "GeometryGUI_1Sel4Spin_QTD" ) );
GeometryGUI_1Sel4Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_1Sel4Spin_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3");
TextLabel5 = new QLabel( GroupBox1, "TextLabel5" );
TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) );
TextLabel5->setText( trUtf8( "TL5" ) );
Layout3->addWidget( TextLabel5, 0, 5 );
TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
TextLabel3->setText( trUtf8( "TL3" ) );
Layout3->addWidget( TextLabel3, 0, 1 );
TextLabel4 = new QLabel( GroupBox1, "TextLabel4" );
TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );
TextLabel4->setText( trUtf8( "TL4" ) );
Layout3->addWidget( TextLabel4, 0, 3 );
SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" );
SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) );
Layout3->addWidget( SpinBox3, 0, 6 );
SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
Layout3->addWidget( SpinBox1, 0, 2 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
TextLabel2->setText( trUtf8( "TL2" ) );
Layout3->addWidget( TextLabel2, 0, 0 );
SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
Layout3->addWidget( SpinBox2, 0, 4 );
Layout1->addLayout( Layout3, 1, 0 );
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 3, 0 );
Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4");
TextLabel6 = new QLabel( GroupBox1, "TextLabel6" );
TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) );
TextLabel6->setText( trUtf8( "TL6" ) );
Layout4->addWidget( TextLabel6, 0, 0 );
SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" );
Layout4->addWidget( SpinBox4, 0, 1 );
Layout1->addLayout( Layout4, 2, 0 );
Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2");
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout2->addWidget( TextLabel1 );
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
PushButton1->setText( trUtf8( "" ) );
Layout2->addWidget( PushButton1 );
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
Layout2->addWidget( LineEdit1 );
Layout1->addLayout( Layout2, 0, 0 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_1Sel4Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_1Sel4Spin_QTD::~GeometryGUI_1Sel4Spin_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,55 +0,0 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_1Sel4Spin_QTD.ui'
**
** Created: mar sep 23 16:05:09 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_1SEL4SPIN_QTD_H
#define GEOMETRYGUI_1SEL4SPIN_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QSpinBox;
class GeometryGUI_1Sel4Spin_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_1Sel4Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_1Sel4Spin_QTD();
QGroupBox* GroupBox1;
QLabel* TextLabel5;
QLabel* TextLabel3;
QLabel* TextLabel4;
QSpinBox* SpinBox3;
QSpinBox* SpinBox1;
QLabel* TextLabel2;
QSpinBox* SpinBox2;
QLabel* TextLabel6;
QSpinBox* SpinBox4;
QLabel* TextLabel1;
QPushButton* PushButton1;
QLineEdit* LineEdit1;
protected:
QGridLayout* GeometryGUI_1Sel4Spin_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
QGridLayout* Layout3;
QGridLayout* Layout4;
QHBoxLayout* Layout2;
};
#endif // GEOMETRYGUI_1SEL4SPIN_QTD_H

View File

@ -1,74 +0,0 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_1Sel_QTD.ui'
**
** Created: lun sep 22 17:38:06 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_1Sel_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_1Sel_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_1Sel_QTD::GeometryGUI_1Sel_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_1Sel_QTD" );
resize( 129, 57 );
setCaption( trUtf8( "GeometryGUI_1Sel_QTD" ) );
GeometryGUI_1Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_1Sel_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
PushButton1->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton1, 0, 1 );
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 1, 2 );
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
Layout1->addWidget( LineEdit1, 0, 2 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_1Sel_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_1Sel_QTD::~GeometryGUI_1Sel_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,42 +0,0 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_1Sel_QTD.ui'
**
** Created: lun sep 22 17:38:05 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_1SEL_QTD_H
#define GEOMETRYGUI_1SEL_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class GeometryGUI_1Sel_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_1Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_1Sel_QTD();
QGroupBox* GroupBox1;
QPushButton* PushButton1;
QLineEdit* LineEdit1;
QLabel* TextLabel1;
protected:
QGridLayout* GeometryGUI_1Sel_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
};
#endif // GEOMETRYGUI_1SEL_QTD_H

View File

@ -1,56 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_1Spin.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#include "GeometryGUI_1Spin.h"
#include <qlayout.h>
#include <qspinbox.h>
#include <qgroupbox.h>
/*
* Constructs a GeometryGUI_1Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
GeometryGUI_1Spin::GeometryGUI_1Spin(QWidget* parent, const char* name, WFlags fl)
:GeometryGUI_1Spin_QTD(parent, name, fl)
{
SpinBox1->close(TRUE);
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout1->addWidget(SpinBox_DX, 0, 1);
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_1Spin::~GeometryGUI_1Spin()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,47 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_1Spin.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_1SPIN_H
#define GEOMETRYGUI_1SPIN_H
#include "GeometryGUI_1Spin_QTD.h"
#include "GeometryGUI_SpinBox.h"
class GeometryGUI_1Spin : public GeometryGUI_1Spin_QTD
{
Q_OBJECT
public:
GeometryGUI_1Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
~GeometryGUI_1Spin();
GeometryGUI_SpinBox* SpinBox_DX;
};
#endif // GEOMETRYGUI_1SPIN_H

View File

@ -1,68 +0,0 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_1Spin_QTD.ui'
**
** Created: jeu sep 25 12:22:29 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_1Spin_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_1Spin_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_1Spin_QTD::GeometryGUI_1Spin_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_1Spin_QTD" );
resize( 124, 55 );
setCaption( trUtf8( "GeometryGUI_1Spin_QTD" ) );
GeometryGUI_1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_1Spin_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 3, 1 );
SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( SpinBox1, 0, 1 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_1Spin_QTD::~GeometryGUI_1Spin_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,40 +0,0 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_1Spin_QTD.ui'
**
** Created: jeu sep 25 12:22:29 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_1SPIN_QTD_H
#define GEOMETRYGUI_1SPIN_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QSpinBox;
class GeometryGUI_1Spin_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_1Spin_QTD();
QGroupBox* GroupBox1;
QSpinBox* SpinBox1;
QLabel* TextLabel1;
protected:
QGridLayout* GeometryGUI_1Spin_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
};
#endif // GEOMETRYGUI_1SPIN_QTD_H

View File

@ -1,54 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_2Sel1Spin.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#include "GeometryGUI_2Sel1Spin.h"
#include <qlayout.h>
#include <qspinbox.h>
#include <qgroupbox.h>
/*
* Constructs a GeometryGUI_2Sel1Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
GeometryGUI_2Sel1Spin::GeometryGUI_2Sel1Spin(QWidget* parent, const char* name, WFlags fl)
:GeometryGUI_2Sel1Spin_QTD(parent, name, fl)
{
SpinBox1->close(TRUE);
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout2->addWidget(SpinBox_DX, 0, 1);
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Sel1Spin::~GeometryGUI_2Sel1Spin()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,47 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_2Sel1Spin.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_2SEL1SPIN_H
#define GEOMETRYGUI_2SEL1SPIN_H
#include "GeometryGUI_2Sel1Spin_QTD.h"
#include "GeometryGUI_SpinBox.h"
class GeometryGUI_2Sel1Spin : public GeometryGUI_2Sel1Spin_QTD
{
Q_OBJECT
public:
GeometryGUI_2Sel1Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_2Sel1Spin();
GeometryGUI_SpinBox* SpinBox_DX;
};
#endif // GEOMETRYGUI_2SEL1SPIN_H

View File

@ -1,105 +0,0 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_2Sel1Spin_QTD.ui'
**
** Created: mar sep 23 16:05:09 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_2Sel1Spin_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_2Sel1Spin_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_2Sel1Spin_QTD::GeometryGUI_2Sel1Spin_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_2Sel1Spin_QTD" );
resize( 129, 117 );
setCaption( trUtf8( "GeometryGUI_2Sel1Spin_QTD" ) );
GeometryGUI_2Sel1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Sel1Spin_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
Layout1->addWidget( LineEdit1, 0, 2 );
PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) );
PushButton2->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton2, 1, 1 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
Layout1->addWidget( LineEdit2, 1, 2 );
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
PushButton1->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton1, 0, 1 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
TextLabel2->setText( trUtf8( "TL2" ) );
Layout1->addWidget( TextLabel2, 1, 0 );
Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2");
SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
Layout2->addWidget( SpinBox1, 0, 1 );
TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
TextLabel3->setText( trUtf8( "TL3" ) );
Layout2->addWidget( TextLabel3, 0, 0 );
Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 );
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 3, 2 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_2Sel1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Sel1Spin_QTD::~GeometryGUI_2Sel1Spin_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,49 +0,0 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_2Sel1Spin_QTD.ui'
**
** Created: mar sep 23 16:05:09 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_2SEL1SPIN_QTD_H
#define GEOMETRYGUI_2SEL1SPIN_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QSpinBox;
class GeometryGUI_2Sel1Spin_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_2Sel1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_2Sel1Spin_QTD();
QGroupBox* GroupBox1;
QLineEdit* LineEdit1;
QPushButton* PushButton2;
QLabel* TextLabel1;
QLineEdit* LineEdit2;
QPushButton* PushButton1;
QLabel* TextLabel2;
QSpinBox* SpinBox1;
QLabel* TextLabel3;
protected:
QGridLayout* GeometryGUI_2Sel1Spin_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
QGridLayout* Layout2;
};
#endif // GEOMETRYGUI_2SEL1SPIN_QTD_H

View File

@ -1,57 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_2Sel2Spin.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#include "GeometryGUI_2Sel2Spin.h"
#include <qlayout.h>
#include <qspinbox.h>
#include <qgroupbox.h>
/*
* Constructs a GeometryGUI_2Sel1Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
GeometryGUI_2Sel2Spin::GeometryGUI_2Sel2Spin(QWidget* parent, const char* name, WFlags fl)
:GeometryGUI_2Sel2Spin_QTD(parent, name, fl)
{
SpinBox1->close(TRUE);
SpinBox2->close(TRUE);
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout2->addWidget(SpinBox_DX, 0, 1);
SpinBox_DY = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DY");
Layout2->addWidget(SpinBox_DY, 1, 1);
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Sel2Spin::~GeometryGUI_2Sel2Spin()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,48 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_2Sel2Spin.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_2SEL2SPIN_H
#define GEOMETRYGUI_2SEL2SPIN_H
#include "GeometryGUI_2Sel2Spin_QTD.h"
#include "GeometryGUI_SpinBox.h"
class GeometryGUI_2Sel2Spin : public GeometryGUI_2Sel2Spin_QTD
{
Q_OBJECT
public:
GeometryGUI_2Sel2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
~GeometryGUI_2Sel2Spin();
GeometryGUI_SpinBox* SpinBox_DX;
GeometryGUI_SpinBox* SpinBox_DY;
};
#endif // GEOMETRYGUI_2SEL2SPIN_H

View File

@ -1,116 +0,0 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_2Sel2Spin_QTD.ui'
**
** Created: jeu sep 25 12:10:29 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_2Sel2Spin_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_2Sel2Spin_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_2Sel2Spin_QTD::GeometryGUI_2Sel2Spin_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_2Sel2Spin_QTD" );
resize( 129, 145 );
setCaption( trUtf8( "GeometryGUI_2Sel2Spin_QTD" ) );
GeometryGUI_2Sel2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Sel2Spin_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
Layout1->addWidget( LineEdit1, 0, 2 );
Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2");
SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
Layout2->addWidget( SpinBox2, 1, 1 );
TextLabel4 = new QLabel( GroupBox1, "TextLabel4" );
TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );
TextLabel4->setText( trUtf8( "TL4" ) );
Layout2->addWidget( TextLabel4, 1, 0 );
TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
TextLabel3->setText( trUtf8( "TL3" ) );
Layout2->addWidget( TextLabel3, 0, 0 );
SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
Layout2->addWidget( SpinBox1, 0, 1 );
Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 );
PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) );
PushButton2->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton2, 1, 1 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
TextLabel2->setText( trUtf8( "TL2" ) );
Layout1->addWidget( TextLabel2, 1, 0 );
QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 3, 2 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
PushButton1->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton1, 0, 1 );
LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
Layout1->addWidget( LineEdit2, 1, 2 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_2Sel2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Sel2Spin_QTD::~GeometryGUI_2Sel2Spin_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,51 +0,0 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_2Sel2Spin_QTD.ui'
**
** Created: jeu sep 25 12:10:29 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_2SEL2SPIN_QTD_H
#define GEOMETRYGUI_2SEL2SPIN_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QSpinBox;
class GeometryGUI_2Sel2Spin_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_2Sel2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_2Sel2Spin_QTD();
QGroupBox* GroupBox1;
QLineEdit* LineEdit1;
QSpinBox* SpinBox2;
QLabel* TextLabel4;
QLabel* TextLabel3;
QSpinBox* SpinBox1;
QPushButton* PushButton2;
QLabel* TextLabel2;
QLabel* TextLabel1;
QPushButton* PushButton1;
QLineEdit* LineEdit2;
protected:
QGridLayout* GeometryGUI_2Sel2Spin_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
QGridLayout* Layout2;
};
#endif // GEOMETRYGUI_2SEL2SPIN_QTD_H

View File

@ -1,60 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_2Sel3Spin.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#include "GeometryGUI_2Sel3Spin.h"
#include <qlayout.h>
#include <qspinbox.h>
#include <qgroupbox.h>
/*
* Constructs a GeometryGUI_2Sel1Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
GeometryGUI_2Sel3Spin::GeometryGUI_2Sel3Spin(QWidget* parent, const char* name, WFlags fl)
:GeometryGUI_2Sel3Spin_QTD(parent, name, fl)
{
SpinBox1->close(TRUE);
SpinBox2->close(TRUE);
SpinBox3->close(TRUE);
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout2->addWidget(SpinBox_DX, 0, 1);
SpinBox_DY = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DY");
Layout2->addWidget(SpinBox_DY, 1, 1);
SpinBox_DZ = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DZ");
Layout2->addWidget(SpinBox_DZ, 2, 1);
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Sel3Spin::~GeometryGUI_2Sel3Spin()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,49 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_2Sel3Spin.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_2SEL3SPIN_H
#define GEOMETRYGUI_2SEL3SPIN_H
#include "GeometryGUI_2Sel3Spin_QTD.h"
#include "GeometryGUI_SpinBox.h"
class GeometryGUI_2Sel3Spin : public GeometryGUI_2Sel3Spin_QTD
{
Q_OBJECT
public:
GeometryGUI_2Sel3Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
~GeometryGUI_2Sel3Spin();
GeometryGUI_SpinBox* SpinBox_DX;
GeometryGUI_SpinBox* SpinBox_DY;
GeometryGUI_SpinBox* SpinBox_DZ;
};
#endif // GEOMETRYGUI_2SEL3SPIN_H

View File

@ -1,127 +0,0 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_2Sel3Spin_QTD.ui'
**
** Created: jeu sep 25 16:18:43 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_2Sel3Spin_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_2Sel3Spin_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_2Sel3Spin_QTD::GeometryGUI_2Sel3Spin_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_2Sel3Spin_QTD" );
resize( 129, 173 );
setCaption( trUtf8( "GeometryGUI_2Sel3Spin_QTD" ) );
GeometryGUI_2Sel3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Sel3Spin_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
Layout1->addWidget( LineEdit1, 0, 2 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
TextLabel2->setText( trUtf8( "TL2" ) );
Layout1->addWidget( TextLabel2, 1, 0 );
Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2");
TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
TextLabel3->setText( trUtf8( "TL3" ) );
Layout2->addWidget( TextLabel3, 0, 0 );
SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
Layout2->addWidget( SpinBox2, 1, 1 );
TextLabel4 = new QLabel( GroupBox1, "TextLabel4" );
TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) );
TextLabel4->setText( trUtf8( "TL4" ) );
Layout2->addWidget( TextLabel4, 1, 0 );
TextLabel5 = new QLabel( GroupBox1, "TextLabel5" );
TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) );
TextLabel5->setText( trUtf8( "TL4" ) );
Layout2->addWidget( TextLabel5, 2, 0 );
SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
Layout2->addWidget( SpinBox1, 0, 1 );
SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" );
SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) );
Layout2->addWidget( SpinBox3, 2, 1 );
Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 );
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
PushButton1->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton1, 0, 1 );
QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 3, 2 );
LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
Layout1->addWidget( LineEdit2, 1, 2 );
PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) );
PushButton2->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton2, 1, 1 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_2Sel3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Sel3Spin_QTD::~GeometryGUI_2Sel3Spin_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,53 +0,0 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_2Sel3Spin_QTD.ui'
**
** Created: jeu sep 25 16:18:43 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_2SEL3SPIN_QTD_H
#define GEOMETRYGUI_2SEL3SPIN_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QSpinBox;
class GeometryGUI_2Sel3Spin_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_2Sel3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_2Sel3Spin_QTD();
QGroupBox* GroupBox1;
QLineEdit* LineEdit1;
QLabel* TextLabel1;
QLabel* TextLabel2;
QLabel* TextLabel3;
QSpinBox* SpinBox2;
QLabel* TextLabel4;
QLabel* TextLabel5;
QSpinBox* SpinBox1;
QSpinBox* SpinBox3;
QPushButton* PushButton1;
QLineEdit* LineEdit2;
QPushButton* PushButton2;
protected:
QGridLayout* GeometryGUI_2Sel3Spin_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
QGridLayout* Layout2;
};
#endif // GEOMETRYGUI_2SEL3SPIN_QTD_H

View File

@ -1,90 +0,0 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_2Sel_QTD.ui'
**
** Created: mar sep 23 16:05:09 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_2Sel_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_2Sel_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_2Sel_QTD::GeometryGUI_2Sel_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_2Sel_QTD" );
resize( 129, 87 );
setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) );
setCaption( trUtf8( "GeometryGUI_2Sel_QTD" ) );
GeometryGUI_2Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Sel_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
PushButton1->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton1, 0, 1 );
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 2, 2 );
LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" );
Layout1->addWidget( LineEdit2, 1, 2 );
PushButton2 = new QPushButton( GroupBox1, "PushButton2" );
PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) );
PushButton2->setText( trUtf8( "" ) );
Layout1->addWidget( PushButton2, 1, 1 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
TextLabel2->setText( trUtf8( "TL2" ) );
Layout1->addWidget( TextLabel2, 1, 0 );
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
Layout1->addWidget( LineEdit1, 0, 2 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_2Sel_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Sel_QTD::~GeometryGUI_2Sel_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,45 +0,0 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_2Sel_QTD.ui'
**
** Created: mar sep 23 16:05:09 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_2SEL_QTD_H
#define GEOMETRYGUI_2SEL_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class GeometryGUI_2Sel_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_2Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_2Sel_QTD();
QGroupBox* GroupBox1;
QPushButton* PushButton1;
QLineEdit* LineEdit2;
QPushButton* PushButton2;
QLabel* TextLabel1;
QLabel* TextLabel2;
QLineEdit* LineEdit1;
protected:
QGridLayout* GeometryGUI_2Sel_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
};
#endif // GEOMETRYGUI_2SEL_QTD_H

View File

@ -1,60 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_2Spin.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#include "GeometryGUI_2Spin.h"
#include <qlayout.h>
#include <qspinbox.h>
#include <qgroupbox.h>
/*
* Constructs a GeometryGUI_2Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
GeometryGUI_2Spin::GeometryGUI_2Spin(QWidget* parent, const char* name, WFlags fl)
:GeometryGUI_2Spin_QTD(parent, name, fl)
{
SpinBox1->close(TRUE);
SpinBox2->close(TRUE);
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout1->addWidget(SpinBox_DX, 0, 1);
SpinBox_DY = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DY");
Layout1->addWidget(SpinBox_DY, 1, 1);
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Spin::~GeometryGUI_2Spin()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,48 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_2Spin.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_2SPIN_H
#define GEOMETRYGUI_2SPIN_H
#include "GeometryGUI_2Spin_QTD.h"
#include "GeometryGUI_SpinBox.h"
class GeometryGUI_2Spin : public GeometryGUI_2Spin_QTD
{
Q_OBJECT
public:
GeometryGUI_2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
~GeometryGUI_2Spin();
GeometryGUI_SpinBox* SpinBox_DX;
GeometryGUI_SpinBox* SpinBox_DY;
};
#endif // GEOMETRYGUI_2SPIN_H

View File

@ -1,79 +0,0 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_2Spin_QTD.ui'
**
** Created: jeu sep 25 12:10:30 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_2Spin_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_2Spin_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_2Spin_QTD::GeometryGUI_2Spin_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_2Spin_QTD" );
resize( 124, 83 );
setCaption( trUtf8( "GeometryGUI_2Spin_QTD" ) );
GeometryGUI_2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Spin_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( SpinBox2, 1, 1 );
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 3, 1 );
SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( SpinBox1, 0, 1 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
TextLabel2->setText( trUtf8( "TL2" ) );
Layout1->addWidget( TextLabel2, 1, 0 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_2Spin_QTD::~GeometryGUI_2Spin_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,42 +0,0 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_2Spin_QTD.ui'
**
** Created: jeu sep 25 12:10:30 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_2SPIN_QTD_H
#define GEOMETRYGUI_2SPIN_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QSpinBox;
class GeometryGUI_2Spin_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_2Spin_QTD();
QGroupBox* GroupBox1;
QSpinBox* SpinBox2;
QSpinBox* SpinBox1;
QLabel* TextLabel1;
QLabel* TextLabel2;
protected:
QGridLayout* GeometryGUI_2Spin_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
};
#endif // GEOMETRYGUI_2SPIN_QTD_H

View File

@ -1,63 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_3Spin.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#include "GeometryGUI_3Spin.h"
#include <qlayout.h>
#include <qspinbox.h>
#include <qgroupbox.h>
/*
* Constructs a GeometryGUI_3Spin which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
GeometryGUI_3Spin::GeometryGUI_3Spin(QWidget* parent, const char* name, WFlags fl)
:GeometryGUI_3Spin_QTD(parent, name, fl)
{
SpinBox1->close(TRUE);
SpinBox2->close(TRUE);
SpinBox3->close(TRUE);
SpinBox_DX = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DX");
Layout1->addWidget(SpinBox_DX, 0, 1);
SpinBox_DY = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DY");
Layout1->addWidget(SpinBox_DY, 1, 1);
SpinBox_DZ = new GeometryGUI_SpinBox(GroupBox1, "SpinBox_DZ");
Layout1->addWidget(SpinBox_DZ, 2, 1);
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_3Spin::~GeometryGUI_3Spin()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,49 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_3Spin.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_3SPIN_H
#define GEOMETRYGUI_3SPIN_H
#include "GeometryGUI_3Spin_QTD.h"
#include "GeometryGUI_SpinBox.h"
class GeometryGUI_3Spin : public GeometryGUI_3Spin_QTD
{
Q_OBJECT
public:
GeometryGUI_3Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_3Spin();
GeometryGUI_SpinBox* SpinBox_DX;
GeometryGUI_SpinBox* SpinBox_DY;
GeometryGUI_SpinBox* SpinBox_DZ;
};
#endif // GEOMETRYGUI_3SPIN_H

View File

@ -1,90 +0,0 @@
/****************************************************************************
** Form implementation generated from reading ui file 'GeometryGUI_3Spin_QTD.ui'
**
** Created: mar sep 23 16:05:10 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "GeometryGUI_3Spin_QTD.h"
#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a GeometryGUI_3Spin_QTD which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
GeometryGUI_3Spin_QTD::GeometryGUI_3Spin_QTD( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "GeometryGUI_3Spin_QTD" );
resize( 124, 111 );
setCaption( trUtf8( "GeometryGUI_3Spin_QTD" ) );
GeometryGUI_3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_3Spin_QTDLayout");
GroupBox1 = new QGroupBox( this, "GroupBox1" );
GroupBox1->setTitle( trUtf8( "" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 6 );
GroupBox1->layout()->setMargin( 11 );
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" );
SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( SpinBox2, 1, 1 );
QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding );
Layout1->addItem( spacer, 3, 1 );
TextLabel3 = new QLabel( GroupBox1, "TextLabel3" );
TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) );
TextLabel3->setText( trUtf8( "TL3" ) );
Layout1->addWidget( TextLabel3, 2, 0 );
SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" );
SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( SpinBox1, 0, 1 );
SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" );
SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) );
Layout1->addWidget( SpinBox3, 2, 1 );
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
TextLabel1->setText( trUtf8( "TL1" ) );
Layout1->addWidget( TextLabel1, 0, 0 );
TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) );
TextLabel2->setText( trUtf8( "TL2" ) );
Layout1->addWidget( TextLabel2, 1, 0 );
GroupBox1Layout->addLayout( Layout1, 0, 0 );
GeometryGUI_3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 );
}
/*
* Destroys the object and frees any allocated resources
*/
GeometryGUI_3Spin_QTD::~GeometryGUI_3Spin_QTD()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,44 +0,0 @@
/****************************************************************************
** Form interface generated from reading ui file 'GeometryGUI_3Spin_QTD.ui'
**
** Created: mar sep 23 16:05:09 2003
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef GEOMETRYGUI_3SPIN_QTD_H
#define GEOMETRYGUI_3SPIN_QTD_H
#include <qvariant.h>
#include <qwidget.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QGroupBox;
class QLabel;
class QSpinBox;
class GeometryGUI_3Spin_QTD : public QWidget
{
Q_OBJECT
public:
GeometryGUI_3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~GeometryGUI_3Spin_QTD();
QGroupBox* GroupBox1;
QSpinBox* SpinBox2;
QLabel* TextLabel3;
QSpinBox* SpinBox1;
QSpinBox* SpinBox3;
QLabel* TextLabel1;
QLabel* TextLabel2;
protected:
QGridLayout* GeometryGUI_3Spin_QTDLayout;
QGridLayout* GroupBox1Layout;
QGridLayout* Layout1;
};
#endif // GEOMETRYGUI_3SPIN_QTD_H

View File

@ -1,507 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_ArcDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_ArcDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Tools.h"
#include "utilities.h"
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_ArcDlg()
// purpose : Constructs a GeometryGUI_ArcDlg 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.
//=================================================================================
GeometryGUI_ArcDlg::GeometryGUI_ArcDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_ARC")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_ArcDlg" );
resize( 303, 251 );
setCaption( tr( "GEOM_ARC_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_ArcDlgLayout = new QGridLayout( this );
GeometryGUI_ArcDlgLayout->setSpacing( 6 );
GeometryGUI_ArcDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_ARC" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_ArcDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_POINTS" ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_POINT_I" ).arg( "1" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_POINT_I" ).arg( "2" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
SelectButtonC1A2->setText( tr( "" ) );
SelectButtonC1A2->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
TextLabelC1A3->setText( tr( "GEOM_POINT_I" ).arg( "3" ) );
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
SelectButtonC1A3 = new QPushButton( GroupC1, "SelectButtonC1A3" );
SelectButtonC1A3->setText( tr( "" ) );
SelectButtonC1A3->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A3, 2, 1 );
LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" );
GroupC1Layout->addWidget( LineEditC1A3, 2, 2 );
GeometryGUI_ArcDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_ArcDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
/* Move widget on the botton right corner of main widget */
QAD_Tools::alignWidget(this, parent, AlignBottom | AlignRight);
/* Display Dialog */
this->show() ;
}
//=================================================================================
// function : ~GeometryGUI_ArcDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_ArcDlg::~GeometryGUI_ArcDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_ArcDlg::Init( SALOME_Selection* Sel )
{
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myOkPoint1 = myOkPoint2 = myOkPoint3 = false ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
mySelection->AddFilter(myVertexFilter) ;
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A3, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_ArcDlg::ConstructorsClicked(int constructorId)
{
/* only a constructor now */
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_ArcDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_ArcDlg::ClickOnApply()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
{
case 0 :
{
if(myOkPoint1 && myOkPoint2 && myOkPoint3 ) {
myGeomGUI->MakeArcAndDisplay( myPoint1, myPoint2, myPoint3 ) ;
}
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_ArcDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_ArcDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("") ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
QString aString = ""; /* name of future selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
if ( myEditCurrentArgument == LineEditC1A1 ) {
myEditCurrentArgument->setText("") ;
myOkPoint1 = false ;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
myEditCurrentArgument->setText("") ;
myOkPoint2 = false ;
}
else if ( myEditCurrentArgument == LineEditC1A3 ) {
myEditCurrentArgument->setText("") ;
myOkPoint3 = false ;
}
return ;
}
// nbSel == 1 !
TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint( S, this->myPoint1 ) ) {
myEditCurrentArgument->setText(aString) ;
myOkPoint1 = true ;
}
else if ( myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint( S, this->myPoint2 ) ) {
myEditCurrentArgument->setText(aString) ;
myOkPoint2 = true ;
}
else if ( myEditCurrentArgument == LineEditC1A3 && myGeomGUI->VertexToPoint( S, this->myPoint3 ) ) {
myEditCurrentArgument->setText(aString) ;
myOkPoint3 = true ;
}
/* Simulation */
if( myOkPoint1 && myOkPoint2 && myOkPoint3 ) {
this->MakeArcSimulationAndDisplay() ;
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_ArcDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
mySelection->AddFilter(myVertexFilter) ;
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
}
else if(send == SelectButtonC1A2) {
LineEditC1A2->setFocus() ;
myEditCurrentArgument = LineEditC1A2;
}
else if(send == SelectButtonC1A3) {
LineEditC1A3->setFocus() ;
myEditCurrentArgument = LineEditC1A3;
}
SelectionIntoArgument() ;
break;
}
}
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_ArcDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else if ( send == LineEditC1A2 )
myEditCurrentArgument = LineEditC1A2 ;
else if ( send == LineEditC1A3 )
myEditCurrentArgument = LineEditC1A3 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_ArcDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
mySelection->ClearFilters() ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_ArcDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_ArcDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_ArcDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : MakeArcSimulationAndDisplay()
// purpose :
//=================================================================================
void GeometryGUI_ArcDlg::MakeArcSimulationAndDisplay()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
try {
if ( myPoint2.IsEqual( myPoint1, Precision::Confusion() ) ) {
myEditCurrentArgument->setText("") ;
return;
}
if ( myPoint2.IsEqual( myPoint3, Precision::Confusion() ) ) {
myEditCurrentArgument->setText("") ;
return;
}
gp_Vec v1( this->myPoint2, this->myPoint1 ) ;
gp_Vec v2( this->myPoint2, this->myPoint3 ) ;
if( v1.IsParallel(v2, Precision::Angular() ) ) {
myEditCurrentArgument->setText("") ;
return ;
}
GC_MakeArcOfCircle Arc( this->myPoint1, this->myPoint2, this->myPoint3 );
if ( Arc.IsDone() ) {
Handle(Geom_TrimmedCurve) curve = Arc.Value() ;
mySimulationTopoDs = BRepBuilderAPI_MakeEdge(curve).Shape() ;
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ;
}
}
catch(Standard_Failure) {
MESSAGE( "Exception catched in MakeArcSimulationAndDisplay" ) ;
}
return ;
}

View File

@ -1,125 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_ArcDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_ARC_H
#define DIALOGBOX_ARC_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Pnt.hxx>
#include <Precision.hxx>
#include <GC_MakeArcOfCircle.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_ArcDlg
// purpose :
//=================================================================================
class GeometryGUI_ArcDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_ArcDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_ArcDlg();
private :
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
gp_Pnt myPoint1 ;
gp_Pnt myPoint2 ;
gp_Pnt myPoint3;
bool myOkPoint1 ;
bool myOkPoint2;
bool myOkPoint3;
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
int myConstructorId ; /* Current constructor id = radio button id */
Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */
void closeEvent( QCloseEvent* e ) ;
void enterEvent( QEvent* e);
void Init( SALOME_Selection* Sel ) ;
void MakeArcSimulationAndDisplay() ;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QGroupBox* GroupC1;
QLineEdit* LineEditC1A1;
QPushButton* SelectButtonC1A1;
QLabel* TextLabelC1A1;
QLabel* TextLabelC1A2;
QPushButton* SelectButtonC1A2;
QLineEdit* LineEditC1A2;
QLabel* TextLabelC1A3;
QPushButton* SelectButtonC1A3;
QLineEdit* LineEditC1A3;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void LineEditReturnPressed() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_ArcDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
};
#endif // DIALOGBOX_ARC_H

View File

@ -1,470 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_ArchimedeDlg.cxx
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_ArchimedeDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Tools.h"
#include "utilities.h"
#include "SALOME_InteractiveObject.hxx"
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qvalidator.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_ArchimedeDlg()
// purpose : Constructs a GeometryGUI_ArchimedeDlg 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.
//=================================================================================
GeometryGUI_ArchimedeDlg::GeometryGUI_ArchimedeDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_ARCHIMEDE")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_ArchimedeDlg" );
resize( 303, 219 );
setCaption( tr( "GEOM_ARCHIMEDE_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_ArchimedeDlgLayout = new QGridLayout( this );
GeometryGUI_ArchimedeDlgLayout->setSpacing( 6 );
GeometryGUI_ArchimedeDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_ARCHIMEDE" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_ArchimedeDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_1, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_ArchimedeDlgLayout->addWidget( GroupButtons, 2, 0 );
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) );
LineEditC1A2->setMinimumSize( QSize( 40, 0 ) );
LineEditC1A2->setMaximumSize( QSize( 32767, 32767 ) );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" );
LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) );
LineEditC1A3->setMinimumSize( QSize( 40, 0 ) );
LineEditC1A3->setMaximumSize( QSize( 32767, 32767 ) );
GroupC1Layout->addWidget( LineEditC1A3, 2, 2 );
LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" );
LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) );
LineEditC1A4->setMinimumSize( QSize( 40, 0 ) );
LineEditC1A4->setMaximumSize( QSize( 32767, 32767 ) );
GroupC1Layout->addWidget( LineEditC1A4, 3, 2 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_WEIGHT" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
TextLabelC1A2->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
TextLabelC1A3->setText( tr( "GEOM_WATER_DENSITY" ) );
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A3->setFrameShape( QLabel::NoFrame );
TextLabelC1A3->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
TextLabelC1A4->setText( tr( "GEOM_MESHING_DEFLECTION" ) );
TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A4->setFrameShape( QLabel::NoFrame );
TextLabelC1A4->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 );
GeometryGUI_ArchimedeDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
/* Move widget on the botton right corner of main widget */
QAD_Tools::alignWidget(this, parent, AlignBottom | AlignRight);
/* Display Dialog */
this->show() ;
}
//=================================================================================
// function : ~GeometryGUI_ArchimedeDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_ArchimedeDlg::~GeometryGUI_ArchimedeDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_ArchimedeDlg::Init( SALOME_Selection* Sel )
{
LineEditC1A2->setMaxLength( 10 );
LineEditC1A3->setMaxLength( 10 );
LineEditC1A4->setMaxLength( 10 );
this->myVa = new QDoubleValidator( 0, +999999.999, 3, LineEditC1A2 ) ;
this->myVb = new QDoubleValidator( 0, +999999.999, 3, LineEditC1A3 ) ;
this->myVc = new QDoubleValidator( 0, +999999.999, 3, LineEditC1A4 ) ;
LineEditC1A2->setValidator( myVa ) ;
LineEditC1A3->setValidator( myVb ) ;
LineEditC1A4->setValidator( myVc ) ;
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
this->myWeight = 100.0 ;
LineEditC1A2->setText("100.0") ;
this->myWaterDensity = 1.0 ;
LineEditC1A3->setText("1.0") ;
this->myMeshingDeflection = 0.01 ;
LineEditC1A4->setText("0.01") ;
myOkWeight = myOkWaterDensity = myOkMeshingDeflection = true ;
myOkIO = false ;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A2, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ;
connect( LineEditC1A3, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ;
connect( LineEditC1A4, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_ArchimedeDlg::ConstructorsClicked(int constructorId)
{
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_ArchimedeDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_ArchimedeDlg::ClickOnApply()
{
switch(myConstructorId)
{
case 0 :
{
if(myOkIO && myOkWeight && myOkWaterDensity && myOkMeshingDeflection ) {
myGeomGUI->Archimede( myIO, myWeight, myWaterDensity, myMeshingDeflection );
}
}
break ;
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_ArchimedeDlg::ClickOnCancel()
{
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_ArchimedeDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("") ;
QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
myEditCurrentArgument->setText("") ;
myOkIO = false ;
}
else {
myEditCurrentArgument->setText(aString) ;
myIO = mySelection->firstIObject();
myOkIO = true ;
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_ArchimedeDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : TextChangedInLineEdit()
// purpose :
//=================================================================================
void GeometryGUI_ArchimedeDlg::TextChangedInLineEdit(const QString& newText)
{
QLineEdit* send = (QLineEdit*)sender();
QString newT = strdup(newText) ;
int i ;
if(send == LineEditC1A2) {
if( myVa->validate(newT, i) == myVa->Acceptable ) {
this->myWeight = newText.toFloat() ;
myOkWeight = true ;
}
else {
myOkWeight = false ;
}
}
else if(send == LineEditC1A3) {
if( myVb->validate(newT, i) == myVb->Acceptable ) {
this->myWaterDensity = newText.toFloat() ;
myOkWaterDensity = true ;
}
else {
myOkWaterDensity = false ;
}
}
else if(send == LineEditC1A4) {
if( myVc->validate(newT, i) == myVc->Acceptable ) {
this->myMeshingDeflection = newText.toFloat() ;
myOkMeshingDeflection = true ;
}
else {
myOkMeshingDeflection = false ;
}
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_ArchimedeDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_ArchimedeDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_ArchimedeDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_ArchimedeDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}

View File

@ -1,127 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_ArchimedeDlg.h
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_ARCHIMEDE_H
#define DIALOGBOX_ARCHIMEDE_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_ArchimedeDlg
// purpose :
//=================================================================================
class GeometryGUI_ArchimedeDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_ArchimedeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_ArchimedeDlg();
private:
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
Handle(SALOME_InteractiveObject) myIO ;
Standard_Real myWeight ;
Standard_Real myWaterDensity ;
Standard_Real myMeshingDeflection ;
bool myOkIO ;
bool myOkWeight ;
bool myOkWaterDensity ;
bool myOkMeshingDeflection ;
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
QDoubleValidator *myVa ; /* Double validator for numeric input */
QDoubleValidator *myVb ; /* Double validator for numeric input */
QDoubleValidator *myVc ; /* Double validator for numeric input */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QGroupBox* GroupC1;
QLineEdit* LineEditC1A1;
QLineEdit* LineEditC1A2;
QLineEdit* LineEditC1A3;
QLineEdit* LineEditC1A4;
QPushButton* SelectButtonC1A1;
QLabel* TextLabelC1A1;
QLabel* TextLabelC1A2;
QLabel* TextLabelC1A3;
QLabel* TextLabelC1A4;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void TextChangedInLineEdit(const QString&) ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_ArchimedeDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
};
#endif // DIALOGBOX_ARCHIMEDE_H

View File

@ -1,487 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_BndBoxDlg.cxx
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_BndBoxDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
#include <BRepPrimAPI_MakeBox.hxx>
#include <BRepBndLib.hxx>
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_BndBoxDlg()
// purpose : Constructs a GeometryGUI_BndBoxDlg 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.
//=================================================================================
GeometryGUI_BndBoxDlg::GeometryGUI_BndBoxDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BOUNDING_BOX")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_BndBoxDlg" );
resize( 303, 275 );
setCaption( tr( "GEOM_BNDBOX_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_BndBoxDlgLayout = new QGridLayout( this );
GeometryGUI_BndBoxDlgLayout->setSpacing( 6 );
GeometryGUI_BndBoxDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_BNDBOX" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 60, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_BndBoxDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
GroupConstructor1->setTitle( tr( "GEOM_BNDBOX_OBJDIM" ) );
GroupConstructor1->setColumnLayout(0, Qt::Vertical );
GroupConstructor1->layout()->setSpacing( 0 );
GroupConstructor1->layout()->setMargin( 0 );
GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
GroupConstructor1Layout->setAlignment( Qt::AlignTop );
GroupConstructor1Layout->setSpacing( 6 );
GroupConstructor1Layout->setMargin( 11 );
LineEditC1A1 = new QLineEdit( GroupConstructor1, "LineEditC1A1" );
LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
// GroupConstructor1Layout->addWidget( LineEditC1A1, 0, 2 );
SelectButtonC1A1 = new QPushButton( GroupConstructor1, "SelectButtonC1A1" );
SelectButtonC1A1->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
// GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 );
TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
// GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 );
QHBoxLayout* bl = new QHBoxLayout;
bl->setMargin(0); bl->setSpacing(6);
bl->addWidget(TextLabelC1A1); bl->addWidget(SelectButtonC1A1); bl->addWidget(LineEditC1A1);
GroupConstructor1Layout->addMultiCellLayout(bl, 0, 0, 0, 2);
TextLabel_Min = new QLabel( GroupConstructor1, "TextLabel_Min" );
TextLabel_Min->setText( tr( "GEOM_MIN" ) );
TextLabel_Min->setMinimumSize( QSize( 50, 0 ) );
TextLabel_Min->setFrameShape( QLabel::NoFrame );
TextLabel_Min->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabel_Min, 1, 1 );
TextLabel_Max = new QLabel( GroupConstructor1, "TextLabel_Max" );
TextLabel_Max->setText( tr( "GEOM_MAX" ) );
TextLabel_Max->setMinimumSize( QSize( 50, 0 ) );
TextLabel_Max->setFrameShape( QLabel::NoFrame );
TextLabel_Max->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabel_Max, 1, 2 );
TextLabel_X = new QLabel( GroupConstructor1, "TextLabel_X" );
TextLabel_X->setText( tr( "GEOM_X" ) );
TextLabel_X->setMinimumSize( QSize( 50, 0 ) );
TextLabel_X->setFrameShape( QLabel::NoFrame );
TextLabel_X->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabel_X, 2, 0 );
LineEdit_MinX = new QLineEdit( GroupConstructor1, "LineEdit_MinX" );
LineEdit_MinX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
LineEdit_MinX->sizePolicy().hasHeightForWidth() ) );
//LineEdit_MinX->setEnabled( FALSE );
LineEdit_MinX->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_MinX, 2, 1 );
LineEdit_MaxX = new QLineEdit( GroupConstructor1, "LineEdit_MaxX" );
LineEdit_MaxX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
LineEdit_MaxX->sizePolicy().hasHeightForWidth() ) );
//LineEdit_MaxX->setEnabled( FALSE );
LineEdit_MaxX->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_MaxX, 2, 2 );
TextLabel_Y = new QLabel( GroupConstructor1, "TextLabel_Y" );
TextLabel_Y->setText( tr( "GEOM_Y" ) );
TextLabel_Y->setMinimumSize( QSize( 50, 0 ) );
TextLabel_Y->setFrameShape( QLabel::NoFrame );
TextLabel_Y->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabel_Y, 3, 0 );
LineEdit_MinY = new QLineEdit( GroupConstructor1, "LineEdit_MinY" );
LineEdit_MinY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
LineEdit_MinY->sizePolicy().hasHeightForWidth() ) );
//LineEdit_MinY->setEnabled( FALSE );
LineEdit_MinY->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_MinY, 3, 1 );
LineEdit_MaxY = new QLineEdit( GroupConstructor1, "LineEdit_MaxY" );
LineEdit_MaxY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
LineEdit_MaxY->sizePolicy().hasHeightForWidth() ) );
//LineEdit_MaxY->setEnabled( FALSE );
LineEdit_MaxY->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_MaxY, 3, 2 );
TextLabel_Z = new QLabel( GroupConstructor1, "TextLabel_Z" );
TextLabel_Z->setText( tr( "GEOM_Z" ) );
TextLabel_Z->setMinimumSize( QSize( 50, 0 ) );
TextLabel_Z->setFrameShape( QLabel::NoFrame );
TextLabel_Z->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabel_Z, 4, 0 );
LineEdit_MinZ = new QLineEdit( GroupConstructor1, "LineEdit_MinZ" );
LineEdit_MinZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
LineEdit_MinZ->sizePolicy().hasHeightForWidth() ) );
//LineEdit_MinZ->setEnabled( FALSE );
LineEdit_MinZ->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_MinZ, 4, 1 );
LineEdit_MaxZ = new QLineEdit( GroupConstructor1, "LineEdit_MaxZ" );
LineEdit_MaxZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
LineEdit_MaxZ->sizePolicy().hasHeightForWidth() ) );
//LineEdit_MaxZ->setEnabled( FALSE );
LineEdit_MaxZ->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_MaxZ, 4, 2 );
GeometryGUI_BndBoxDlgLayout->addWidget( GroupConstructor1, 1, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 1 );
QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_8, 0, 0 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
GeometryGUI_BndBoxDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_BndBoxDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_BndBoxDlg::~GeometryGUI_BndBoxDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_BndBoxDlg::Init( SALOME_Selection* Sel )
{
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
mySimulationTopoDs.Nullify() ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_BndBoxDlg::ConstructorsClicked(int constructorId)
{
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_BndBoxDlg::ClickOnCancel()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_BndBoxDlg::SelectionIntoArgument()
{
LineEdit_MinX->setText("") ;
LineEdit_MinY->setText("") ;
LineEdit_MinZ->setText("") ;
LineEdit_MaxX->setText("") ;
LineEdit_MaxY->setText("") ;
LineEdit_MaxZ->setText("") ;
myEditCurrentArgument->setText("") ;
mySimulationTopoDs.Nullify() ;
QString aString = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
return ;
}
/* nbSel == 1 */
TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if( S.IsNull() ) {
myEditCurrentArgument->setText( "" );
return ;
}
LineEditC1A1->setText(aString) ;
this->CalculateAndDisplayBndBox(S) ;
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_BndBoxDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_BndBoxDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_BndBoxDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ;
GroupConstructor1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_BndBoxDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupConstructor1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_BndBoxDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_BndBoxDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : CalculateAndDisplayBndBox()
// purpose :
//=================================================================================
void GeometryGUI_BndBoxDlg::CalculateAndDisplayBndBox(const TopoDS_Shape& S)
{
LineEdit_MinX->setText("") ;
LineEdit_MinY->setText("") ;
LineEdit_MinZ->setText("") ;
LineEdit_MaxX->setText("") ;
LineEdit_MaxY->setText("") ;
LineEdit_MaxZ->setText("") ;
if( S.IsNull() )
return ;
Standard_Real axmin,aymin,azmin,axmax,aymax,azmax;
Bnd_Box B;
try {
BRepBndLib::Add(S,B);
B.Get(axmin,aymin,azmin,axmax,aymax,azmax);
LineEdit_MinX->setText( tr("%1").arg( axmin, 12, 'f', 6 ) ) ;
LineEdit_MinY->setText( tr("%1").arg( aymin, 12, 'f', 6 ) ) ;
LineEdit_MinZ->setText( tr("%1").arg( azmin, 12, 'f', 6 ) ) ;
LineEdit_MaxX->setText( tr("%1").arg( axmax, 12, 'f', 6 ) ) ;
LineEdit_MaxY->setText( tr("%1").arg( aymax, 12, 'f', 6 ) ) ;
LineEdit_MaxZ->setText( tr("%1").arg( azmax, 12, 'f', 6 ) ) ;
mySimulationTopoDs = BRepPrimAPI_MakeBox( gp_Pnt(axmin,aymin,azmin),
gp_Pnt(axmax,aymax,azmax) ).Shape();
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
}
catch(Standard_Failure) {
MESSAGE("Catch intercepted in CalculateAndDisplayBndBox()" << endl ) ;
}
return ;
}

View File

@ -1,119 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_BndBoxDlg.h
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_BNDBOX_H
#define DIALOGBOX_BNDBOX_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : DialogBox_PROPERTIES
// purpose :
//=================================================================================
class GeometryGUI_BndBoxDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_BndBoxDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_BndBoxDlg();
private:
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
void CalculateAndDisplayBndBox(const TopoDS_Shape& S) ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupConstructor1;
QLineEdit* LineEditC1A1;
QPushButton* SelectButtonC1A1;
QLabel* TextLabelC1A1;
QLabel* TextLabel_Min;
QLabel* TextLabel_Max;
QLabel* TextLabel_X;
QLabel* TextLabel_Y;
QLabel* TextLabel_Z;
QLineEdit* LineEdit_MinX;
QLineEdit* LineEdit_MinY;
QLineEdit* LineEdit_MinZ;
QLineEdit* LineEdit_MaxX;
QLineEdit* LineEdit_MaxY;
QLineEdit* LineEdit_MaxZ;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnCancel();
void SetEditCurrentArgument() ;
void LineEditReturnPressed() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_BndBoxDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupConstructor1Layout;
QGridLayout* GroupButtonsLayout;
};
#endif // DIALOGBOX_BNDBOX_H

View File

@ -1,411 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_BoxDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_BoxDlg.h"
#include <BRepPrimAPI_MakeBox.hxx>
#include "GeometryGUI.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
//=================================================================================
// class : GeometryGUI_BoxDlg()
// purpose : Constructs a GeometryGUI_BoxDlg 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.
//=================================================================================
GeometryGUI_BoxDlg::GeometryGUI_BoxDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
:GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BOX_2P")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BOX_DXYZ")));
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_SELECT")));
setCaption(tr("GEOM_BOX_TITLE"));
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_BOX"));
RadioButton1->setPixmap(image0);
RadioButton2->setPixmap(image1);
RadioButton3->close(TRUE);
GroupPoints = new GeometryGUI_2Sel_QTD(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_DIAGONAL_POINTS"));
GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1"));
GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2"));
GroupPoints->PushButton1->setPixmap(image2);
GroupPoints->PushButton2->setPixmap(image2);
GroupDimensions = new GeometryGUI_3Spin(this, "GroupDimensions");
GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
GroupDimensions->TextLabel1->setText(tr("GEOM_DX"));
GroupDimensions->TextLabel2->setText(tr("GEOM_DY"));
GroupDimensions->TextLabel3->setText(tr("GEOM_DZ"));
Layout1->addWidget(GroupPoints, 1, 0);
Layout1->addWidget(GroupDimensions, 1, 0);
/***************************************************************/
/* Initialisations */
myPrimitiveGUI = thePrimitiveGUI;
Init();
}
//=================================================================================
// function : ~DialogBox_Box()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_BoxDlg::~GeometryGUI_BoxDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_BoxDlg::Init()
{
/* init variables */
myConstructorId = 0;
myEditCurrentArgument = GroupPoints->LineEdit1;
myPoint1.SetCoord(0.0, 0.0, 0.0);
myPoint2.SetCoord(0.0, 0.0, 0.0);
myOkPoint1 = myOkPoint2 = false;
/* Vertices Filter for all arguments */
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
mySelection->AddFilter(myVertexFilter);
/* Get setting of step value from file configuration */
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
step = St.toDouble();
/* min, max, step and decimals for spin boxes */
GroupDimensions->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3);
GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
GroupDimensions->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3);
double initValue = 200.0;
GroupDimensions->SpinBox_DX->SetValue(initValue);
GroupDimensions->SpinBox_DY->SetValue(initValue);
GroupDimensions->SpinBox_DZ->SetValue(initValue);
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
/* displays Dialog */
GroupDimensions->hide();
GroupPoints->show();
this->show();
return;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_BoxDlg::ConstructorsClicked(int constructorId)
{
myConstructorId = constructorId;
mySelection->ClearFilters();
myGeomGUI->EraseSimulationShape();
disconnect(mySelection, 0, this, 0);
myOkPoint1 = myOkPoint2 = false;
switch (constructorId)
{
case 0:
{
GroupDimensions->hide();
resize(0, 0);
GroupPoints->show();
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText("");
GroupPoints->LineEdit2->setText("");
/* filter for next selection */
mySelection->AddFilter(myVertexFilter);
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
case 1:
{
GroupPoints->hide();
resize( 0, 0 );
GroupDimensions->show();
double initValue = 200.0;
GroupDimensions->SpinBox_DX->SetValue(initValue);
GroupDimensions->SpinBox_DY->SetValue(initValue);
GroupDimensions->SpinBox_DZ->SetValue(initValue);
myPoint1.SetCoord(0.0, 0.0, 0.0) ;
myPoint2.SetCoord(initValue, initValue, initValue);
mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
break;
}
}
return;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_BoxDlg::ClickOnOk()
{
this->ClickOnApply();
ClickOnCancel();
return;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_BoxDlg::ClickOnApply()
{
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify();
switch(myConstructorId)
{
case 0 :
{
if(myOkPoint1 && myOkPoint2)
myPrimitiveGUI->MakeBoxAndDisplay(myPoint1, myPoint2);
break;
}
case 1 :
{
/* Recup args and call method */
double vx = GroupDimensions->SpinBox_DX->GetValue();
double vy = GroupDimensions->SpinBox_DY->GetValue();
double vz = GroupDimensions->SpinBox_DZ->GetValue();
myPoint1.SetCoord(0.0, 0.0, 0.0);
myPoint2.SetCoord(vx, vy, vz);
myPrimitiveGUI->MakeBoxAndDisplay(myPoint1, myPoint2);
break;
}
}
return;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed
//=================================================================================
void GeometryGUI_BoxDlg::SelectionIntoArgument()
{
myGeomGUI->EraseSimulationShape();
myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if (nbSel != 1) {
if (myEditCurrentArgument == GroupPoints->LineEdit1)
myOkPoint1 = false;
else if ( myEditCurrentArgument == GroupPoints->LineEdit2)
myOkPoint2 = false;
return;
}
// nbSel == 1
TopoDS_Shape S;
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
return;
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
myEditCurrentArgument->setText(aString);
myOkPoint1 = true;
}
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomGUI->VertexToPoint(S, myPoint2)) {
myEditCurrentArgument->setText(aString);
myOkPoint2 = true;
}
if(myOkPoint1 && myOkPoint2 && TestBoxDimensions(myPoint1, myPoint2)) {
mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
}
return;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_BoxDlg::SetEditCurrentArgument()
{
if(myConstructorId != 0)
return;
QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
}
else if(send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
}
mySelection->AddFilter(myVertexFilter);
this->SelectionIntoArgument();
return;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_BoxDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1)
myEditCurrentArgument = GroupPoints->LineEdit1;
else if (send == GroupPoints->LineEdit2)
myEditCurrentArgument = GroupPoints->LineEdit2;
else
return;
GeometryGUI_Skeleton::LineEditReturnPressed();
return;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_BoxDlg::ActivateThisDialog()
{
GeometryGUI_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
// function : enterEvent [REDEFINED]
// purpose :
//=================================================================================
void GeometryGUI_BoxDlg::enterEvent(QEvent* e)
{
if (GroupConstructors->isEnabled())
return;
this->ActivateThisDialog();
return;
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void GeometryGUI_BoxDlg::ValueChangedInSpinBox(double newValue)
{
myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify();
QObject* send = (QObject*)sender();
double vx, vy, vz;
if(send == GroupDimensions->SpinBox_DX ) {
vx = newValue;
vy = GroupDimensions->SpinBox_DY->GetValue();
vz = GroupDimensions->SpinBox_DZ->GetValue();
} else if (send == GroupDimensions->SpinBox_DY) {
vx = GroupDimensions->SpinBox_DX->GetValue();
vy = newValue;
vz = GroupDimensions->SpinBox_DZ->GetValue();
} else if (send == GroupDimensions->SpinBox_DZ) {
vx = GroupDimensions->SpinBox_DX->GetValue();
vy = GroupDimensions->SpinBox_DY->GetValue();
vz = newValue;
}
myPoint1.SetCoord(0.0, 0.0, 0.0);
myPoint2.SetCoord(vx, vy, vz);
if(TestBoxDimensions(myPoint1, myPoint2)) {
mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
}
return;
}
//=================================================================================
// function : TestBoxDimensions()
// purpose :
//=================================================================================
bool GeometryGUI_BoxDlg::TestBoxDimensions(gp_Pnt P1, gp_Pnt P2)
{
if ((fabs(P1.X() - P2.X()) > Precision::Confusion()) &&
(fabs(P1.Y() - P2.Y()) > Precision::Confusion()) &&
(fabs(P1.Z() - P2.Z()) > Precision::Confusion()))
return true;
return false;
}

View File

@ -1,83 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_BoxDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_BOX_H
#define DIALOGBOX_BOX_H
#include "GeometryGUI_Skeleton.h"
#include "GeometryGUI_2Sel_QTD.h"
#include "GeometryGUI_3Spin.h"
#include "PrimitiveGUI.h"
#include <gp_Pnt.hxx>
//=================================================================================
// class : GeometryGUI_BoxDlg
// purpose :
//=================================================================================
class GeometryGUI_BoxDlg : public GeometryGUI_Skeleton
{
Q_OBJECT
public:
GeometryGUI_BoxDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_BoxDlg();
private :
void Init();
void enterEvent(QEvent* e);
bool TestBoxDimensions(gp_Pnt P1, gp_Pnt P2);
PrimitiveGUI* myPrimitiveGUI;
double step;
int myConstructorId;
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */
gp_Pnt myPoint1; /* Points containing the vector */
gp_Pnt myPoint2;
bool myOkPoint1; /* true when myPoint is defined */
bool myOkPoint2;
GeometryGUI_2Sel_QTD* GroupPoints;
GeometryGUI_3Spin* GroupDimensions;
private slots:
void ClickOnOk();
void ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ConstructorsClicked(int constructorId);
void ValueChangedInSpinBox(double newValue);
};
#endif // DIALOGBOX_BOX_H

View File

@ -1,527 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CenterMassDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_CenterMassDlg.h"
#include "GeometryGUI.h"
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qvalidator.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_CenterMassDlg()
// purpose : Constructs a GeometryGUI_CenterMassDlg 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.
//=================================================================================
GeometryGUI_CenterMassDlg::GeometryGUI_CenterMassDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CENTERMASS")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_CenterMassDlg" );
resize( 398, 219 );
setCaption( tr( "GEOM_CMASS_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_CenterMassDlgLayout = new QGridLayout( this );
GeometryGUI_CenterMassDlgLayout->setSpacing( 6 );
GeometryGUI_CenterMassDlgLayout->setMargin( 11 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_CenterMassDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_CMASS" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 1 );
GeometryGUI_CenterMassDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_OBJECT_RESULT" ) );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEdit_X = new QLineEdit( GroupC1, "LineEdit_X" );
LineEdit_X->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_X->sizePolicy().hasHeightForWidth() ) );
LineEdit_X->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_X->setEnabled( FALSE );
LineEdit_X->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_X, 1, 2 );
TextLabel_Z = new QLabel( GroupC1, "TextLabel_Z" );
TextLabel_Z->setText( tr( "GEOM_Z" ) );
TextLabel_Z->setMinimumSize( QSize( 15, 0 ) );
TextLabel_Z->setFrameShape( QLabel::NoFrame );
TextLabel_Z->setFrameShadow( QLabel::Plain );
TextLabel_Z->setMaximumSize( QSize( 15, 32767 ) );
GroupC1Layout->addWidget( TextLabel_Z, 1, 5 );
LineEdit_Z = new QLineEdit( GroupC1, "LineEdit_Z" );
LineEdit_Z->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Z->sizePolicy().hasHeightForWidth() ) );
LineEdit_Z->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_Z->setEnabled( FALSE );
LineEdit_Z->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_Z, 1, 6 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
LineEdit_Y = new QLineEdit( GroupC1, "LineEdit_Y" );
LineEdit_Y->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Y->sizePolicy().hasHeightForWidth() ) );
LineEdit_Y->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_Y->setEnabled( FALSE );
LineEdit_Y->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_Y, 1, 4 );
TextLabel_Y = new QLabel( GroupC1, "TextLabel_Y" );
TextLabel_Y->setText( tr( "GEOM_Y" ) );
TextLabel_Y->setMinimumSize( QSize( 15, 0 ) );
TextLabel_Y->setFrameShape( QLabel::NoFrame );
TextLabel_Y->setFrameShadow( QLabel::Plain );
TextLabel_Y->setMaximumSize( QSize( 15, 32767 ) );
GroupC1Layout->addWidget( TextLabel_Y, 1, 3 );
TextLabel_X = new QLabel( GroupC1, "TextLabel_X" );
TextLabel_X->setText( tr( "GEOM_X" ) );
TextLabel_X->setMinimumSize( QSize( 15, 0 ) );
TextLabel_X->setFrameShape( QLabel::NoFrame );
TextLabel_X->setFrameShadow( QLabel::Plain );
TextLabel_X->setMaximumSize( QSize( 15, 32767 ) );
GroupC1Layout->addWidget( TextLabel_X, 1, 1 );
TextLabel_Center = new QLabel( GroupC1, "TextLabel_Center" );
TextLabel_Center->setText( tr( "GEOM_CENTER" ) );
TextLabel_Center->setMinimumSize( QSize( 50, 0 ) );
TextLabel_Center->setFrameShape( QLabel::NoFrame );
TextLabel_Center->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabel_Center, 1, 0 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
LineEditC1A1->setMinimumSize( QSize( 260, 0 ) );
GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 6 );
GeometryGUI_CenterMassDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_CenterMassDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_CenterMassDlg::~GeometryGUI_CenterMassDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_CenterMassDlg::Init( SALOME_Selection* Sel )
{
LineEdit_X->setMaxLength( 9 );
LineEdit_Y->setMaxLength( 9 );
LineEdit_Z->setMaxLength( 9 );
QDoubleValidator *Va = new QDoubleValidator( -999999, +999999, 3, LineEdit_X ) ;
QDoubleValidator *Vb = new QDoubleValidator( -999999, +999999, 3, LineEdit_Y ) ;
QDoubleValidator *Vc = new QDoubleValidator( -999999, +999999, 3, LineEdit_Z ) ;
LineEdit_X->setValidator( Va ) ;
LineEdit_Y->setValidator( Vb ) ;
LineEdit_Z->setValidator( Vc ) ;
myConstructorId = 0 ;
LineEdit_X->setText("") ;
LineEdit_Y->setText("") ;
LineEdit_Z->setText("") ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
mySimulationTopoDs.Nullify() ;
myShape.Nullify() ;
myOkCenterMass = false ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ) ;
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_CenterMassDlg::ConstructorsClicked(int constructorId)
{
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_CenterMassDlg::ClickOnCancel()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_CenterMassDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_CenterMassDlg::ClickOnApply()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
if( myOkCenterMass) {
myGeomGUI->MakeCDGAndDisplay( myGeomShape ) ;
}
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_CenterMassDlg::SelectionIntoArgument()
{
myGeomGUI->EraseSimulationShape() ;
myEditCurrentArgument->setText("") ;
myOkCenterMass = false ;
Standard_Boolean testResult ;
LineEdit_X->setText("") ;
LineEdit_Y->setText("") ;
LineEdit_Z->setText("") ;
QString aString = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
return ;
}
/* nbSel == 1 */
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, this->myShape) )
return ;
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
myEditCurrentArgument->setText(aString) ;
if( this->CalculateAndDisplayCenterMass() ) {
myOkCenterMass = true ;
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_CenterMassDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_CenterMassDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_CenterMassDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
myGeomGUI->EraseSimulationShape() ;
disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_CenterMassDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_CenterMassDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_CenterMassDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : CalculateAndDisplayCenterMass()
// purpose :
//=================================================================================
bool GeometryGUI_CenterMassDlg::CalculateAndDisplayCenterMass()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
try {
QString resString;
GProp_GProps System;
if ( this->myShape.ShapeType() == TopAbs_VERTEX) {
myGeomGUI->VertexToPoint( this->myShape, this->myCenterMass );
}
else if ( this->myShape.ShapeType() == TopAbs_EDGE || this->myShape.ShapeType() == TopAbs_WIRE ) {
BRepGProp::LinearProperties(this->myShape, System);
this->myCenterMass = System.CentreOfMass() ;
}
else if ( this->myShape.ShapeType() == TopAbs_FACE || this->myShape.ShapeType() == TopAbs_SHELL ) {
BRepGProp::SurfaceProperties(this->myShape, System);
this->myCenterMass = System.CentreOfMass() ;
}
else {
BRepGProp::VolumeProperties(this->myShape, System);
this->myCenterMass = System.CentreOfMass() ;
}
BRepBuilderAPI_MakeVertex V(this->myCenterMass) ;
mySimulationTopoDs = V.Shape() ;
resString = tr("%1").arg( myCenterMass.X(), 12, 'f', 6 ) ;
LineEdit_X->setText(resString) ;
resString = tr("%1").arg( myCenterMass.Y(), 12, 'f', 6 ) ;
LineEdit_Y->setText(resString) ;
resString = tr("%1").arg( myCenterMass.Z(), 12, 'f', 6 ) ;
LineEdit_Z->setText(resString) ;
if( !mySimulationTopoDs.IsNull() ) {
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return true ;
}
}
catch(Standard_Failure) {
MESSAGE("Catch intercepted in CalculateAndDisplayCenterMass()" << endl ) ;
}
return false ;
}

View File

@ -1,121 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CenterMassDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
#ifndef DIALOGBOX_CMASS_H
#define DIALOGBOX_CMASS_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <BRepGProp.hxx>
#include <GProp_GProps.hxx>
#include <GProp_PrincipalProps.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_CenterMassDlg
// purpose :
//=================================================================================
class GeometryGUI_CenterMassDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_CenterMassDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_CenterMassDlg();
private:
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
bool CalculateAndDisplayCenterMass() ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */
TopoDS_Shape myShape ; /* Shape argument */
gp_Pnt myCenterMass ;
bool myOkCenterMass ; /* true after center of mass simulation calculation */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupC1;
QPushButton* SelectButtonC1A1;
QLineEdit* LineEdit_X;
QLabel* TextLabel_Z;
QLineEdit* LineEdit_Z;
QLabel* TextLabelC1A1;
QLineEdit* LineEdit_Y;
QLabel* TextLabel_Y;
QLabel* TextLabel_X;
QLabel* TextLabel_Center;
QLineEdit* LineEditC1A1;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnCancel();
void ClickOnOk() ;
void ClickOnApply();
void SetEditCurrentArgument() ;
void LineEditReturnPressed() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_CenterMassDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
};
#endif // DIALOGBOX_CMASS_H

View File

@ -1,934 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_ChamferDlg.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_ChamferDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
#include "QAD_RightFrame.h"
#include "OCCViewer_Viewer3d.h"
#include "utilities.h"
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <BRepFilletAPI_MakeChamfer.hxx>
#include <BRepTools.hxx>
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
//=================================================================================
// class : GeometryGUI_ChamferDlg()
// purpose : Constructs a GeometryGUI_ChamferDlg 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.
//=================================================================================
GeometryGUI_ChamferDlg::GeometryGUI_ChamferDlg( QWidget* parent,
const char* name,
SALOME_Selection* Sel,
Handle (AIS_InteractiveContext) ic,
bool modal,
WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
/***************************************************************/
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CHAMFER_ALL")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CHAMFER_EDGE")));
QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CHAMFER_FACE")));
if ( !name )
setName( "GeometryGUI_ChamferDlg" );
resize( 365, 220 );
setCaption( tr( "GEOM_CHAMFER_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_ChamferDlgLayout = new QGridLayout( this );
GeometryGUI_ChamferDlgLayout->setSpacing( 6 );
GeometryGUI_ChamferDlgLayout->setMargin( 11 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_ChamferDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_CHAMFER" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
Constructor2->setText( tr( "" ) );
Constructor2->setPixmap( image2 );
Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) );
Constructor2->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 3 );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_3, 0, 1 );
Constructor3 = new QRadioButton( GroupConstructors, "Constructor3" );
Constructor3->setText( tr( "" ) );
Constructor3->setPixmap( image3 );
Constructor3->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor3, 0, 4 );
QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_4, 0, 5 );
GeometryGUI_ChamferDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_CHAMFER_ALL" ) );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_D1" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
TextLabelC1A2->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
TextLabelC1A3->setText( tr( "GEOM_D2" ) );
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A3->setFrameShape( QLabel::NoFrame );
TextLabelC1A3->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
// LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
// LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) );
// GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
// LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" );
// LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) );
// GroupC1Layout->addWidget( LineEditC1A3, 2, 2 );
SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A2" ) ;
SpinBox_C1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A2->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( SpinBox_C1A2, 1, 2 );
SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ;
SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
GeometryGUI_ChamferDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
GroupC2 = new QGroupBox( this, "GroupC2" );
GroupC2->setTitle( tr( "GEOM_CHAMFER_EDGES" ) );
GroupC2->setMinimumSize( QSize( 0, 0 ) );
GroupC2->setFrameShape( QGroupBox::Box );
GroupC2->setFrameShadow( QGroupBox::Sunken );
GroupC2->setColumnLayout(0, Qt::Vertical );
GroupC2->layout()->setSpacing( 0 );
GroupC2->layout()->setMargin( 0 );
GroupC2Layout = new QGridLayout( GroupC2->layout() );
GroupC2Layout->setAlignment( Qt::AlignTop );
GroupC2Layout->setSpacing( 6 );
GroupC2Layout->setMargin( 11 );
TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" );
TextLabelC2A1->setText( tr( "GEOM_MAIN_OBJECT" ) );
TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC2A1->setFrameShape( QLabel::NoFrame );
TextLabelC2A1->setFrameShadow( QLabel::Plain );
GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 );
TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" );
TextLabelC2A2->setText( tr( "GEOM_D1" ) );
TextLabelC2A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC2A2->setFrameShape( QLabel::NoFrame );
TextLabelC2A2->setFrameShadow( QLabel::Plain );
GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 );
TextLabelC2A3 = new QLabel( GroupC2, "TextLabelC2A3" );
TextLabelC2A3->setText( tr( "GEOM_D2" ) );
TextLabelC2A3->setMinimumSize( QSize( 50, 0 ) );
TextLabelC2A3->setFrameShape( QLabel::NoFrame );
TextLabelC2A3->setFrameShadow( QLabel::Plain );
GroupC2Layout->addWidget( TextLabelC2A3, 2, 0 );
LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" );
GroupC2Layout->addWidget( LineEditC2A1, 0, 2 );
// LineEditC2A2 = new QLineEdit( GroupC2, "LineEditC2A2" );
// LineEditC2A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC2A2->sizePolicy().hasHeightForWidth() ) );
// GroupC2Layout->addWidget( LineEditC2A2, 1, 2 );
// LineEditC2A3 = new QLineEdit( GroupC2, "LineEditC2A3" );
// LineEditC2A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC2A3->sizePolicy().hasHeightForWidth() ) );
// GroupC2Layout->addWidget( LineEditC2A3, 2, 2 );
SpinBox_C2A2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A2" ) ;
SpinBox_C2A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A2->sizePolicy().hasHeightForWidth() ) );
GroupC2Layout->addWidget( SpinBox_C2A2, 1, 2 );
SpinBox_C2A3 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A3" ) ;
SpinBox_C2A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A3->sizePolicy().hasHeightForWidth() ) );
GroupC2Layout->addWidget( SpinBox_C2A3, 2, 2 );
SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" );
SelectButtonC2A1->setText( tr( "" ) );
SelectButtonC2A1->setPixmap( image1 );
SelectButtonC2A1->setToggleButton( FALSE );
SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) );
GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 );
GeometryGUI_ChamferDlgLayout->addWidget( GroupC2, 1, 0 );
/***************************************************************/
GroupC3 = new QGroupBox( this, "GroupC3" );
GroupC3->setTitle( tr( "GEOM_CHAMFER_FACES" ) );
GroupC3->setMinimumSize( QSize( 0, 0 ) );
GroupC3->setFrameShape( QGroupBox::Box );
GroupC3->setFrameShadow( QGroupBox::Sunken );
GroupC3->setColumnLayout(0, Qt::Vertical );
GroupC3->layout()->setSpacing( 0 );
GroupC3->layout()->setMargin( 0 );
GroupC3Layout = new QGridLayout( GroupC3->layout() );
GroupC3Layout->setAlignment( Qt::AlignTop );
GroupC3Layout->setSpacing( 6 );
GroupC3Layout->setMargin( 11 );
TextLabelC3A1 = new QLabel( GroupC3, "TextLabelC3A1" );
TextLabelC3A1->setText( tr( "GEOM_MAIN_OBJECT" ) );
TextLabelC3A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC3A1->setFrameShape( QLabel::NoFrame );
TextLabelC3A1->setFrameShadow( QLabel::Plain );
GroupC3Layout->addWidget( TextLabelC3A1, 0, 0 );
TextLabelC3A2 = new QLabel( GroupC3, "TextLabelC3A2" );
TextLabelC3A2->setText( tr( "GEOM_D1" ) );
TextLabelC3A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC3A2->setFrameShape( QLabel::NoFrame );
TextLabelC3A2->setFrameShadow( QLabel::Plain );
GroupC3Layout->addWidget( TextLabelC3A2, 1, 0 );
TextLabelC3A3 = new QLabel( GroupC3, "TextLabelC3A3" );
TextLabelC3A3->setText( tr( "GEOM_D2" ) );
TextLabelC3A3->setMinimumSize( QSize( 50, 0 ) );
TextLabelC3A3->setFrameShape( QLabel::NoFrame );
TextLabelC3A3->setFrameShadow( QLabel::Plain );
GroupC3Layout->addWidget( TextLabelC3A3, 2, 0 );
LineEditC3A1 = new QLineEdit( GroupC3, "LineEditC3A1" );
GroupC3Layout->addWidget( LineEditC3A1, 0, 2 );
// LineEditC3A2 = new QLineEdit( GroupC3, "LineEditC3A2" );
// LineEditC3A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC3A2->sizePolicy().hasHeightForWidth() ) );
// GroupC3Layout->addWidget( LineEditC3A2, 1, 2 );
// LineEditC3A3 = new QLineEdit( GroupC3, "LineEditC3A3" );
// LineEditC3A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC3A3->sizePolicy().hasHeightForWidth() ) );
// GroupC3Layout->addWidget( LineEditC3A3, 2, 2 );
SpinBox_C3A2 = new GeometryGUI_SpinBox( GroupC3, "GeomSpinBox_C3A2" ) ;
SpinBox_C3A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C3A2->sizePolicy().hasHeightForWidth() ) );
GroupC3Layout->addWidget( SpinBox_C3A2, 1, 2 );
SpinBox_C3A3 = new GeometryGUI_SpinBox( GroupC3, "GeomSpinBox_C3A3" ) ;
SpinBox_C3A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C3A3->sizePolicy().hasHeightForWidth() ) );
GroupC3Layout->addWidget( SpinBox_C3A3, 2, 2 );
SelectButtonC3A1 = new QPushButton( GroupC3, "SelectButtonC3A1" );
SelectButtonC3A1->setText( tr( "" ) );
SelectButtonC3A1->setPixmap( image1 );
SelectButtonC3A1->setToggleButton( FALSE );
SelectButtonC3A1->setMaximumSize( QSize( 28, 32767 ) );
GroupC3Layout->addWidget( SelectButtonC3A1, 0, 1 );
GeometryGUI_ChamferDlgLayout->addWidget( GroupC3, 1, 0 );
/* Initialisation */
Init( Sel, ic ) ;
}
//=================================================================================
// function : ~GeometryGUI_ChamferDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_ChamferDlg::~GeometryGUI_ChamferDlg()
{
/* no need to delete child widgets, Qt does it all for us */
this->destroy(TRUE, TRUE) ;
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_ChamferDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic )
{
/* Get setting of step value from file configuration */
double step ;
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
step = St.toDouble() ;
/* min, max, step and decimals for spin boxes */
SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* myD1 */
SpinBox_C1A2->SetValue( 50 ) ;
SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* myD2 */
SpinBox_C1A3->SetValue( 50 ) ;
SpinBox_C2A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
SpinBox_C2A2->SetValue( 50 ) ;
SpinBox_C2A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
SpinBox_C2A3->SetValue( 50 ) ;
SpinBox_C3A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
SpinBox_C3A2->SetValue( 50 ) ;
SpinBox_C3A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
SpinBox_C3A3->SetValue( 50 ) ;
GroupC1->show();
GroupC2->hide() ;
GroupC3->hide() ;
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
mySelection = Sel ;
myEditCurrentArgument = LineEditC1A1 ;
myShape.Nullify() ;
myD1 = 50.0 ;
myOkD1 = true ;
myD2 = 50.0 ;
myOkD2 = true ;
myIC = ic ;
myUseLocalContext = false ;
myOkShape = false ;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
mySimulationTopoDs.Nullify() ;
/* Filters definition */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC3A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_C2A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_C3A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_C2A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_C3A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC3A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* Displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_ChamferDlg::ConstructorsClicked(int constructorId)
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myEditCurrentArgument->setText(tr("")) ;
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
myIC = v3d->getAISContext();
if(myUseLocalContext ) {
myIC->CloseLocalContext(this->myLocalContextId);
myGeomGUI->OnDisplayAll(true) ;
myUseLocalContext = false ;
}
}
myOkShape = false ;
myD1 = 50.0 ;
myD2 = 50.0 ;
myOkD1 = true ;
myOkD2 = true ;
myConstructorId = constructorId ;
switch (constructorId)
{
case 0: /* Chamfer All */
{
GroupC1->show();
GroupC2->hide() ;
GroupC3->hide() ;
myEditCurrentArgument = LineEditC1A1 ;
SpinBox_C1A2->SetValue( 50 ) ;
SpinBox_C1A3->SetValue( 50 ) ;
LineEditC1A1->setText(tr("")) ;
myShapeType = -1;
break;
}
case 1: /* Chamfer edges */
{
myShapeType = 6;
GroupC1->hide();
GroupC2->show() ;
GroupC3->hide() ;
myEditCurrentArgument = LineEditC2A1 ;
SpinBox_C2A2->SetValue( 50 ) ;
SpinBox_C2A3->SetValue( 50 ) ;
LineEditC2A1->setText(tr("")) ;
break ;
}
case 2: /* Chamfer Faces */
{
myShapeType = 4;
GroupC1->hide();
GroupC2->hide() ;
GroupC3->show() ;
myEditCurrentArgument = LineEditC3A1 ;
SpinBox_C3A2->SetValue( 50 ) ;
SpinBox_C3A3->SetValue( 50 ) ;
LineEditC3A1->setText(tr("")) ;
break ;
}
}
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_ChamferDlg::ClickOnApply()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
bool testResult = false ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
{
case 0 : /* Chamfer All */
{
if(myOkD1 && myOkD2) {
if( myOkShape ) {
testResult = myGeomGUI->OnChamferGetAll( myShape, myD1, myD2, myShapeType, myShapeIOR ) ;
}
}
if( !testResult ) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ;
}
else {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ;
}
/* Reset all arguments and local context to allow user a new selection ...*/
this->ResetStateOfDialog() ;
break ;
}
case 1 : /* Chamfer Edge */
{
if(myOkD1 && myOkD2) {
if( myOkShape ) {
testResult = myGeomGUI->OnChamferGetSelected( myShape, myShapeIOR, myD1, myD2, myShapeType,
myLocalContextId, myUseLocalContext );
}
}
if( !testResult ) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ;
}
else {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ;
}
/* Reset all arguments and local context to allow user a new selection ...*/
this->ResetStateOfDialog() ;
break ;
}
case 2 : /* Chamfer Face */
{
if(myOkD1 && myOkD2) {
if( myOkShape ) {
testResult = myGeomGUI->OnChamferGetSelected( myShape, myShapeIOR, myD1, myD2, myShapeType,
myLocalContextId, myUseLocalContext ) ;
}
}
if( !testResult ) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ;
}
else {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ;
}
/* Reset all arguments and local context to allow user a new selection ...*/
this->ResetStateOfDialog() ;
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_ChamferDlg::ClickOnCancel()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
myIC = v3d->getAISContext();
if(this->myUseLocalContext ) {
myIC->CloseLocalContext(this->myLocalContextId) ;
this->myUseLocalContext = false ;
myGeomGUI->OnDisplayAll(true) ;
}
}
reject() ;
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_ChamferDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void GeometryGUI_ChamferDlg::SelectionIntoArgument()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
/* Reset all arguments and local context when selection as changed */
this->ResetStateOfDialog() ;
/* Future name of argument */
QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel == 1 ) {
TopoDS_Shape S ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if( !IO->hasEntry() ) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ;
return ;
}
if ( !S.IsNull() && S.ShapeType() <= 2 ) {
if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) {
Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO );
myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */
myEditCurrentArgument->setText(aString) ;
myShape = S ;
myOkShape = true ;
}
if ( IO->hasEntry() ) {
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() );
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeIOR_var anIOR;
if ( !obj->_is_nil() ) {
if (obj->FindAttribute(anAttr, "AttributeIOR")) {
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
myShapeIOR = anIOR->Value();
myOkShape = true ;
myShape = S ;
myEditCurrentArgument->setText(aString) ;
}
}
}
MakePreview();
}
} else
return;
if( myOkShape && myShapeType!=-1 && myConstructorId != 0 ) {
/* local context is defined into the method */
myGeomGUI->PrepareSubShapeSelection( this->myShapeType, this->myLocalContextId ) ;
myUseLocalContext = true ;
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_EDGE")) ;
}
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_ChamferDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else if ( send == LineEditC2A1 )
myEditCurrentArgument = LineEditC2A1 ;
else if ( send == LineEditC3A1 )
myEditCurrentArgument = LineEditC3A1 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_ChamferDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0:
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
SelectionIntoArgument() ;
}
break;
}
case 1:
{
if(send ==SelectButtonC2A1 ) {
LineEditC2A1->setFocus() ;
myEditCurrentArgument = LineEditC2A1;
SelectionIntoArgument() ;
}
break;
}
case 2:
{
if(send ==SelectButtonC3A1 ) {
LineEditC3A1->setFocus() ;
myEditCurrentArgument = LineEditC3A1;
SelectionIntoArgument() ;
}
break;
}
}
return ;
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void GeometryGUI_ChamferDlg::ValueChangedInSpinBox( double newValue )
{
QObject* send = (QObject*)sender();
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
if( send == SpinBox_C1A2 || send == SpinBox_C2A2 || send == SpinBox_C3A2 ) { /* D1 */
myD1 = newValue ;
myOkD1 = true ;
MakePreview();
return ;
}
if( send == SpinBox_C1A3 || send == SpinBox_C2A3 || send == SpinBox_C3A3 ) { /* D2 */
myD2 = newValue ;
myOkD2 = true ;
MakePreview();
return ;
}
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_ChamferDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
this->ResetStateOfDialog() ;
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupC2->setEnabled(false) ;
GroupC3->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
myGeomGUI->SetActiveDialogBox(0) ;
myGeomGUI->OnDisplayAll(true) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_ChamferDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupC2->setEnabled(true) ;
GroupC3->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_ChamferDlg::enterEvent( QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_ChamferDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ResetStateOfDialog()
// purpose :
//=================================================================================
void GeometryGUI_ChamferDlg::ResetStateOfDialog()
{
this->myOkShape = false ;
this->myEditCurrentArgument->setText("") ;
/* Close its local contact if opened */
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
myIC = v3d->getAISContext();
if(this->myUseLocalContext) {
myIC->CloseLocalContext(this->myLocalContextId) ;
this->myUseLocalContext = false ;
myGeomGUI->OnDisplayAll(true) ;
}
}
return ;
}
void GeometryGUI_ChamferDlg::MakePreview()
{
TopoDS_Shape tds ;
try
{
BRepFilletAPI_MakeChamfer MC(myShape);
switch (myConstructorId)
{
case 0: /* Chamfer All */
{
TopTools_IndexedDataMapOfShapeListOfShape M;
TopExp::MapShapesAndAncestors(myShape,TopAbs_EDGE,TopAbs_FACE,M);
for (int i = 1;i<=M.Extent();i++)
{
TopoDS_Edge E = TopoDS::Edge(M.FindKey(i));
TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First());
if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E))
MC.Add(myD1, myD2,E,F);
}
tds = MC.Shape();
break;
}
// case 1: /* Chamfer edges */
// case 2: /* Chamfer Faces */
}
if (!tds.IsNull())
{
mySimulationTopoDs = tds;
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
}
}
catch(Standard_Failure)
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
}

View File

@ -1,172 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_ChamferDlg.h
// Author : Damien COQUERET
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_CHAMFER_H
#define DIALOGBOX_CHAMFER_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include "GeometryGUI_SpinBox.h"
// Qt Includes
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
// Open CASCADE Includes
#include <AIS_InteractiveContext.hxx>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QFrame;
class QGroupBox;
class QLineEdit;
class QPushButton;
class QRadioButton;
class QToolButton;
class QLabel;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_ChamferDlg
// purpose :
//=================================================================================
class GeometryGUI_ChamferDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_ChamferDlg( QWidget* parent = 0,
const char* name = 0,
SALOME_Selection* Sel = 0,
Handle (AIS_InteractiveContext) ic = 0,
bool modal = FALSE,
WFlags fl = 0 );
~GeometryGUI_ChamferDlg();
private :
void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent( QEvent* e);
void ResetStateOfDialog() ;
/* Interactive and local context management see also : bool myUseLocalContext() */
Handle (AIS_InteractiveContext) myIC ; /* Interactive context */
Standard_Integer myLocalContextId ; /* identify a local context used by this method */
bool myUseLocalContext ; /* true when this method as opened a local context */
QDoubleValidator *myVa ; /* Double validator for numeric input */
QDoubleValidator *myVb ; /* Double validator for numeric input */
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape myShape ;
bool myOkShape ;
char* myShapeIOR ;
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
int myConstructorId ; /* Current constructor id = radio button id */
int myShapeType ;
TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */
void MakePreview();
bool myOkD1 ;
double myD1 ;
bool myOkD2 ;
double myD2 ;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QRadioButton* Constructor2;
QRadioButton* Constructor3;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QGroupBox* GroupC1;
QPushButton* SelectButtonC1A1;
QLineEdit* LineEditC1A1;
QLabel* TextLabelC1A1;
GeometryGUI_SpinBox* SpinBox_C1A2 ;
QLabel* TextLabelC1A2;
GeometryGUI_SpinBox* SpinBox_C1A3 ;
QLabel* TextLabelC1A3;
QGroupBox* GroupC2;
QPushButton* SelectButtonC2A1;
QLineEdit* LineEditC2A1;
QLabel* TextLabelC2A1;
GeometryGUI_SpinBox* SpinBox_C2A2 ;
QLabel* TextLabelC2A2;
GeometryGUI_SpinBox* SpinBox_C2A3;
QLabel* TextLabelC2A3;
QGroupBox* GroupC3;
QPushButton* SelectButtonC3A1;
QLineEdit* LineEditC3A1;
QLabel* TextLabelC3A1;
GeometryGUI_SpinBox* SpinBox_C3A2 ;
QLabel* TextLabelC3A2;
GeometryGUI_SpinBox* SpinBox_C3A3;
QLabel* TextLabelC3A3;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void LineEditReturnPressed() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
void ValueChangedInSpinBox( double newValue ) ;
protected:
QGridLayout* GeometryGUI_ChamferDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
QGridLayout* GroupC3Layout;
};
#endif // DIALOGBOX_CHAMFER_H

View File

@ -1,402 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CheckShape.cxx
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_CheckShape.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
// Open Cascade Include
#include <BRepCheck_Analyzer.hxx>
// QT Includes
#include <qtextview.h>
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_CheckShape()
// purpose : Constructs a GeometryGUI_CheckShape 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.
//=================================================================================
GeometryGUI_CheckShape::GeometryGUI_CheckShape( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CHECKSHAPE")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "DialogBox_CHECKSHAPE" );
resize( 303, 275 );
setCaption( tr( "GEOM_CHECK_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_CheckShapeLayout = new QGridLayout( this );
GeometryGUI_CheckShapeLayout->setSpacing( 6 );
GeometryGUI_CheckShapeLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_CHECK_SHAPE" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 60, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_CheckShapeLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
GroupConstructor1->setTitle( tr( "GEOM_CHECK_INFOS") );
GroupConstructor1->setColumnLayout(0, Qt::Vertical );
GroupConstructor1->layout()->setSpacing( 0 );
GroupConstructor1->layout()->setMargin( 0 );
GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
GroupConstructor1Layout->setAlignment( Qt::AlignTop );
GroupConstructor1Layout->setSpacing( 6 );
GroupConstructor1Layout->setMargin( 11 );
LineEditC1A1 = new QLineEdit( GroupConstructor1, "LineEditC1A1" );
LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
GroupConstructor1Layout->addWidget( LineEditC1A1, 0, 2 );
SelectButtonC1A1 = new QPushButton( GroupConstructor1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 );
TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 );
Text = new QTextView(GroupConstructor1);
Text->setTextFormat( Qt::PlainText );
GroupConstructor1Layout->addMultiCellWidget( Text, 1, 1, 0, 2 );
GeometryGUI_CheckShapeLayout->addWidget( GroupConstructor1, 1, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 1 );
// buttonApply = new QPushButton( GroupButtons, "buttonApply" );
// buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
// buttonApply->setAutoDefault( TRUE );
// GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_8, 0, 0 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
// buttonOk = new QPushButton( GroupButtons, "buttonOk" );
// buttonOk->setText( tr( "GEOM_BUT_OK" ) );
// buttonOk->setAutoDefault( TRUE );
// buttonOk->setDefault( TRUE );
// GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_CheckShapeLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_CheckShape()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_CheckShape::~GeometryGUI_CheckShape()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_CheckShape::Init( SALOME_Selection* Sel )
{
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
SelectedName = "";
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_CheckShape::ConstructorsClicked(int constructorId)
{
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_CheckShape::ClickOnCancel()
{
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_CheckShape::SelectionIntoArgument()
{
Text->setText("") ;
myEditCurrentArgument->setText("") ;
SelectedName = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, SelectedName) ;
if ( nbSel != 1 ) {
return ;
}
/* nbSel == 1 */
TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if( S.IsNull() ) {
myEditCurrentArgument->setText( "" );
return ;
}
LineEditC1A1->setText(SelectedName) ;
this->Check(S) ;
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_CheckShape::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_CheckShape::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_CheckShape::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ;
GroupConstructor1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_CheckShape::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupConstructor1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_CheckShape::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_CheckShape::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : Check()
// purpose :
//=================================================================================
void GeometryGUI_CheckShape::Check(const TopoDS_Shape S)
{
if( S.IsNull() )
return ;
try {
BRepCheck_Analyzer ana(S,false);
if (ana.IsValid())
Text->setText( "This Shape seems to be valid." );
else
Text->setText( "This Shape is not valid." );
}
catch(Standard_Failure) {
MESSAGE("Catch intercepted in Check()" << endl ) ;
}
return ;
}

View File

@ -1,110 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CheckShape.h
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_CHECKSHAPE_H
#define DIALOGBOX_CHECKSHAPE_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <Precision.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class QTextView;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_CheckShape
// purpose :
//=================================================================================
class GeometryGUI_CheckShape : public QDialog
{
Q_OBJECT
public:
GeometryGUI_CheckShape( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_CheckShape();
private:
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
void Check(const TopoDS_Shape S) ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupConstructor1;
QLineEdit* LineEditC1A1;
QPushButton* SelectButtonC1A1;
QLabel* TextLabelC1A1;
QTextView* Text;
QString SelectedName;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnCancel();
void SetEditCurrentArgument() ;
void LineEditReturnPressed() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_CheckShapeLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupConstructor1Layout;
QGridLayout* GroupButtonsLayout;
};
#endif // DIALOGBOX_CHECKSHAPE_H

View File

@ -1,504 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CircleDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_CircleDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
#include "utilities.h"
#include <BRepAdaptor_Curve.hxx>
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qvalidator.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_CircleDlg()
// purpose : Constructs a GeometryGUI_CircleDlg 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.
//=================================================================================
GeometryGUI_CircleDlg::GeometryGUI_CircleDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CIRCLE_PV")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_CircleDlg" );
resize( 303, 251 );
setCaption( tr( "GEOM_CIRCLE_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_CircleDlgLayout = new QGridLayout( this );
GeometryGUI_CircleDlgLayout->setSpacing( 6 );
GeometryGUI_CircleDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_CIRCLE" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_CircleDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_CENTER_POINT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
SelectButtonC1A2->setText( tr( "" ) );
SelectButtonC1A2->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
TextLabelC1A3->setText( tr( "GEOM_RADIUS" ) );
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ;
GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 );
GeometryGUI_CircleDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
GeometryGUI_CircleDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_CircleDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_CircleDlg::~GeometryGUI_CircleDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_CircleDlg::Init( SALOME_Selection* Sel )
{
double step ;
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
step = St.toDouble() ;
/* min, max, step and decimals for spin boxes */
SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
SpinBox_C1A3->SetValue( 100.0 ) ; /* = myRadius */
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myRadius = 100.0 ;
myOkPoint1 = myOkDir = false ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom );
myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
mySelection->AddFilter(myVertexFilter) ; /* first filter used */
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_CircleDlg::ConstructorsClicked(int constructorId)
{
/* only a constructor now */
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_CircleDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_CircleDlg::ClickOnApply()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
switch(myConstructorId)
{
case 0 :
{
if(myOkPoint1 && myOkDir) {
myGeomGUI->MakeCircleAndDisplay( myPoint1, myDir, myRadius) ;
}
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_CircleDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_CircleDlg::SelectionIntoArgument()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
/* Future name of selection */
QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
if ( myEditCurrentArgument == LineEditC1A1 ) {
LineEditC1A1->setText("") ;
myOkPoint1 = false ;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
LineEditC1A2->setText("") ;
myOkDir = false ;
}
return ;
}
/* nbSel == 1 */
TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
/* gp_Pnt : not used */
if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
LineEditC1A1->setText(aString) ;
myOkPoint1 = true ;
}
else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir) */) {
BRepAdaptor_Curve curv(TopoDS::Edge(S));
myDir = curv.Line().Direction();
LineEditC1A2->setText(aString) ;
myOkDir = true ;
}
if( myOkPoint1 && myOkDir ) {
MakeCircleSimulationAndDisplay() ;
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_CircleDlg::SetEditCurrentArgument()
{
mySelection->ClearFilters() ;
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
mySelection->AddFilter(myVertexFilter) ;
}
else if(send == SelectButtonC1A2) {
LineEditC1A2->setFocus() ;
myEditCurrentArgument = LineEditC1A2;
mySelection->AddFilter(myEdgeFilter) ;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_CircleDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else if ( send == LineEditC1A2 )
myEditCurrentArgument = LineEditC1A2 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void GeometryGUI_CircleDlg::ValueChangedInSpinBox( double newValue )
{
myRadius = newValue ;
if (myOkPoint1 && myOkDir) {
MakeCircleSimulationAndDisplay() ;
}
else {
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_CircleDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
mySelection->ClearFilters() ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_CircleDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_CircleDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_CircleDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ; /* same than click on cancel button */
}
//=================================================================================
// function : MakeCircleSimulationAndDisplay()
// purpose :
//=================================================================================
void GeometryGUI_CircleDlg::MakeCircleSimulationAndDisplay()
{
myGeomGUI->EraseSimulationShape() ;
try {
gp_Ax2 axis( this->myPoint1, this->myDir ) ;
gp_Circ circ( axis, this->myRadius);
BRepBuilderAPI_MakeEdge MakeEdge( circ );
mySimulationTopoDs = MakeEdge.Shape();
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
}
catch(Standard_Failure) {
MESSAGE( "Exception catched in MakeCircleSimulationAndDisplay" ) ;
}
return ;
}

View File

@ -1,126 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CircleDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_CIRCLE_H
#define DIALOGBOX_CIRCLE_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include "GEOM_EdgeFilter.hxx"
#include "GeometryGUI_SpinBox.h"
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_CircleDlg
// purpose :
//=================================================================================
class GeometryGUI_CircleDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_CircleDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_CircleDlg();
private :
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
gp_Pnt myPoint1 ;
gp_Dir myDir ;
Standard_Real myRadius ;
bool myOkPoint1 ;
bool myOkDir ;
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
int myConstructorId ; /* Current constructor id = radio button id */
Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */
Handle(GEOM_EdgeFilter) myEdgeFilter;
void closeEvent( QCloseEvent* e ) ;
void enterEvent( QEvent* e);
void Init( SALOME_Selection* Sel ) ;
void MakeCircleSimulationAndDisplay() ;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QGroupBox* GroupC1;
QPushButton* SelectButtonC1A2;
QLineEdit* LineEditC1A1;
QPushButton* SelectButtonC1A1;
QLabel* TextLabelC1A2;
QLineEdit* LineEditC1A2;
QLabel* TextLabelC1A1;
QLabel* TextLabelC1A3;
GeometryGUI_SpinBox* SpinBox_C1A3;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void LineEditReturnPressed() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
void ValueChangedInSpinBox( double newValue ) ;
protected:
QGridLayout* GeometryGUI_CircleDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
};
#endif // DIALOGBOX_CIRCLE_H

View File

@ -1,253 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CommonDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_CommonDlg.h"
#include "GeometryGUI.h"
#include "QAD_Desktop.h"
//=================================================================================
// class : GeometryGUI_CommonDlg()
// purpose : Constructs a GeometryGUI_CommonDlg 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.
//=================================================================================
GeometryGUI_CommonDlg::GeometryGUI_CommonDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
:GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_COMMON")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
setCaption(tr("GEOM_COMMON_TITLE"));
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_COMMON"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
GroupCommon = new GeometryGUI_2Sel_QTD(this, "GroupCommon");
GroupCommon->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupCommon->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
GroupCommon->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
GroupCommon->PushButton1->setPixmap(image1);
GroupCommon->PushButton2->setPixmap(image1);
Layout1->addWidget(GroupCommon, 1, 0);
/***************************************************************/
/* Initialisation */
myBooleanGUI = theBooleanGUI;
Init();
}
//=================================================================================
// function : ~GeometryGUI_CommonDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_CommonDlg::~GeometryGUI_CommonDlg()
{
/* no need to delete child widgets, Qt does it all for us */
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_CommonDlg::Init()
{
/* init variables */
myEditCurrentArgument = GroupCommon->LineEdit1;
myShape1.Nullify();
myShape2.Nullify();
myOkShape1 = myOkShape2 = false;
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupCommon->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupCommon->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupCommon->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupCommon->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* displays Dialog */
GroupCommon->show();
this->show();
return;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_CommonDlg::ClickOnOk()
{
this->ClickOnApply();
ClickOnCancel();
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_CommonDlg::ClickOnApply()
{
myGeomGUI->GetDesktop()->putInfo(tr(""));
if(myOkShape1 && myOkShape2)
myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 1);
return;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void GeometryGUI_CommonDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) {
if(myEditCurrentArgument == GroupCommon->LineEdit1)
myOkShape1 = false;
else if( myEditCurrentArgument == GroupCommon->LineEdit2)
myOkShape2 = false;
return;
}
/* nbSel == 1 */
TopoDS_Shape S;
Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
return;
if(myEditCurrentArgument == GroupCommon->LineEdit1) {
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
if(!testResult)
return;
myShape1 = S;
GroupCommon->LineEdit1->setText(aString);
myOkShape1 = true;
}
else if(myEditCurrentArgument == GroupCommon->LineEdit2) {
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
if(!testResult)
return;
myShape2 = S;
GroupCommon->LineEdit2->setText(aString);
myOkShape2 = true;
}
return;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_CommonDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
if(send == GroupCommon->PushButton1) {
GroupCommon->LineEdit1->setFocus();
myEditCurrentArgument = GroupCommon->LineEdit1;
}
else if(send == GroupCommon->PushButton2) {
GroupCommon->LineEdit2->setFocus();
myEditCurrentArgument = GroupCommon->LineEdit2;
}
SelectionIntoArgument();
return;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_CommonDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if(send == GroupCommon->LineEdit1)
myEditCurrentArgument = GroupCommon->LineEdit1;
else if(send == GroupCommon->LineEdit2)
myEditCurrentArgument = GroupCommon->LineEdit2;
else
return;
GeometryGUI_Skeleton::LineEditReturnPressed();
return;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_CommonDlg::ActivateThisDialog()
{
GeometryGUI_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
return;
}
//=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
void GeometryGUI_CommonDlg::enterEvent(QEvent * e)
{
if (GroupConstructors->isEnabled())
return;
this->ActivateThisDialog();
return;
}

View File

@ -1,76 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CommonDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_COMMON_H
#define DIALOGBOX_COMMON_H
#include "GeometryGUI_Skeleton.h"
#include "GeometryGUI_2Sel_QTD.h"
#include "BooleanGUI.h"
#include <BRepAlgoAPI_Common.hxx>
//=================================================================================
// class : GeometryGUI_CommonDlg
// purpose :
//=================================================================================
class GeometryGUI_CommonDlg : public GeometryGUI_Skeleton
{
Q_OBJECT
public:
GeometryGUI_CommonDlg(QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_CommonDlg();
private:
void Init();
void enterEvent(QEvent * e);
BooleanGUI* myBooleanGUI;
TopoDS_Shape myShape1; /* topology used */
TopoDS_Shape myShape2; /* topology used */
GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
bool myOkShape1;
bool myOkShape2; /* to check when arguments are defined */
GeometryGUI_2Sel_QTD* GroupCommon;
private slots:
void ClickOnOk();
void ClickOnApply();
void SetEditCurrentArgument();
void SelectionIntoArgument();
void LineEditReturnPressed();
void ActivateThisDialog();
};
#endif // DIALOGBOX_COMMON_H

View File

@ -1,375 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CompoundDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_CompoundDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_CompoundDlg()
// purpose : Constructs a GeometryGUI_CompoundDlg 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.
//=================================================================================
GeometryGUI_CompoundDlg::GeometryGUI_CompoundDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BUILD_COMPOUND")));
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_CompoundDlg" );
resize( 303, 175 );
setCaption( tr( "GEOM_COMPOUND_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_CompoundDlgLayout = new QGridLayout( this );
GeometryGUI_CompoundDlgLayout->setSpacing( 6 );
GeometryGUI_CompoundDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_COMPOUND" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image1 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_CompoundDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_CompoundDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image0 );
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
GeometryGUI_CompoundDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_CompoundDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_CompoundDlg::~GeometryGUI_CompoundDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_CompoundDlg::Init( SALOME_Selection* Sel )
{
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
this->myOkListShapes = false ;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_CompoundDlg::ConstructorsClicked(int constructorId)
{
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_CompoundDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_CompoundDlg::ClickOnApply()
{
switch(myConstructorId)
{
case 0 :
{
if(myOkListShapes) {
myGeomGUI->MakeCompoundAndDisplay( myListShapes ) ;
}
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_CompoundDlg::ClickOnCancel()
{
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_CompoundDlg::SelectionIntoArgument()
{
/* All this for first constructor */
// if(myEditCurrentArgument == LineEditC1A1 )
myOkListShapes = false;
myEditCurrentArgument->setText("") ;
QString aString = ""; /* name of selection */
int nbSel = mySelection->IObjectCount() ;
if ( nbSel == 0 )
return;
aString = tr( "%1_objects" ).arg( nbSel );
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ;
myEditCurrentArgument->setText(aString) ;
myOkListShapes = true ;
/* no simulation */
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_CompoundDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_CompoundDlg::LineEditReturnPressed()
{
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_CompoundDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_CompoundDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_CompoundDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_CompoundDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}

View File

@ -1,106 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CompoundDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_COMPOUND_H
#define DIALOGBOX_COMPOUND_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_CompoundDlg
// purpose :
//=================================================================================
class GeometryGUI_CompoundDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_CompoundDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_CompoundDlg();
private:
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
GEOM::GEOM_Gen::ListOfIOR myListShapes ;
bool myOkListShapes ; /* to check when arguments is defined */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QGroupBox* GroupC1;
QLabel* TextLabelC1A1;
QPushButton* SelectButtonC1A1;
QLineEdit* LineEditC1A1;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void LineEditReturnPressed() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_CompoundDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
};
#endif // DIALOGBOX_COMPOUND_H

View File

@ -1,434 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_ConeDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_ConeDlg.h"
#include <BRepPrimAPI_MakeCone.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepAdaptor_Curve.hxx>
#include "GeometryGUI.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
//=================================================================================
// class : GeometryGUI_ConeDlg()
// purpose : Constructs a GeometryGUI_ConeDlg 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.
//=================================================================================
GeometryGUI_ConeDlg::GeometryGUI_ConeDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
:GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CONE_PV")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CONE_DXYZ")));
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
setCaption(tr("GEOM_CONE_TITLE"));
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_CONE"));
RadioButton1->setPixmap(image0);
RadioButton2->setPixmap(image1);
RadioButton3->close(TRUE);
GroupPoints = new GeometryGUI_2Sel3Spin(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1"));
GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2"));
GroupPoints->TextLabel5->setText(tr("GEOM_HEIGHT"));
GroupPoints->PushButton1->setPixmap(image2);
GroupPoints->PushButton2->setPixmap(image2);
GroupDimensions = new GeometryGUI_3Spin(this, "GroupDimensions");
GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1"));
GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2"));
GroupDimensions->TextLabel3->setText(tr("GEOM_HEIGHT"));
Layout1->addWidget(GroupPoints, 1, 0);
Layout1->addWidget(GroupDimensions, 1, 0);
/***************************************************************/
/* Initialisations */
myPrimitiveGUI = thePrimitiveGUI;
Init();
}
//=================================================================================
// function : ~GeometryGUI_ConeDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_ConeDlg::~GeometryGUI_ConeDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::Init()
{
/* init variables */
myConstructorId = 0;
myEditCurrentArgument = GroupPoints->LineEdit1;
myRadius1 = 100.0;
myRadius2 = 0.0;
myHeight = 300.0;
myOkRadius1 = myOkRadius2 = myOkHeight = true;
myOkPoint1 = myOkDir = false;
myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom);
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
mySelection->AddFilter(myVertexFilter);
/* Get setting of step value from file configuration */
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
step = St.toDouble();
/* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3);
GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
GroupPoints->SpinBox_DX->SetValue(myRadius1);
GroupPoints->SpinBox_DY->SetValue(myRadius2);
GroupPoints->SpinBox_DZ->SetValue(myHeight);
GroupDimensions->SpinBox_DX->SetValue(myRadius1);
GroupDimensions->SpinBox_DY->SetValue(myRadius2);
GroupDimensions->SpinBox_DZ->SetValue(myHeight);
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupPoints->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
/* displays Dialog */
GroupDimensions->hide();
GroupPoints->show();
this->show();
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_ConeDlg::ConstructorsClicked(int constructorId)
{
myConstructorId = constructorId;
mySelection->ClearFilters();
myGeomGUI->EraseSimulationShape();
disconnect(mySelection, 0, this, 0);
myOkHeight = myOkRadius1 = myOkRadius2 = true;
myRadius1 = 100.0;
myRadius2 = 0.0;
myHeight = 300.0;
switch(myConstructorId)
{
case 0 :
{
GroupDimensions->hide();
resize(0, 0);
GroupPoints->show();
myOkPoint1 = myOkDir = false;
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText(tr(""));
GroupPoints->LineEdit2->setText(tr(""));
GroupPoints->SpinBox_DX->SetValue(myRadius1);
GroupPoints->SpinBox_DY->SetValue(myRadius2);
GroupPoints->SpinBox_DZ->SetValue(myHeight);
/* filter for next selection */
mySelection->AddFilter(myVertexFilter);
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
case 1 :
{
GroupPoints->hide();
resize( 0, 0 );
GroupDimensions->show();
myOkPoint1 = myOkDir = true;
GroupDimensions->SpinBox_DX->SetValue(myRadius1);
GroupDimensions->SpinBox_DY->SetValue(myRadius2);
GroupDimensions->SpinBox_DZ->SetValue(myHeight);
myPoint1.SetCoord(0.0, 0.0, 0.0);
myDir.SetCoord(0.0, 0.0, 1.0);
MakeConeSimulationAndDisplay();
break;
}
}
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::ClickOnOk()
{
this->ClickOnApply();
ClickOnCancel();
return;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::ClickOnApply()
{
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify();
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) {
gp_Dir aDir = myDir;
/* allows user to reverse direction of construction with a negative height */
if(this->myHeight < -Precision::Confusion())
aDir.Reverse();
myPrimitiveGUI->MakeConeAndDisplay(myPoint1, aDir, myRadius1, myRadius2, fabs(myHeight));
}
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_ConeDlg::SelectionIntoArgument()
{
myGeomGUI->EraseSimulationShape();
myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkPoint1 = false;
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myOkDir = false;
return;
}
/* nbSel == 1 */
TopoDS_Shape S;
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
return;
/* gp_Pnt : not used */
if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
GroupPoints->LineEdit1->setText(aString);
myOkPoint1 = true;
}
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
BRepAdaptor_Curve curv(TopoDS::Edge(S));
myDir = curv.Line().Direction();
GroupPoints->LineEdit2->setText(aString);
myOkDir = true;
}
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight)
MakeConeSimulationAndDisplay();
return;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::SetEditCurrentArgument()
{
if(myConstructorId != 0)
return;
QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
mySelection->AddFilter(myVertexFilter);
}
else if(send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
mySelection->AddFilter(myEdgeFilter);
}
this->SelectionIntoArgument();
return;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1)
myEditCurrentArgument = GroupPoints->LineEdit1;
else if (send == GroupPoints->LineEdit2)
myEditCurrentArgument = GroupPoints->LineEdit2;
else
return;
GeometryGUI_Skeleton::LineEditReturnPressed();
return;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::ActivateThisDialog()
{
GeometryGUI_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::enterEvent(QEvent* e)
{
if (GroupConstructors->isEnabled())
return;
this->ActivateThisDialog();
return;
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::ValueChangedInSpinBox(double newValue)
{
myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify();
QObject* send = (QObject*)sender();
if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DX) {
myRadius1 = newValue;
myOkRadius1 = true;
}
else if(send == GroupPoints->SpinBox_DY || send == GroupDimensions->SpinBox_DY) {
myRadius2 = newValue;
myOkRadius2 = true;
}
else if(send == GroupPoints->SpinBox_DZ || send == GroupDimensions->SpinBox_DZ) {
myHeight = newValue;
myOkHeight = true;
}
if (myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight)
MakeConeSimulationAndDisplay();
return;
}
//=================================================================================
// function : MakeConeSimulationAndDisplay()
// purpose :
//=================================================================================
void GeometryGUI_ConeDlg::MakeConeSimulationAndDisplay()
{
myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify();
gp_Dir aDir = myDir;
try {
/* allows user to reverse direction of construction with a negative height */
if(this->myHeight < -Precision::Confusion())
aDir.Reverse();
gp_Ax2 anAxis(this->myPoint1, aDir);
if(fabs(myRadius1 - myRadius2) <= Precision::Confusion())
mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, (myRadius1+myRadius2)/2.0, fabs(myHeight)).Shape();
else {
if(fabs(myHeight) > Precision::Confusion())
mySimulationTopoDs = BRepPrimAPI_MakeCone(anAxis, myRadius1, myRadius2, fabs(myHeight)).Shape();
}
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
}
catch(Standard_Failure) {
MESSAGE("Exception catched in MakeConeSimulationAndDisplay");
}
return;
}

View File

@ -1,94 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_ConeDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_CONE_H
#define DIALOGBOX_CONE_H
#include "GeometryGUI_Skeleton.h"
#include "GeometryGUI_2Sel3Spin.h"
#include "GeometryGUI_3Spin.h"
#include "PrimitiveGUI.h"
#include "GEOM_EdgeFilter.hxx"
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
//=================================================================================
// class : GeometryGUI_ConeDlg
// purpose :
//=================================================================================
class GeometryGUI_ConeDlg : public GeometryGUI_Skeleton
{
Q_OBJECT
public:
GeometryGUI_ConeDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_ConeDlg();
private:
void Init();
void enterEvent(QEvent* e);
void MakeConeSimulationAndDisplay();
PrimitiveGUI* myPrimitiveGUI;
double step;
int myConstructorId;
Handle(GEOM_ShapeTypeFilter) myVertexFilter;
Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
gp_Pnt myPoint1; /* topology used */
gp_Dir myDir;
bool myOkPoint1; /* to check when arguments is defined */
bool myOkDir;
Standard_Real myRadius1;
Standard_Real myRadius2;
Standard_Real myHeight;
bool myOkRadius1;
bool myOkRadius2;
bool myOkHeight;
GeometryGUI_2Sel3Spin* GroupPoints;
GeometryGUI_3Spin* GroupDimensions;
private slots:
void ClickOnOk();
void ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ConstructorsClicked(int constructorId);
void ValueChangedInSpinBox(double newValue);
};
#endif // DIALOGBOX_CONE_H

View File

@ -1,251 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CutDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_CutDlg.h"
#include "GeometryGUI.h"
#include "QAD_Desktop.h"
//=================================================================================
// class : GeometryGUI_CutDlg()
// purpose : Constructs a GeometryGUI_CutDlg 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.
//=================================================================================
GeometryGUI_CutDlg::GeometryGUI_CutDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
:GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CUT")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
setCaption(tr("GEOM_CUT_TITLE"));
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_CUT"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
GroupCut = new GeometryGUI_2Sel_QTD(this, "GroupCut");
GroupCut->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupCut->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
GroupCut->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
GroupCut->PushButton1->setPixmap(image1);
GroupCut->PushButton2->setPixmap(image1);
Layout1->addWidget(GroupCut, 1, 0);
/***************************************************************/
/* Initialisation */
myBooleanGUI = theBooleanGUI;
Init();
}
//=================================================================================
// function : ~GeometryGUI_CutDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_CutDlg::~GeometryGUI_CutDlg()
{
/* no need to delete child widgets, Qt does it all for us */
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_CutDlg::Init()
{
/* init variables */
myEditCurrentArgument = GroupCut->LineEdit1;
myShape1.Nullify();
myShape2.Nullify();
myOkShape1 = myOkShape2 = false;
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupCut->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupCut->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupCut->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupCut->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* displays Dialog */
GroupCut->show();
this->show();
return;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_CutDlg::ClickOnOk()
{
this->ClickOnApply();
ClickOnCancel();
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_CutDlg::ClickOnApply()
{
myGeomGUI->GetDesktop()->putInfo(tr(""));
if(myOkShape1 && myOkShape2)
myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 2);
return;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void GeometryGUI_CutDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) {
if(myEditCurrentArgument == GroupCut->LineEdit1)
myOkShape1 = false;
else if( myEditCurrentArgument == GroupCut->LineEdit2)
myOkShape2 = false;
return;
}
/* nbSel == 1 */
TopoDS_Shape S;
Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
return;
if(myEditCurrentArgument == GroupCut->LineEdit1) {
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
if(!testResult)
return;
myShape1 = S;
GroupCut->LineEdit1->setText(aString);
myOkShape1 = true;
}
else if(myEditCurrentArgument == GroupCut->LineEdit2) {
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
if(!testResult)
return;
myShape2 = S;
GroupCut->LineEdit2->setText(aString);
myOkShape2 = true;
}
return;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_CutDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
if(send == GroupCut->PushButton1) {
GroupCut->LineEdit1->setFocus();
myEditCurrentArgument = GroupCut->LineEdit1;
}
else if(send == GroupCut->PushButton2) {
GroupCut->LineEdit2->setFocus();
myEditCurrentArgument = GroupCut->LineEdit2;
}
SelectionIntoArgument();
return;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_CutDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if(send == GroupCut->LineEdit1)
myEditCurrentArgument = GroupCut->LineEdit1;
else if(send == GroupCut->LineEdit2)
myEditCurrentArgument = GroupCut->LineEdit2;
else
return;
GeometryGUI_Skeleton::LineEditReturnPressed();
return;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_CutDlg::ActivateThisDialog()
{
GeometryGUI_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
return;
}
//=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
void GeometryGUI_CutDlg::enterEvent(QEvent * e)
{
if(GroupConstructors->isEnabled())
return;
this->ActivateThisDialog();
return;
}

View File

@ -1,76 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CutDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_CUT_H
#define DIALOGBOX_CUT_H
#include "GeometryGUI_Skeleton.h"
#include "GeometryGUI_2Sel_QTD.h"
#include "BooleanGUI.h"
#include <BRepAlgoAPI_Cut.hxx>
//=================================================================================
// class : GeometryGUI_CutDlg
// purpose :
//=================================================================================
class GeometryGUI_CutDlg : public GeometryGUI_Skeleton
{
Q_OBJECT
public:
GeometryGUI_CutDlg( QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_CutDlg();
private:
void Init();
void enterEvent(QEvent* e);
BooleanGUI* myBooleanGUI;
TopoDS_Shape myShape1; /* topology used to fuse */
TopoDS_Shape myShape2; /* topology used to fuse */
GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
bool myOkShape1; /* to check when arguments are defined */
bool myOkShape2;
GeometryGUI_2Sel_QTD* GroupCut;
private slots:
void ClickOnOk();
void ClickOnApply();
void SetEditCurrentArgument();
void SelectionIntoArgument();
void LineEditReturnPressed();
void ActivateThisDialog();
};
#endif // DIALOGBOX_CUT_H

View File

@ -1,415 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CylinderDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_CylinderDlg.h"
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepAdaptor_Curve.hxx>
#include "GeometryGUI.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
//=================================================================================
// class : GeometryGUI_CylinderDlg()
// purpose : Constructs a GeometryGUI_CylinderDlg 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.
//=================================================================================
GeometryGUI_CylinderDlg::GeometryGUI_CylinderDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
:GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_PV")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_DXYZ")));
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
setCaption(tr("GEOM_CYLINDER_TITLE"));
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_CYLINDER"));
RadioButton1->setPixmap(image0);
RadioButton2->setPixmap(image1);
RadioButton3->close(TRUE);
GroupPoints = new GeometryGUI_2Sel2Spin(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT"));
GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS"));
GroupPoints->TextLabel4->setText(tr("GEOM_HEIGHT"));
GroupPoints->PushButton1->setPixmap(image2);
GroupPoints->PushButton2->setPixmap(image2);
GroupDimensions = new GeometryGUI_2Spin(this, "GroupDimensions");
GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
GroupDimensions->TextLabel1->setText(tr("GEOM_HEIGHT"));
GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS"));
Layout1->addWidget(GroupPoints, 1, 0);
Layout1->addWidget(GroupDimensions, 1, 0);
/***************************************************************/
/* Initialisations */
myPrimitiveGUI = thePrimitiveGUI;
Init();
}
//=================================================================================
// function : ~GeometryGUI_CylinderDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_CylinderDlg::~GeometryGUI_CylinderDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::Init()
{
/* init variables */
myConstructorId = 0;
myEditCurrentArgument = GroupPoints->LineEdit1;
myRadius = 100.0;
myHeight = 300.0;
myOkRadius = myOkHeight = true;
myOkPoint1 = myOkDir = false;
myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom);
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
mySelection->AddFilter(myVertexFilter);
/* Get setting of step value from file configuration */
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
step = St.toDouble();
/* min, max, step and decimals for spin boxes & initial values */
/* First constructor : radius */
GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
/* First constructor : algebric height */
GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
/* Second constructor : radius */
GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3);
/* Second constructor : algebric height */
GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
GroupPoints->SpinBox_DX->SetValue(myRadius);
GroupPoints->SpinBox_DY->SetValue(myHeight);
GroupDimensions->SpinBox_DX->SetValue(myRadius);
GroupDimensions->SpinBox_DY->SetValue(myHeight);
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
/* displays Dialog */
GroupDimensions->hide();
GroupPoints->show();
this->show();
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_CylinderDlg::ConstructorsClicked(int constructorId)
{
myConstructorId = constructorId;
mySelection->ClearFilters();
myGeomGUI->EraseSimulationShape();
disconnect(mySelection, 0, this, 0);
myOkHeight = myOkRadius = true;
myRadius = 100.0;
myHeight = 300.0;
switch(myConstructorId)
{
case 0 :
{
GroupDimensions->hide();
resize(0, 0);
GroupPoints->show();
myOkPoint1 = myOkDir = false;
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText(tr(""));
GroupPoints->LineEdit2->setText(tr(""));
GroupPoints->SpinBox_DX->SetValue(myRadius);
GroupPoints->SpinBox_DY->SetValue(myHeight);
/* filter for next selection */
mySelection->AddFilter(myVertexFilter);
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break;
}
case 1 :
{
GroupPoints->hide();
resize( 0, 0 );
GroupDimensions->show();
myOkPoint1 = myOkDir = true;
GroupDimensions->SpinBox_DX->SetValue(myRadius);
GroupDimensions->SpinBox_DY->SetValue(myHeight);
myPoint1.SetCoord(0.0, 0.0, 0.0);
myDir.SetCoord(0.0, 0.0, 1.0);
MakeCylinderSimulationAndDisplay();
break;
}
}
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::ClickOnOk()
{
this->ClickOnApply();
ClickOnCancel();
return;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::ClickOnApply()
{
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify();
if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight) {
gp_Dir aDir = myDir;
/* allows user to reverse direction of construction with a negative height */
if(this->myHeight < -Precision::Confusion())
aDir.Reverse();
myPrimitiveGUI->MakeCylinderAndDisplay(myPoint1, aDir, myRadius, fabs(myHeight));
}
return;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_CylinderDlg::SelectionIntoArgument()
{
myGeomGUI->EraseSimulationShape();
myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkPoint1 = false;
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myOkDir = false;
return;
}
/* nbSel == 1 */
TopoDS_Shape S;
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
return;
/* gp_Pnt : not used */
if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
GroupPoints->LineEdit1->setText(aString);
myOkPoint1 = true;
}
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
BRepAdaptor_Curve curv(TopoDS::Edge(S));
myDir = curv.Line().Direction();
GroupPoints->LineEdit2->setText(aString);
myOkDir = true;
}
if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight)
MakeCylinderSimulationAndDisplay();
return;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::SetEditCurrentArgument()
{
if(myConstructorId != 0)
return;
QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) {
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
mySelection->AddFilter(myVertexFilter);
}
else if(send == GroupPoints->PushButton2) {
GroupPoints->LineEdit2->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit2;
mySelection->AddFilter(myEdgeFilter);
}
this->SelectionIntoArgument();
return;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1)
myEditCurrentArgument = GroupPoints->LineEdit1;
else if (send == GroupPoints->LineEdit2)
myEditCurrentArgument = GroupPoints->LineEdit2;
else
return;
GeometryGUI_Skeleton::LineEditReturnPressed();
return;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::ActivateThisDialog()
{
GeometryGUI_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::enterEvent(QEvent* e)
{
if (GroupConstructors->isEnabled())
return;
this->ActivateThisDialog();
return;
}
//=================================================================================
// function : ValueChangedInSpinBox
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::ValueChangedInSpinBox( double newValue )
{
myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify();
QObject* send = (QObject*)sender();
/* radius */
if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DX) {
myRadius = newValue;
myOkRadius = true;
} /* algebric height */
else if(send == GroupPoints->SpinBox_DY || send == GroupDimensions->SpinBox_DY) {
myHeight = newValue;
myOkHeight = true;
}
if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight)
MakeCylinderSimulationAndDisplay();
return;
}
//=================================================================================
// function : MakeCylinderSimulationAndDisplay()
// purpose :
//=================================================================================
void GeometryGUI_CylinderDlg::MakeCylinderSimulationAndDisplay()
{
myGeomGUI->EraseSimulationShape();
mySimulationTopoDs.Nullify();
gp_Dir aDir = this->myDir;
try {
/* allows user to reverse direction of construction with a negative height */
if(this->myHeight < -Precision::Confusion())
aDir.Reverse();
gp_Ax2 anAxis(this->myPoint1, aDir);
mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, this->myRadius, fabs(myHeight)).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
}
catch(Standard_Failure) {
MESSAGE("Exception catched in MakeCylinderSimulationAndDisplay");
}
return;
}

View File

@ -1,92 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_CylinderDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_CYLINDER_H
#define DIALOGBOX_CYLINDER_H
#include "GeometryGUI_Skeleton.h"
#include "GeometryGUI_2Sel2Spin.h"
#include "GeometryGUI_2Spin.h"
#include "PrimitiveGUI.h"
#include "GEOM_EdgeFilter.hxx"
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
//=================================================================================
// class : GeometryGUI_CylinderDlg
// purpose :
//=================================================================================
class GeometryGUI_CylinderDlg : public GeometryGUI_Skeleton
{
Q_OBJECT
public:
GeometryGUI_CylinderDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_CylinderDlg();
private:
void Init();
void enterEvent(QEvent* e);
void MakeCylinderSimulationAndDisplay();
PrimitiveGUI* myPrimitiveGUI;
double step;
int myConstructorId;
Handle(GEOM_ShapeTypeFilter) myVertexFilter;
Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
gp_Pnt myPoint1; /* topology used */
gp_Dir myDir;
bool myOkPoint1; /* to check when arguments is defined */
bool myOkDir;
Standard_Real myRadius;
Standard_Real myHeight;
bool myOkRadius;
bool myOkHeight;
GeometryGUI_2Sel2Spin* GroupPoints;
GeometryGUI_2Spin* GroupDimensions;
private slots:
void ClickOnOk();
void ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ConstructorsClicked(int constructorId);
void ValueChangedInSpinBox(double newValue);
};
#endif // DIALOGBOX_CYLINDER_H

View File

@ -1,589 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_DistanceDlg.cxx
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_DistanceDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_RightFrame.h"
#include "utilities.h"
#include "OCCViewer_Viewer3d.h"
#include "OCCViewer_ViewFrame.h"
// Open CASCADE Includes
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
// QT Includes
#include <qmessagebox.h>
#include <qbuttongroup.h>
#include <qframe.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qevent.h>
//=================================================================================
// class : GeometryGUI_DistanceDlg()
// purpose : Constructs a GeometryGUI_DistanceDlg 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.
//=================================================================================
GeometryGUI_DistanceDlg::GeometryGUI_DistanceDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MINDIST")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_DistanceDlg" );
resize( 322, 220 );
setCaption( tr( "GEOM_MINDIST_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_DistanceDlgLayout = new QGridLayout( this );
GeometryGUI_DistanceDlgLayout->setSpacing( 6 );
GeometryGUI_DistanceDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_DISTANCE" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
GeometryGUI_DistanceDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
GroupConstructor1->setTitle( tr( "GEOM_MINDIST_OBJ" ) );
GroupConstructor1->setColumnLayout(0, Qt::Vertical );
GroupConstructor1->layout()->setSpacing( 0 );
GroupConstructor1->layout()->setMargin( 0 );
GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
GroupConstructor1Layout->setAlignment( Qt::AlignTop );
GroupConstructor1Layout->setSpacing( 6 );
GroupConstructor1Layout->setMargin( 11 );
LineEditC1A2Shape = new QLineEdit( GroupConstructor1, "LineEditC1A2Shape" );
LineEditC1A2Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Shape->sizePolicy().hasHeightForWidth() ) );
GroupConstructor1Layout->addWidget( LineEditC1A2Shape, 1, 2 );
LineEditC1A1Shape = new QLineEdit( GroupConstructor1, "LineEditC1A1Shape" );
LineEditC1A1Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Shape->sizePolicy().hasHeightForWidth() ) );
GroupConstructor1Layout->addWidget( LineEditC1A1Shape, 0, 2 );
SelectButtonC1A1Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A1Shape" );
SelectButtonC1A1Shape->setText( tr( "" ) );
SelectButtonC1A1Shape->setPixmap( image1 );
GroupConstructor1Layout->addWidget( SelectButtonC1A1Shape, 0, 1 );
SelectButtonC1A2Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A2Shape" );
SelectButtonC1A2Shape->setText( tr( "" ) );
SelectButtonC1A2Shape->setPixmap( image1 );
GroupConstructor1Layout->addWidget( SelectButtonC1A2Shape, 1, 1 );
TextLabelC1A2Shape = new QLabel( GroupConstructor1, "TextLabelC1A2Shape" );
TextLabelC1A2Shape->setText( tr( "GEOM_OBJECT_I" ).arg("2") );
TextLabelC1A2Shape->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2Shape->setFrameShape( QLabel::NoFrame );
TextLabelC1A2Shape->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabelC1A2Shape, 1, 0 );
TextLabelC1A1Shape = new QLabel( GroupConstructor1, "TextLabelC1A1Shape" );
TextLabelC1A1Shape->setText( tr( "GEOM_OBJECT_I" ).arg("1") );
TextLabelC1A1Shape->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1Shape->setFrameShape( QLabel::NoFrame );
TextLabelC1A1Shape->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabelC1A1Shape, 0, 0 );
GeometryGUI_DistanceDlgLayout->addWidget( GroupConstructor1, 1, 0 );
TextLabel_Length = new QLabel( GroupConstructor1, "TextLabel_Length" );
TextLabel_Length->setText( tr( "GEOM_LENGTH" ) );
TextLabel_Length->setMinimumSize( QSize( 50, 0 ) );
TextLabel_Length->setFrameShape( QLabel::NoFrame );
TextLabel_Length->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabel_Length, 2, 0 );
LineEdit_Length = new QLineEdit( GroupConstructor1, "LineEdit_Length" );
LineEdit_Length->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Length->sizePolicy().hasHeightForWidth() ) );
// LineEdit_Length->setEnabled( FALSE );
LineEdit_Length->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_Length, 2, 2 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_DistanceDlgLayout->addWidget( GroupButtons, 2, 0 );
/* Initialisation */
Init( Sel ) ;
}
//=================================================================================
// function : ~GeometryGUI_DistanceDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_DistanceDlg::~GeometryGUI_DistanceDlg()
{
/* no need to delete child widgets, Qt does it all for us */
this->destroy(TRUE, TRUE) ;
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_DistanceDlg::Init( SALOME_Selection* Sel )
{
mySelection = Sel ;
myShape1.Nullify() ;
myShape2.Nullify() ;
myConstructorId = 0 ;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
GroupConstructor1->show();
myConstructorId = 0 ;
myEditCurrentArgument = LineEditC1A1Shape ;
Constructor1->setChecked( TRUE );
myOkShape1 = myOkShape2 = false ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
// TODO previous selection into argument ?
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* Displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_DistanceDlg::ConstructorsClicked(int constructorId)
{
EraseDistance();
myGeomGUI->EraseSimulationShape() ;
switch (constructorId)
{
case 0:
{
GroupConstructor1->show();
myConstructorId = constructorId ;
myEditCurrentArgument = LineEditC1A1Shape ;
LineEditC1A2Shape->setText(tr("")) ;
Constructor1->setChecked( TRUE );
myOkShape1 = myOkShape2 = false ;
break;
}
}
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_DistanceDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_DistanceDlg::ClickOnApply()
{
EraseDistance() ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
{
case 0 :
{
if(myOkShape1 && myOkShape2) {
this->MakeDistanceSimulationAndDisplay(myShape1 ,myShape2) ;
}
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_DistanceDlg::ClickOnCancel()
{
EraseDistance() ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void GeometryGUI_DistanceDlg::SelectionIntoArgument()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
LineEdit_Length->setText("") ;
myEditCurrentArgument->setText("") ; /* by default */
QString aString = ""; /* the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
switch (myConstructorId)
{
case 0:
{
if ( myEditCurrentArgument == LineEditC1A1Shape ) {
myOkShape1 = false ;
}
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
myOkShape2 = false ;
}
break ;
}
}
return ;
}
/* nbSel == 1 */
TopoDS_Shape S;
Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if ( myEditCurrentArgument == LineEditC1A1Shape ) {
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
myShape1 = S ;
LineEditC1A1Shape->setText(aString) ;
myOkShape1 = true ;
}
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
myShape2 = S ;
LineEditC1A2Shape->setText(aString) ;
myOkShape2 = true ;
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_DistanceDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if( send == SelectButtonC1A1Shape ) {
LineEditC1A1Shape->setFocus() ;
myEditCurrentArgument = LineEditC1A1Shape ;
}
else if(send == SelectButtonC1A2Shape) {
LineEditC1A2Shape->setFocus() ;
myEditCurrentArgument = LineEditC1A2Shape;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_DistanceDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1Shape )
myEditCurrentArgument = LineEditC1A1Shape ;
else if ( send == LineEditC1A2Shape )
myEditCurrentArgument = LineEditC1A2Shape ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_DistanceDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupConstructor1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
}
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_DistanceDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ; /* same than click on cancel button */
}
//=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
void GeometryGUI_DistanceDlg::enterEvent( QEvent * )
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_DistanceDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate any active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupConstructor1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
// function : MakeDistanceSimulationAndDisplay()
// purpose :
//=================================================================================
void GeometryGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape& S1, const TopoDS_Shape& S2)
{
LineEdit_Length->setText("") ;
EraseDistance() ;
myGeomGUI->EraseSimulationShape() ;
BRepExtrema_DistShapeShape dst( S1, S2 );
if (dst.IsDone()) {
int i;
for (i=1; i<= dst.NbSolution(); i++) {
gp_Pnt P1,P2;
P1 = (dst.PointOnShape1(i));
P2 = (dst.PointOnShape2(i));
Standard_Real Dist = P1.Distance(P2);
if (Dist<=1.e-9) {
BRepBuilderAPI_MakeVertex MakeVertex(P1);
mySimulationTopoDs = MakeVertex.Vertex();
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
LineEdit_Length->setText("0.0") ;
} else {
BRepBuilderAPI_MakeEdge MakeEdge(P1, P2);
mySimulationTopoDs = MakeEdge.Edge();
TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(P1);
TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(P2);
QString S;
S.sprintf("%.1f",Dist);
Handle(AIS_LengthDimension) Distance = new AIS_LengthDimension (V1,V2, new Geom_Plane (0.,0.,1.,0.),
Dist, TCollection_ExtendedString(strdup(S)));
LineEdit_Length->setText(S) ;
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
return ;
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
ic->Display( Distance );
ic->UpdateCurrentViewer();
}
}
} else
myGeomGUI->GetDesktop()->putInfo( tr( "GEOM_PRP_MIN_DIST" ) );
}
//=================================================================================
// function : EraseDistance()
// purpose :
//=================================================================================
void GeometryGUI_DistanceDlg::EraseDistance()
{
int count = myGeomGUI->GetActiveStudy()->getStudyFramesCount();
for ( int i = 0; i < count; i++ )
if (myGeomGUI->GetActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC ) {
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer();
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
AIS_ListOfInteractive L;
ic->DisplayedObjects(AIS_KOI_Relation,-1,L);
AIS_ListIteratorOfListOfInteractive ite(L);
while (ite.More()) {
ic->Remove( ite.Value() );
ic->UpdateCurrentViewer();
ite.Next();
}
}
}

View File

@ -1,125 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_DistanceDlg.h
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_DISTANCE_H
#define DIALOGBOX_DISTANCE_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <BRepExtrema_DistShapeShape.hxx>
#include <AIS_LengthDimension.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QFrame;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_DistanceDlg
// purpose :
//=================================================================================
class GeometryGUI_DistanceDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_DistanceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_DistanceDlg();
private:
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
void MakeDistanceSimulationAndDisplay( const TopoDS_Shape& S1, const TopoDS_Shape& S2 ) ;
void EraseDistance() ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape myShape1 ;
TopoDS_Shape myShape2 ;
GEOM::GEOM_Shape_var myGeomShape1 ;
GEOM::GEOM_Shape_var myGeomShape2 ;
bool myOkShape1 ;
bool myOkShape2 ; /* to check when arguments are defined */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupConstructor1;
QLineEdit* LineEditC1A1Shape;
QLineEdit* LineEditC1A2Shape;
QPushButton* SelectButtonC1A1Shape;
QPushButton* SelectButtonC1A2Shape;
QLabel* TextLabelC1A2Shape;
QLabel* TextLabelC1A1Shape;
QLabel* TextLabel_Length;
QLineEdit* LineEdit_Length;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void LineEditReturnPressed() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_DistanceDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructor1Layout;
};
#endif // DIALOGBOX_DISTANCE_H

View File

@ -1,462 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_EdgeDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_EdgeDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_EdgeDlg()
// purpose : Constructs a GeometryGUI_EdgeDlg 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.
//=================================================================================
GeometryGUI_EdgeDlg::GeometryGUI_EdgeDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BUILD_EDGE")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_EdgeDlg" );
resize( 303, 225 );
setCaption( tr( "GEOM_EDGE_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_EdgeDlgLayout = new QGridLayout( this );
GeometryGUI_EdgeDlgLayout->setSpacing( 6 );
GeometryGUI_EdgeDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_EDGE" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_EdgeDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_POINTS" ) );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
SelectButtonC1A2->setText( tr( "" ) );
SelectButtonC1A2->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_POINT_I" ).arg("1") );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_POINT_I" ).arg("2") );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
GeometryGUI_EdgeDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_EdgeDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_EdgeDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_EdgeDlg::~GeometryGUI_EdgeDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_EdgeDlg::Init( SALOME_Selection* Sel )
{
GroupC1->show();
// GroupC2->hide();
// GroupC3->hide();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myPoint1.SetCoord( 0.0, 0.0, 0.0 );
myPoint2.SetCoord( 0.0, 0.0, 0.0 );
myOkPoint1 = myOkPoint2 = false ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filters definition */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
mySelection->AddFilter(myVertexFilter) ; /* first filter used */
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_EdgeDlg::ConstructorsClicked(int constructorId)
{
switch (constructorId)
{
case 0:
{
break;
}
}
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_EdgeDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_EdgeDlg::ClickOnApply()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
{
case 0 :
{
if(myOkPoint1 && myOkPoint2)
myGeomGUI->MakeLinearEdgeAndDisplay( myPoint1, myPoint2 ) ;
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_EdgeDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_EdgeDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("") ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
QString aString = ""; /* name of future selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
if ( myEditCurrentArgument == LineEditC1A1 ) {
myOkPoint1 = false ;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
myOkPoint2 = false ;
}
return ;
}
// nbSel == 1 !
TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
myEditCurrentArgument->setText(aString) ;
myOkPoint1 = true ;
}
else if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint(S, myPoint2) ) {
myEditCurrentArgument->setText(aString) ;
myOkPoint2 = true ;
}
if( myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion() ) {
mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape();
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_EdgeDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else if ( send == LineEditC1A2 )
myEditCurrentArgument = LineEditC1A2 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_EdgeDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
mySelection->ClearFilters() ;
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
}
else if(send == SelectButtonC1A2) {
LineEditC1A2->setFocus() ;
myEditCurrentArgument = LineEditC1A2;
}
mySelection->AddFilter(myVertexFilter) ;
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_EdgeDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
// TODO other constructors
//
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
mySelection->ClearFilters() ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_EdgeDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_EdgeDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_EdgeDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}

View File

@ -1,118 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_EdgeDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_EDGE_H
#define DIALOGBOX_EDGE_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <Precision.hxx>
#include <gp_Pnt.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_EdgeDlg
// purpose :
//=================================================================================
class GeometryGUI_EdgeDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_EdgeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_EdgeDlg();
private :
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
SALOME_Selection* mySelection ; /* User shape selection */
gp_Pnt myPoint1 ; /* Points containing the vector */
gp_Pnt myPoint2 ;
bool myOkPoint1 ; /* true when myPoint is defined */
bool myOkPoint2 ;
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
int myConstructorId ; /* Current constructor id = radio button id */
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */
void closeEvent( QCloseEvent* e ) ;
void enterEvent( QEvent* e);
void Init( SALOME_Selection* Sel ) ;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupC1;
QPushButton* SelectButtonC1A2;
QLineEdit* LineEditC1A1;
QLineEdit* LineEditC1A2;
QPushButton* SelectButtonC1A1;
QLabel* TextLabelC1A1;
QLabel* TextLabelC1A2;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void LineEditReturnPressed() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_EdgeDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupButtonsLayout;
};
#endif // DIALOGBOX_EDGE_H

View File

@ -1,533 +0,0 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE
//
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_EllipseDlg.cxx
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
#include "GeometryGUI_EllipseDlg.h"
#include "GeometryGUI.h"
#include "gp_Elips.hxx"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
#include "utilities.h"
#include <BRepAdaptor_Curve.hxx>
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_EllipseDlg()
// purpose : Constructs a GeometryGUI_EllipseDlg 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.
//=================================================================================
GeometryGUI_EllipseDlg::GeometryGUI_EllipseDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_ELLIPSE_PV")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_EllipseDlg" );
resize( 303, 285 );
setCaption( tr( "GEOM_ELLIPSE_TITLE" ) );
GeometryGUI_EllipseDlgLayout = new QGridLayout( this );
GeometryGUI_EllipseDlgLayout->setSpacing( 6 );
GeometryGUI_EllipseDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_ELLIPSE" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_EllipseDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupButtons->sizePolicy().hasHeightForWidth() ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
buttonApply->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 2 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_2, 0, 1 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_EllipseDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupC1->setMinimumSize( QSize( 0, 150 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_CENTER" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
TextLabelC1A4->setText( tr( "GEOM_RADIUS_MINOR" ) );
TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
GroupC1Layout->addMultiCellWidget( TextLabelC1A4, 3, 3, 0, 1 );
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
TextLabelC1A3->setText( tr( "GEOM_RADIUS_MAJOR" ) );
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
SelectButtonC1A2->setText( tr( "" ) );
SelectButtonC1A2->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" );
GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ) ;
SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" );
GroupC1Layout->addWidget( SpinBox_C1A4, 3, 2 );
GeometryGUI_EllipseDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_EllipseDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_EllipseDlg::~GeometryGUI_EllipseDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_EllipseDlg::Init( SALOME_Selection* Sel )
{
double step ;
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
step = St.toDouble() ;
/* min, max, step and decimals for spin boxes */
SpinBox_C1A3->RangeStepAndValidator( 0.00001, 999999.99999, step, 5 ) ;
SpinBox_C1A3->SetValue( 200.0 ) ; /* = myMajorRadius */
myMajorRadius = 200.0 ;
/* min, max, step and decimals for spin boxes */
SpinBox_C1A4->RangeStepAndValidator( 0.00001, 999999.99999, step, 5 ) ;
SpinBox_C1A4->SetValue( 100.0 ) ; /* = myMinorRadius */
myMinorRadius = 100.0 ;
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myOkPoint = myOkDir = false ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom );
myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
mySelection->AddFilter(myVertexFilter) ; /* first filter used */
/* signals and slots connections */
connect( buttonOk, SIGNAL( pressed() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( pressed() ), this, SLOT( ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (pressed() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2, SIGNAL (pressed() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_EllipseDlg::ConstructorsClicked(int constructorId)
{
/* only a constructor now */
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_EllipseDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_EllipseDlg::ClickOnApply()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
switch(myConstructorId)
{
case 0 :
{
if(myOkPoint && myOkDir) {
myGeomGUI->MakeEllipseAndDisplay( myPoint, myDir, myMajorRadius, myMinorRadius ) ;
}
break ;
}
}
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_EllipseDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_EllipseDlg::SelectionIntoArgument()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
/* Future name of selection */
QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
if ( myEditCurrentArgument == LineEditC1A1 ) {
LineEditC1A1->setText("") ;
myOkPoint = false ;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
LineEditC1A2->setText("") ;
myOkDir = false ;
}
return ;
}
/* nbSel == 1 */
TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
/* gp_Pnt : not used */
if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint) ) {
LineEditC1A1->setText(aString) ;
myOkPoint = true ;
}
else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir) */) {
BRepAdaptor_Curve curv(TopoDS::Edge(S));
myDir = curv.Line().Direction();
LineEditC1A2->setText(aString) ;
myOkDir = true ;
}
if( myOkPoint && myOkDir ) {
this->MakeEllipseSimulationAndDisplay() ;
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_EllipseDlg::SetEditCurrentArgument()
{
mySelection->ClearFilters() ;
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
mySelection->AddFilter(myVertexFilter) ;
}
else if(send == SelectButtonC1A2) {
LineEditC1A2->setFocus() ;
myEditCurrentArgument = LineEditC1A2;
mySelection->AddFilter(myEdgeFilter) ;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_EllipseDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else if ( send == LineEditC1A2 )
myEditCurrentArgument = LineEditC1A2 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void GeometryGUI_EllipseDlg::ValueChangedInSpinBox( double newValue )
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
GeometryGUI_SpinBox* send = (GeometryGUI_SpinBox*)sender();
if(send == SpinBox_C1A3)
myMajorRadius = newValue ;
else if(send == SpinBox_C1A4)
myMinorRadius = newValue ;
else
return ;
if (myOkPoint && myOkDir) {
MakeEllipseSimulationAndDisplay() ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_EllipseDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
mySelection->ClearFilters() ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_EllipseDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_EllipseDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_EllipseDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ; /* same than click on cancel button */
}
//=================================================================================
// function : MakeEllipseSimulationAndDisplay()
// purpose :
//=================================================================================
void GeometryGUI_EllipseDlg::MakeEllipseSimulationAndDisplay()
{
myGeomGUI->EraseSimulationShape() ;
if( myMajorRadius < myMinorRadius )
return ;
try {
const gp_Ax2 axis( this->myPoint, this->myDir ) ;
gp_Elips ellipse( axis, this->myMajorRadius, this->myMinorRadius );
BRepBuilderAPI_MakeEdge MakeEdge( ellipse );
mySimulationTopoDs = MakeEdge.Shape();
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
}
catch(Standard_Failure) {
MESSAGE( "Exception catched in MakeEllipseSimulationAndDisplay" ) ;
}
return ;
}

View File

@ -1,133 +0,0 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE
//
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_EllipseDlg.h
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
#ifndef GEOMETRYGUI_ELLIPSE_H
#define GEOMETRYGUI_ELLIPSE_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include "GEOM_EdgeFilter.hxx"
#include "GeometryGUI_SpinBox.h"
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class QSpinBox;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_EllipseDlg
// purpose :
//=================================================================================
class GeometryGUI_EllipseDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_EllipseDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_EllipseDlg();
private :
void closeEvent( QCloseEvent* e ) ;
void enterEvent( QEvent* e );
void Init(SALOME_Selection* Sel) ;
void MakeEllipseSimulationAndDisplay() ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */
SALOME_Selection* mySelection ; /* User shape selection */
gp_Pnt myPoint ; /* Central point of ellipse */
bool myOkPoint ; /* true when myPoint is defined */
gp_Dir myDir ; /* to set normal axis of ellipse */
bool myOkDir ; /* true when myPoint is defined */
Standard_Real myMajorRadius ;
Standard_Real myMinorRadius ;
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */
Handle(GEOM_EdgeFilter) myEdgeFilter; /* filter for selection */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonCancel;
QPushButton* buttonOk;
QGroupBox* GroupC1;
QLineEdit* LineEditC1A1;
QLineEdit* LineEditC1A2;
QLabel* TextLabelC1A1;
QLabel* TextLabelC1A4;
QLabel* TextLabelC1A3;
QLabel* TextLabelC1A2;
QPushButton* SelectButtonC1A1;
QPushButton* SelectButtonC1A2;
GeometryGUI_SpinBox* SpinBox_C1A3;
GeometryGUI_SpinBox* SpinBox_C1A4;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void LineEditReturnPressed() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
void ValueChangedInSpinBox(double newValue) ;
protected:
QGridLayout* GeometryGUI_EllipseDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
};
#endif // GEOMETRYGUI_ELLIPSE_H

View File

@ -1,420 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_FaceDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_FaceDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_FaceDlg()
// purpose : Constructs a GeometryGUI_FaceDlg 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.
//=================================================================================
GeometryGUI_FaceDlg::GeometryGUI_FaceDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BUILD_FACE")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_FaceDlg" );
resize( 303, 208 );
setCaption( tr( "GEOM_FACE_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_FaceDlgLayout = new QGridLayout( this );
GeometryGUI_FaceDlgLayout->setSpacing( 6 );
GeometryGUI_FaceDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_FACE" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_FaceDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_FACE_FFW" ) );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_WIRE" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" );
CheckBox1->setText( tr( "GEOM_FACE_OPT" ) );
CheckBox1->setChecked( TRUE );
GroupC1Layout->addWidget( CheckBox1, 1, 2);
GeometryGUI_FaceDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_FaceDlgLayout->addWidget( GroupButtons, 2, 0 );
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_FaceDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_FaceDlg::~GeometryGUI_FaceDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_FaceDlg::Init( SALOME_Selection* Sel )
{
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
CheckBox1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
this->myOkShape = false ;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
myWireFilter = new GEOM_ShapeTypeFilter( TopAbs_WIRE, myGeom );
mySelection->AddFilter(myWireFilter) ; /* first filter used */
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_FaceDlg::ConstructorsClicked(int constructorId)
{
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_FaceDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_FaceDlg::ClickOnApply()
{
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
{
case 0 :
{
if(myOkShape) {
myGeomGUI->MakeFaceAndDisplay(this->myGeomShape, this->CheckBox1->isChecked() ) ;
}
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_FaceDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
myGeomGUI->ResetState() ;
disconnect( mySelection, 0, this, 0 );
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_FaceDlg::SelectionIntoArgument()
{
/* All this for first constructor */
// if(myEditCurrentArgument == LineEditC1A1 )
myOkShape = false;
myEditCurrentArgument->setText("") ;
QString aString = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 )
return ;
// nbSel == 1 !
Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(this->mySelection, this->myShape) )
return ;
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
myEditCurrentArgument->setText(aString) ;
this->myOkShape = true ;
/* no simulation */
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_FaceDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
mySelection->ClearFilters() ;
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
mySelection->AddFilter(myWireFilter) ;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_FaceDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_FaceDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
disconnect( mySelection, 0, this, 0 );
mySelection->ClearFilters() ;
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_FaceDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_FaceDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_FaceDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}

View File

@ -1,113 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_FaceDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_FACE_H
#define DIALOGBOX_FACE_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QCheckBox;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_FaceDlg
// purpose :
//=================================================================================
class GeometryGUI_FaceDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_FaceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_FaceDlg();
private:
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape myShape ; /* topology used to fuse */
GEOM::GEOM_Shape_var myGeomShape ; /* is myShape */
bool myOkShape ; /* to check when arguments is defined */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
Handle(GEOM_ShapeTypeFilter) myWireFilter; /* Filter selection */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupC1;
QLabel* TextLabelC1A1;
QPushButton* SelectButtonC1A1;
QLineEdit* LineEditC1A1;
QCheckBox* CheckBox1;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void LineEditReturnPressed() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_FaceDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupButtonsLayout;
};
#endif // DIALOGBOX_FACE_H

View File

@ -1,842 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_FilletDlg.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_FilletDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
#include "utilities.h"
#include "QAD_RightFrame.h"
#include "OCCViewer_Viewer3d.h"
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <TopExp_Explorer.hxx>
#include <BRepFilletAPI_MakeFillet.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
//=================================================================================
// class : GeometryGUI_FilletDlg()
// purpose : Constructs a GeometryGUI_FilletDlg 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.
//=================================================================================
GeometryGUI_FilletDlg::GeometryGUI_FilletDlg( QWidget* parent,
const char* name,
SALOME_Selection* Sel,
Handle (AIS_InteractiveContext) ic,
bool modal,
WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
/***************************************************************/
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_FILLET_ALL")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_FILLET_EDGE")));
QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_FILLET_FACE")));
if ( !name )
setName( "GeometryGUI_FilletDlg" );
resize( 365, 220 );
setCaption( tr( "GEOM_FILLET_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_FilletDlgLayout = new QGridLayout( this );
GeometryGUI_FilletDlgLayout->setSpacing( 6 );
GeometryGUI_FilletDlgLayout->setMargin( 11 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_FilletDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_FILLET" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
Constructor2->setText( tr( "" ) );
Constructor2->setPixmap( image2 );
Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) );
Constructor2->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 3 );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_3, 0, 1 );
Constructor3 = new QRadioButton( GroupConstructors, "Constructor3" );
Constructor3->setText( tr( "" ) );
Constructor3->setPixmap( image3 );
Constructor3->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor3, 0, 4 );
QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_4, 0, 5 );
GeometryGUI_FilletDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_FILLET_ALL" ) );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_RADIUS" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
TextLabelC1A2->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A2" ) ;
SpinBox_C1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A2->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( SpinBox_C1A2, 1, 2 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
GeometryGUI_FilletDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
GroupC2 = new QGroupBox( this, "GroupC2" );
GroupC2->setTitle( tr( "GEOM_FILLET_EDGES" ) );
GroupC2->setMinimumSize( QSize( 0, 0 ) );
GroupC2->setFrameShape( QGroupBox::Box );
GroupC2->setFrameShadow( QGroupBox::Sunken );
GroupC2->setColumnLayout(0, Qt::Vertical );
GroupC2->layout()->setSpacing( 0 );
GroupC2->layout()->setMargin( 0 );
GroupC2Layout = new QGridLayout( GroupC2->layout() );
GroupC2Layout->setAlignment( Qt::AlignTop );
GroupC2Layout->setSpacing( 6 );
GroupC2Layout->setMargin( 11 );
TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" );
TextLabelC2A1->setText( tr( "GEOM_MAIN_OBJECT" ) );
TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC2A1->setFrameShape( QLabel::NoFrame );
TextLabelC2A1->setFrameShadow( QLabel::Plain );
GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 );
TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" );
TextLabelC2A2->setText( tr( "GEOM_RADIUS" ) );
TextLabelC2A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC2A2->setFrameShape( QLabel::NoFrame );
TextLabelC2A2->setFrameShadow( QLabel::Plain );
GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 );
LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" );
GroupC2Layout->addWidget( LineEditC2A1, 0, 2 );
SpinBox_C2A2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A2" ) ;
SpinBox_C2A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A2->sizePolicy().hasHeightForWidth() ) );
GroupC2Layout->addWidget( SpinBox_C2A2, 1, 2 );
SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" );
SelectButtonC2A1->setText( tr( "" ) );
SelectButtonC2A1->setPixmap( image1 );
SelectButtonC2A1->setToggleButton( FALSE );
SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) );
GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 );
GeometryGUI_FilletDlgLayout->addWidget( GroupC2, 1, 0 );
/***************************************************************/
GroupC3 = new QGroupBox( this, "GroupC3" );
GroupC3->setTitle( tr( "GEOM_FILLET_FACES" ) );
GroupC3->setMinimumSize( QSize( 0, 0 ) );
GroupC3->setFrameShape( QGroupBox::Box );
GroupC3->setFrameShadow( QGroupBox::Sunken );
GroupC3->setColumnLayout(0, Qt::Vertical );
GroupC3->layout()->setSpacing( 0 );
GroupC3->layout()->setMargin( 0 );
GroupC3Layout = new QGridLayout( GroupC3->layout() );
GroupC3Layout->setAlignment( Qt::AlignTop );
GroupC3Layout->setSpacing( 6 );
GroupC3Layout->setMargin( 11 );
TextLabelC3A1 = new QLabel( GroupC3, "TextLabelC3A1" );
TextLabelC3A1->setText( tr( "GEOM_MAIN_OBJECT" ) );
TextLabelC3A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC3A1->setFrameShape( QLabel::NoFrame );
TextLabelC3A1->setFrameShadow( QLabel::Plain );
GroupC3Layout->addWidget( TextLabelC3A1, 0, 0 );
TextLabelC3A2 = new QLabel( GroupC3, "TextLabelC3A2" );
TextLabelC3A2->setText( tr( "GEOM_RADIUS" ) );
TextLabelC3A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC3A2->setFrameShape( QLabel::NoFrame );
TextLabelC3A2->setFrameShadow( QLabel::Plain );
GroupC3Layout->addWidget( TextLabelC3A2, 1, 0 );
LineEditC3A1 = new QLineEdit( GroupC3, "LineEditC3A1" );
GroupC3Layout->addWidget( LineEditC3A1, 0, 2 );
SpinBox_C3A2 = new GeometryGUI_SpinBox( GroupC3, "GeomSpinBox_C3A2" ) ;
SpinBox_C3A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C3A2->sizePolicy().hasHeightForWidth() ) );
GroupC3Layout->addWidget( SpinBox_C3A2, 1, 2 );
SelectButtonC3A1 = new QPushButton( GroupC3, "SelectButtonC3A1" );
SelectButtonC3A1->setText( tr( "" ) );
SelectButtonC3A1->setPixmap( image1 );
SelectButtonC3A1->setToggleButton( FALSE );
SelectButtonC3A1->setMaximumSize( QSize( 28, 32767 ) );
GroupC3Layout->addWidget( SelectButtonC3A1, 0, 1 );
GeometryGUI_FilletDlgLayout->addWidget( GroupC3, 1, 0 );
/* Initialisation */
Init( Sel, ic ) ;
}
//=================================================================================
// function : ~GeometryGUI_FilletDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_FilletDlg::~GeometryGUI_FilletDlg()
{
/* no need to delete child widgets, Qt does it all for us */
this->destroy(TRUE, TRUE) ;
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_FilletDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic )
{
/* Get setting of step value from file configuration */
double step ;
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
step = St.toDouble() ;
/* min, max, step and decimals for spin boxes */
SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
SpinBox_C1A2->SetValue( 50 ) ;
SpinBox_C2A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
SpinBox_C2A2->SetValue( 50 ) ;
SpinBox_C3A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
SpinBox_C3A2->SetValue( 50 ) ;
GroupC1->show();
GroupC2->hide() ;
GroupC3->hide() ;
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
mySelection = Sel ;
myEditCurrentArgument = LineEditC1A1 ;
myShape.Nullify() ;
myRadius = 50.0 ;
myOkRadius = true ;
myIC = ic ;
myLocalContextId = -1 ;
myUseLocalContext = false ;
myOkShape = false ;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
mySimulationTopoDs.Nullify() ;
/* Filters definition */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC3A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_C2A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( SpinBox_C3A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC3A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* Displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_FilletDlg::ConstructorsClicked(int constructorId)
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myEditCurrentArgument->setText(tr("")) ;
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext();
if(this->myUseLocalContext) {
myIC->CloseLocalContext(this->myLocalContextId) ;
myGeomGUI->OnDisplayAll(true) ;
this->myUseLocalContext = false ;
}
}
myOkShape = false ;
myRadius = 50.0 ;
myOkRadius = true ;
myConstructorId = constructorId ;
// connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
switch (constructorId)
{
case 0: /* Fillet All */
{
myShapeType = -1;
GroupC1->show();
GroupC2->hide() ;
GroupC3->hide() ;
myEditCurrentArgument = LineEditC1A1 ;
SpinBox_C1A2->SetValue( 50 ) ;;
LineEditC1A1->setText(tr("")) ;
break;
}
case 1: /* Fillet edges */
{
myShapeType = 6;
GroupC1->hide();
GroupC2->show() ;
GroupC3->hide() ;
myEditCurrentArgument = LineEditC2A1 ;
SpinBox_C2A2->SetValue( 50 ) ;;
LineEditC2A1->setText(tr("")) ;
break ;
}
case 2: /* Fillet Faces */
{
myShapeType = 4;
GroupC1->hide();
GroupC2->hide() ;
GroupC3->show() ;
myEditCurrentArgument = LineEditC3A1 ;
SpinBox_C3A2->SetValue( 50 ) ;;
LineEditC3A1->setText(tr("")) ;
break ;
}
}
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_FilletDlg::ClickOnApply()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
bool testResult = false ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
{
case 0 : /* Fillet All */
{
if(myOkRadius) {
if( myOkShape ) {
testResult = myGeomGUI->OnFilletGetAll( myShape, myRadius, myShapeType, myShapeIOR ) ;
}
}
if( !testResult ) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ;
} else {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ;
}
/* Reset all arguments and local context to allow user a new selection ...*/
this->ResetStateOfDialog() ;
break ;
}
case 1 : /* Fillet Edge */
{
if(myOkRadius) {
if( myOkShape ) {
testResult = myGeomGUI->OnFilletGetSelected( myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext );
}
}
if( !testResult ) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ;
} else {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ;
}
/* Reset all arguments and local context to allow user a new selection ...*/
this->ResetStateOfDialog() ;
break ;
}
case 2 : /* Fillet Face */
{
if(myOkRadius) {
if( myOkShape ) {
testResult = myGeomGUI->OnFilletGetSelected( myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext ) ;
}
}
if( !testResult ) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ;
} else {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ;
}
/* Reset all arguments and local context to allow user a new selection ...*/
this->ResetStateOfDialog() ;
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_FilletDlg::ClickOnCancel()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext();
if(this->myUseLocalContext) {
myIC->CloseLocalContext(this->myLocalContextId) ;
this->myUseLocalContext = false ;
myGeomGUI->OnDisplayAll(true) ;
}
}
reject() ;
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_FilletDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_FilletDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else if ( send == LineEditC2A1 )
myEditCurrentArgument = LineEditC2A1 ;
else if ( send == LineEditC3A1 )
myEditCurrentArgument = LineEditC3A1 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void GeometryGUI_FilletDlg::SelectionIntoArgument()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
/* Reset all arguments and local context when selection as changed */
this->ResetStateOfDialog() ;
/* Future name of argument */
QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel == 1 ) {
TopoDS_Shape S ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if( !IO->hasEntry() ) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ;
return ;
}
if ( !S.IsNull() && S.ShapeType() <= 2 ) {
if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) {
Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO );
myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */
myEditCurrentArgument->setText(aString) ;
myShape = S ;
myOkShape = true ;
}
if ( IO->hasEntry() ) {
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() );
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeIOR_var anIOR;
if ( !obj->_is_nil() ) {
if (obj->FindAttribute(anAttr, "AttributeIOR")) {
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
myShapeIOR = anIOR->Value();
myOkShape = true ;
myShape = S ;
myEditCurrentArgument->setText(aString) ;
}
}
}
}
MakePreview();
} else
return;
if( myOkShape && myShapeType!=-1 && myConstructorId != 0 ) {
/* local context is defined into the method */
myGeomGUI->PrepareSubShapeSelection( this->myShapeType, this->myLocalContextId ) ;
myUseLocalContext = true ;
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_EDGE")) ;
}
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_FilletDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0:
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
SelectionIntoArgument() ;
}
break;
}
case 1:
{
if(send ==SelectButtonC2A1 ) {
LineEditC2A1->setFocus() ;
myEditCurrentArgument = LineEditC2A1;
SelectionIntoArgument() ;
}
break;
}
case 2:
{
if(send ==SelectButtonC3A1 ) {
LineEditC3A1->setFocus() ;
myEditCurrentArgument = LineEditC3A1;
SelectionIntoArgument() ;
}
break;
}
}
return ;
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void GeometryGUI_FilletDlg::ValueChangedInSpinBox( double newValue )
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myRadius = newValue ;
myOkRadius = true ;
MakePreview();
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_FilletDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
this->ResetStateOfDialog() ;
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupC2->setEnabled(false) ;
GroupC3->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
myGeomGUI->SetActiveDialogBox(0) ;
myGeomGUI->OnDisplayAll(true) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_FilletDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupC2->setEnabled(true) ;
GroupC3->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_FilletDlg::enterEvent( QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_FilletDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ResetStateOfDialog()
// purpose :
//=================================================================================
void GeometryGUI_FilletDlg::ResetStateOfDialog()
{
this->myOkShape = false ;
this->myEditCurrentArgument->setText("") ;
/* Close its local contact if opened */
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext();
if(this->myUseLocalContext) {
myIC->CloseLocalContext(this->myLocalContextId) ;
this->myUseLocalContext = false ;
myGeomGUI->OnDisplayAll(true) ;
}
}
return ;
}
void GeometryGUI_FilletDlg::MakePreview()
{
TopoDS_Shape tds ;
try
{
BRepFilletAPI_MakeFillet fill(myShape);
switch (myConstructorId)
{
case 0: /* Fillet All */
{
TopExp_Explorer Exp ( myShape, TopAbs_EDGE );
for (Exp; Exp.More(); Exp.Next())
{
TopoDS_Edge E =TopoDS::Edge(Exp.Current());
fill.Add(E);
}
for (int i = 1;i<=fill.NbContours();i++)
fill.SetRadius(myRadius,i);
tds = fill.Shape();
break;
}
// case 1: /* Fillet edges */
// case 2: /* Fillet Faces */
}
if (!tds.IsNull())
{
mySimulationTopoDs = tds;
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
}
}
catch(Standard_Failure)
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
}

View File

@ -1,163 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_FilletDlg.h
// Author : Damien COQUERET
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_FILLET_H
#define DIALOGBOX_FILLET_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include "GeometryGUI_SpinBox.h"
// Qt Includes
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
// Open CASCADE Includes
#include <AIS_InteractiveContext.hxx>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QFrame;
class QGroupBox;
class QLineEdit;
class QPushButton;
class QRadioButton;
class QToolButton;
class QLabel;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_FilletDlg
// purpose :
//=================================================================================
class GeometryGUI_FilletDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_FilletDlg( QWidget* parent = 0,
const char* name = 0,
SALOME_Selection* Sel = 0,
Handle (AIS_InteractiveContext) ic = 0,
bool modal = FALSE,
WFlags fl = 0 );
~GeometryGUI_FilletDlg();
private :
void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent( QEvent* e);
void ResetStateOfDialog() ;
/* Interactive and local context management see also : bool myUseLocalContext() */
Handle (AIS_InteractiveContext) myIC ; /* Interactive context */
Standard_Integer myLocalContextId ; /* identify a local context used by this method */
bool myUseLocalContext ; /* true when this method as opened a local context */
QDoubleValidator *myVa ; /* Double validator for numeric input */
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */
void MakePreview();
TopoDS_Shape myShape ;
bool myOkShape ;
char* myShapeIOR ;
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
int myConstructorId ; /* Current constructor id = radio button id */
int myShapeType ;
bool myOkRadius ;
double myRadius ;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QRadioButton* Constructor2;
QRadioButton* Constructor3;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QGroupBox* GroupC1;
QPushButton* SelectButtonC1A1;
QLineEdit* LineEditC1A1;
QLabel* TextLabelC1A1;
GeometryGUI_SpinBox* SpinBox_C1A2 ;
QLabel* TextLabelC1A2;
QGroupBox* GroupC2;
QPushButton* SelectButtonC2A1;
QLineEdit* LineEditC2A1;
QLabel* TextLabelC2A1;
GeometryGUI_SpinBox* SpinBox_C2A2 ;
QLabel* TextLabelC2A2;
QGroupBox* GroupC3;
QPushButton* SelectButtonC3A1;
QLineEdit* LineEditC3A1;
QLabel* TextLabelC3A1;
GeometryGUI_SpinBox* SpinBox_C3A2 ;
QLabel* TextLabelC3A2;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void LineEditReturnPressed() ;
void ActivateThisDialog() ;
void ValueChangedInSpinBox( double newValue ) ;
protected:
QGridLayout* GeometryGUI_FilletDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
QGridLayout* GroupC3Layout;
};
#endif // DIALOGBOX_FILLET_H

View File

@ -1,644 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_FillingDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_FillingDlg.h"
#include "GeometryGUI.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qvalidator.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_FillingDlg()
// purpose : Constructs a GeometryGUI_FillingDlg 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.
//=================================================================================
GeometryGUI_FillingDlg::GeometryGUI_FillingDlg( QWidget* parent,
const char* name,
SALOME_Selection* Sel,
bool modal,
WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_FILLING")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_FillingDlg" );
resize( 303, 275 );
setCaption( tr( "GEOM_FILLING_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_FillingDlgLayout = new QGridLayout( this );
GeometryGUI_FillingDlgLayout->setSpacing( 6 );
GeometryGUI_FillingDlgLayout->setMargin( 11 );
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_FILLING" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_FillingDlgLayout->addWidget( GroupConstructors, 0, 0 );
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_FillingDlgLayout->addWidget( GroupButtons, 2, 0 );
// GroupC1 = new QGroupBox( this, "GroupC1" );
// GroupC1->setTitle( tr( "GEOM_FILLING_ARG" ) );
// GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) );
// GroupC1->setColumnLayout(0, Qt::Vertical );
// GroupC1->layout()->setSpacing( 0 );
// GroupC1->layout()->setMargin( 0 );
// GroupC1Layout = new QGridLayout( GroupC1->layout() );
// GroupC1Layout->setAlignment( Qt::AlignTop );
// GroupC1Layout->setSpacing( 6 );
// GroupC1Layout->setMargin( 11 );
// LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
// LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
// GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 3, 5 );
// TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
// TextLabelC1A2->setText( tr( "GEOM_FILLING_MIN_DEG" ) );
// TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
// TextLabelC1A2->setFrameShape( QLabel::NoFrame );
// TextLabelC1A2->setFrameShadow( QLabel::Plain );
// GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
// LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
// LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) );
// LineEditC1A2->setMinimumSize( QSize( 40, 0 ) );
// GroupC1Layout->addMultiCellWidget( LineEditC1A2, 1, 1, 1, 2 );
// TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
// TextLabelC1A3->setText( tr( "GEOM_FILLING_MAX_DEG" ) );
// TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
// TextLabelC1A3->setFrameShape( QLabel::NoFrame );
// TextLabelC1A3->setFrameShadow( QLabel::Plain );
// GroupC1Layout->addWidget( TextLabelC1A3, 1, 4 );
// TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" );
// TextLabelC1A5->setText( tr( "GEOM_FILLING_TOL_2D" ) );
// TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) );
// TextLabelC1A5->setFrameShape( QLabel::NoFrame );
// TextLabelC1A5->setFrameShadow( QLabel::Plain );
// GroupC1Layout->addWidget( TextLabelC1A5, 2, 4 );
// LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" );
// LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) );
// LineEditC1A3->setMinimumSize( QSize( 40, 0 ) );
// GroupC1Layout->addWidget( LineEditC1A3, 1, 5 );
// LineEditC1A5 = new QLineEdit( GroupC1, "LineEditC1A5" );
// LineEditC1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A5->sizePolicy().hasHeightForWidth() ) );
// LineEditC1A5->setMinimumSize( QSize( 40, 0 ) );
// GroupC1Layout->addWidget( LineEditC1A5, 2, 5 );
// TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
// TextLabelC1A1->setText( tr( "GEOM_FILLING_COMPOUND" ) );
// TextLabelC1A1->setMinimumSize( QSize( 90, 0 ) );
// TextLabelC1A1->setFrameShape( QLabel::NoFrame );
// TextLabelC1A1->setFrameShadow( QLabel::Plain );
// GroupC1Layout->addMultiCellWidget( TextLabelC1A1, 0, 0, 0, 1 );
// SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
// SelectButtonC1A1->setText( tr( "" ) );
// SelectButtonC1A1->setPixmap( image1 );
// GroupC1Layout->addWidget( SelectButtonC1A1, 0, 2 );
// TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
// TextLabelC1A4->setText( tr( "GEOM_FILLING_TOL_3D" ) );
// TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
// TextLabelC1A4->setFrameShape( QLabel::NoFrame );
// TextLabelC1A4->setFrameShadow( QLabel::Plain );
// GroupC1Layout->addWidget( TextLabelC1A4, 2, 0 );
// TextLabelC1A6 = new QLabel( GroupC1, "TextLabelC1A6" );
// TextLabelC1A6->setText( tr( "GEOM_FILLING_NB_ITER" ) );
// TextLabelC1A6->setMinimumSize( QSize( 50, 0 ) );
// TextLabelC1A6->setFrameShape( QLabel::NoFrame );
// TextLabelC1A6->setFrameShadow( QLabel::Plain );
// GroupC1Layout->addWidget( TextLabelC1A6, 3, 0 );
// LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" );
// LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) );
// LineEditC1A4->setMinimumSize( QSize( 40, 0 ) );
// GroupC1Layout->addMultiCellWidget( LineEditC1A4, 2, 2, 1, 2 );
// LineEditC1A6 = new QLineEdit( GroupC1, "LineEditC1A6" );
// LineEditC1A6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A6->sizePolicy().hasHeightForWidth() ) );
// LineEditC1A6->setMinimumSize( QSize( 40, 0 ) );
// GroupC1Layout->addMultiCellWidget( LineEditC1A6, 3, 3, 1, 2 );
// QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
// GroupC1Layout->addItem( spacer_3, 1, 3 );
// QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
// GroupC1Layout->addItem( spacer_4, 2, 3 );
// QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
// GroupC1Layout->addMultiCell( spacer_5, 3, 3, 3, 5 );
// GeometryGUI_FillingDlgLayout->addWidget( GroupC1, 1, 0 );
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setTitle( tr( "GEOM_FILLING_ARG" ) );
GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 3, 6 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_FILLING_MIN_DEG" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
TextLabelC1A2->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" );
TextLabelC1A5->setText( tr( "GEOM_FILLING_TOL_2D" ) );
TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A5->setFrameShape( QLabel::NoFrame );
TextLabelC1A5->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A5, 2, 5 );
LineEditC1A5 = new QLineEdit( GroupC1, "LineEditC1A5" );
LineEditC1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A5->sizePolicy().hasHeightForWidth() ) );
LineEditC1A5->setMinimumSize( QSize( 40, 0 ) );
GroupC1Layout->addWidget( LineEditC1A5, 2, 6 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_FILLING_COMPOUND" ) );
TextLabelC1A1->setMinimumSize( QSize( 90, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addMultiCellWidget( TextLabelC1A1, 0, 0, 0, 1 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 2 );
TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" );
TextLabelC1A4->setText( tr( "GEOM_FILLING_TOL_3D" ) );
TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A4->setFrameShape( QLabel::NoFrame );
TextLabelC1A4->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A4, 2, 0 );
TextLabelC1A6 = new QLabel( GroupC1, "TextLabelC1A6" );
TextLabelC1A6->setText( tr( "GEOM_FILLING_NB_ITER" ) );
TextLabelC1A6->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A6->setFrameShape( QLabel::NoFrame );
TextLabelC1A6->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A6, 3, 0 );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupC1Layout->addItem( spacer_3, 1, 3 );
QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupC1Layout->addMultiCell( spacer_4, 2, 2, 3, 4 );
QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupC1Layout->addMultiCell( spacer_5, 3, 3, 3, 6 );
SpinBox_C1A2 = new QSpinBox( GroupC1, "SpinBox_C1A2" );
SpinBox_C1A2->setMinValue( 1 );
SpinBox_C1A2->setMaxValue( 15 );
SpinBox_C1A2->setWrapping( TRUE );
GroupC1Layout->addMultiCellWidget( SpinBox_C1A2, 1, 1, 1, 2 );
LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" );
LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) );
LineEditC1A4->setMinimumSize( QSize( 40, 0 ) );
GroupC1Layout->addMultiCellWidget( LineEditC1A4, 2, 2, 1, 2 );
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
TextLabelC1A3->setText( tr( "GEOM_FILLING_MAX_DEG" ) );
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A3->setFrameShape( QLabel::NoFrame );
TextLabelC1A3->setFrameShadow( QLabel::Plain );
GroupC1Layout->addMultiCellWidget( TextLabelC1A3, 1, 1, 4, 5 );
SpinBox_C1A3 = new QSpinBox( GroupC1, "SpinBox_C1A3" );
SpinBox_C1A3->setMinValue( 1 );
SpinBox_C1A3->setMaxValue( 15 );
SpinBox_C1A3->setWrapping( TRUE );
GroupC1Layout->addWidget( SpinBox_C1A3, 1, 6 );
SpinBox_C1A6 = new QSpinBox( GroupC1, "SpinBox_C1A6" );
SpinBox_C1A6->setMinValue( 1 );
SpinBox_C1A6->setMaxValue( 30 );
SpinBox_C1A6->setWrapping( TRUE );
GroupC1Layout->addMultiCellWidget( SpinBox_C1A6, 3, 3, 1, 2 );
GeometryGUI_FillingDlgLayout->addWidget( GroupC1, 1, 0 );
/* Initialisations */
Init(Sel) ;
}
//=================================================================================
// function : ~GeometryGUI_FillingDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_FillingDlg::~GeometryGUI_FillingDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_FillingDlg::Init( SALOME_Selection* Sel )
{
LineEditC1A4->setMaxLength( 10 ); /* myTol3D */
LineEditC1A5->setMaxLength( 10 ); /* myTol2D */
QDoubleValidator *Vc = new QDoubleValidator( 0.00001, +10000.0, 3, LineEditC1A4 ) ;
QDoubleValidator *Vd = new QDoubleValidator( 0.00001, +10000.0, 3, LineEditC1A5 ) ;
LineEditC1A4->setValidator( Vc) ;
LineEditC1A5->setValidator( Vd) ;
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
SpinBox_C1A2->setValue(2) ; /* myMinDeg */
SpinBox_C1A3->setValue(5) ; /* myMaxDeg */
LineEditC1A4->setText("0.0001") ; /* myTol3D */
LineEditC1A5->setText("0.0001") ; /* myTol2D */
SpinBox_C1A6->setValue(5) ; /* myNbIter */
this->myMinDeg = 2 ;
this->myMaxDeg = 5 ;
this->myTol3D = 0.0001 ;
this->myTol2D = 0.0001 ;
this->myNbIter = 5 ;
myOkSectionShape = false ;
mySectionShape.Nullify() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
myCompoundFilter = new GEOM_ShapeTypeFilter( TopAbs_COMPOUND, myGeom );
/* first filter used */
mySelection->AddFilter(myCompoundFilter) ;
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1, SIGNAL (returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
/* Displays Dialog */
this->show() ;
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_FillingDlg::ConstructorsClicked(int constructorId)
{
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_FillingDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_FillingDlg::ClickOnApply()
{
switch(myConstructorId)
{
case 0 :
{
this->myMinDeg = SpinBox_C1A2->value() ;
this->myMaxDeg = SpinBox_C1A3->value() ;
this->myTol3D = LineEditC1A4->text().toDouble();
this->myTol2D = LineEditC1A5->text().toDouble();
this->myNbIter = SpinBox_C1A6->value() ;
if(myOkSectionShape) {
myGeomGUI->MakeFillingAndDisplay( myGeomShape, myMinDeg, myMaxDeg, myTol3D, myTol2D, myNbIter) ;
}
break ;
}
}
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_FillingDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_FillingDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("") ;
QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
if ( myEditCurrentArgument == LineEditC1A1 ) {
myOkSectionShape = false ;
}
return ;
}
// nbSel == 1
TopoDS_Shape S;
Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if ( myEditCurrentArgument == LineEditC1A1 && S.ShapeType() == TopAbs_COMPOUND ) {
myEditCurrentArgument->setText(aString) ;
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
myOkSectionShape = true ;
}
/* no simulation */
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_FillingDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
mySelection->ClearFilters() ;
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
mySelection->AddFilter(myCompoundFilter) ;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_FillingDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_FillingDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
mySelection->ClearFilters() ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_FillingDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_FillingDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_FillingDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}

View File

@ -1,127 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_FillingDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_FILLING_H
#define DIALOGBOX_FILLING_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QSpinBox;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_FillingDlg
// purpose :
//=================================================================================
class GeometryGUI_FillingDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_FillingDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_FillingDlg();
private:
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
GEOM::GEOM_Shape_var myGeomShape ; /* is mySectionShape */
TopoDS_Shape mySectionShape ;
Standard_Integer myMinDeg ;
Standard_Integer myMaxDeg ;
Standard_Real myTol3D ;
Standard_Real myTol2D ;
Standard_Integer myNbIter ;
bool myOkSectionShape ; /* to check when arguments is defined */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
Handle(GEOM_ShapeTypeFilter) myCompoundFilter ; /* Filter selection */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QGroupBox* GroupC1;
QLineEdit* LineEditC1A1;
QLabel* TextLabelC1A2;
QLabel* TextLabelC1A3;
QLabel* TextLabelC1A5;
QLineEdit* LineEditC1A5;
QLabel* TextLabelC1A1;
QPushButton* SelectButtonC1A1;
QLabel* TextLabelC1A4;
QLabel* TextLabelC1A6;
QLineEdit* LineEditC1A4;
QSpinBox* SpinBox_C1A2;
QSpinBox* SpinBox_C1A3;
QSpinBox* SpinBox_C1A6;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void LineEditReturnPressed() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_FillingDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
};
#endif // DIALOGBOX_FILLING_H

View File

@ -1,542 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_FillingHoleDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_FillingHoleDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_FillingHoleDlg()
// purpose : Constructs a GeometryGUI_FillingHoleDlg 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.
//=================================================================================
GeometryGUI_FillingHoleDlg::GeometryGUI_FillingHoleDlg( QWidget* parent,
const char* name,
SALOME_Selection* Sel,
Handle (AIS_InteractiveContext) ic,
bool modal,
WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SEWING")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_FillingHoleDlg" );
resize( 303, 203 );
setCaption( tr( "Filling hole" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_FillingHoleDlgLayout = new QGridLayout( this );
GeometryGUI_FillingHoleDlgLayout->setSpacing( 6 );
GeometryGUI_FillingHoleDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_FillingHoleDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "" ) );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
Layout2 = new QHBoxLayout;
Layout2->setSpacing( 6 );
Layout2->setMargin( 0 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "Main object" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
Layout2->addWidget( TextLabelC1A1 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) );
Layout2->addWidget( SelectButtonC1A1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
LineEditC1A1->setAlignment( int( QLineEdit::AlignLeft ) );
Layout2->addWidget( LineEditC1A1 );
GroupC1Layout->addLayout( Layout2, 0, 0 );
CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" );
CheckBox1->setText( tr( "Select edges of hole on main object" ) );
CheckBox1->setChecked( FALSE );
GroupC1Layout->addWidget( CheckBox1, 1, 0 );
GeometryGUI_FillingHoleDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupButtons->sizePolicy().hasHeightForWidth() ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonClose = new QPushButton( GroupButtons, "buttonClose" );
buttonClose->setText( tr( "&Close" ) );
buttonClose->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonClose, 0, 3 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "&Ok" ) );
buttonOk->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "&Apply" ) );
buttonApply->setAutoDefault( TRUE );
buttonApply->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_2, 0, 2 );
GeometryGUI_FillingHoleDlgLayout->addWidget( GroupButtons, 2, 0 );
/* Initialisations */
Init(Sel, ic) ;
}
//=================================================================================
// function : ~GeometryGUI_FillingHoleDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_FillingHoleDlg::~GeometryGUI_FillingHoleDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_FillingHoleDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic )
{
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myShape.Nullify() ;
myIC = ic ;
myUseLocalContext = false ;
myOkShape = false ;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
/* Select sub shapes mode not checked */
CheckBox1->setChecked( FALSE );
myOkSelectSubMode = false ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( buttonClose, SIGNAL( clicked() ), this, SLOT( ClickOnClose() ) );
connect( GroupConstructors, SIGNAL( clicked(int) ), this, SLOT( ConstructorsClicked(int) ));
connect( LineEditC1A1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( SelectButtonC1A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ));
connect( CheckBox1, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserSelection() ));
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ));
connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnClose() ));
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* display Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_FillingHoleDlg::ConstructorsClicked(int constructorId)
{
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose : Same than click on apply but close this dialog.
//=================================================================================
void GeometryGUI_FillingHoleDlg::ClickOnOk()
{
this->ClickOnApply() ;
accept();
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_FillingHoleDlg::ClickOnApply()
{
bool testResult = false ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
{
case 0 :
{
if( myOkShape && myOkSelectSubMode ) {
testResult = myGeomGUI->OnFillingHole( myShape, myShapeIOR, myLocalContextId, myUseLocalContext ) ;
}
if( !testResult ) {
myGeomGUI->GetDesktop()->putInfo(tr("Operation aborted")) ;
}
else {
myGeomGUI->GetDesktop()->putInfo(tr("Operation done"));
}
/* Reset arguments to allow a new selection */
this->ResetStateOfDialog() ;
break ;
}
}
return ;
}
//=================================================================================
// function : ClickOnClose()
// purpose :
//=================================================================================
void GeometryGUI_FillingHoleDlg::ClickOnClose()
{
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
if(myUseLocalContext) {
myIC->CloseLocalContext(myLocalContextId) ;
this->myUseLocalContext = false ;
myGeomGUI->OnDisplayAll(true) ;
}
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
// : used only by SelectButtonC1A1 (LineEditC1A1)
//=================================================================================
void GeometryGUI_FillingHoleDlg::SelectionIntoArgument()
{
/* Reset argument and local context when selection as changed */
this->ResetStateOfDialog() ;
QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 )
return ;
/* nbSel == 1 */
TopoDS_Shape S ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
// if( !IO->hasEntry() ) {
// myGeomGUI->GetDesktop()->putInfo(tr("Main shape must be in the study before")) ;
// return ;
// }
/* Test the exact type of topology to fill an hole */
if ( !S.IsNull() && ( S.ShapeType() == TopAbs_SOLID || S.ShapeType() == TopAbs_SHELL || S.ShapeType() == TopAbs_COMPOUND ) ) {
if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) {
Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO );
myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */
LineEditC1A1->setText(aString) ;
myShape = S ;
myOkShape = true ;
return;
}
if ( IO->hasEntry() ) {
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() );
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeIOR_var anIOR;
if ( !obj->_is_nil() ) {
if (obj->FindAttribute(anAttr, "AttributeIOR")) {
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
myShapeIOR = anIOR->Value();
myOkShape = true ;
myShape = S ;
LineEditC1A1->setText(aString) ;
return;
}
}
}
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_FillingHoleDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
SelectionIntoArgument() ;
}
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_FillingHoleDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_FillingHoleDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
this->ResetStateOfDialog() ;
disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
myGeomGUI->ResetState() ;
myGeomGUI->SetActiveDialogBox(0) ;
myGeomGUI->OnDisplayAll(true) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_FillingHoleDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate other active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it
//=================================================================================
void GeometryGUI_FillingHoleDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_FillingHoleDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnClose() ;
return ;
}
//=================================================================================
// function : ActivateUserSelection()
// purpose : Activate selection of faces when CheckBox1->isChecked()...
//=================================================================================
void GeometryGUI_FillingHoleDlg::ActivateUserSelection()
{
if( !this->myOkShape ) {
this->ResetStateOfDialog() ;
myGeomGUI->GetDesktop()->putInfo(tr("Select main shape first")) ;
return ;
}
this->myOkSelectSubMode = CheckBox1->isChecked() ;
if( this->myUseLocalContext ) {
myIC->CloseLocalContext(myLocalContextId) ;
this->myUseLocalContext = false ;
myGeomGUI->OnDisplayAll(true) ;
}
if( myOkShape && myOkSelectSubMode ) {
/* local context is defined into the method : GEOM::EDGE sub selection */
TopAbs_ShapeEnum aType = TopAbs_EDGE ;
myGeomGUI->PrepareSubShapeSelection( int(aType), this->myLocalContextId ) ;
myUseLocalContext = true ;
myGeomGUI->GetDesktop()->putInfo(tr("Select edges to fill an hole and click on Ok/Apply")) ;
}
return ;
}
//=================================================================================
// function : ResetStateOfDialog()
// purpose : Completely reset the state of method including local context
//=================================================================================
void GeometryGUI_FillingHoleDlg::ResetStateOfDialog()
{
this->myOkShape = false ;
this->myEditCurrentArgument->setText("") ;
/* Select sub shapes mode not checked */
this->myOkSelectSubMode = false ;
this->CheckBox1->setChecked( FALSE );
/* Close its local contact if opened */
if( this->myUseLocalContext ) {
myIC->CloseLocalContext(this->myLocalContextId) ;
this->myUseLocalContext = false ;
myGeomGUI->OnDisplayAll(true) ;
}
return ;
}

View File

@ -1,133 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_FillingHoleDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef GEOMETRYGUI_FILLINGHOLE_H
#define GEOMETRYGUI_FILLINGHOLE_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <qvariant.h>
#include <qdialog.h>
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QCheckBox;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_FillingHoleDlg
// purpose :
//=================================================================================
class GeometryGUI_FillingHoleDlg : public QDialog
{
Q_OBJECT
public :
GeometryGUI_FillingHoleDlg( QWidget* parent = 0,
const char* name = 0,
SALOME_Selection* Sel = 0,
Handle (AIS_InteractiveContext) ic = 0,
bool modal = FALSE,
WFlags fl = 0 );
~GeometryGUI_FillingHoleDlg();
private :
void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
void ResetStateOfDialog() ;
/* Interactive and local context management see also : bool myUseLocalContext() */
Handle (AIS_InteractiveContext) myIC ; /* Interactive context */
Standard_Integer myLocalContextId ; /* identify a local context used by this method */
bool myUseLocalContext ; /* true when this method as opened a local context */
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape myShape ;
char* myShapeIOR ;
bool myOkShape ;
bool myOkSelectSubMode ; /* true = sub mode selection activated */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
int myConstructorId ; /* Current constructor id = radio button id */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupC1;
QLabel* TextLabelC1A1;
QPushButton* SelectButtonC1A1;
QLineEdit* LineEditC1A1;
QCheckBox* CheckBox1;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonApply;
QPushButton* buttonClose;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnApply() ;
void ClickOnClose();
void LineEditReturnPressed() ;
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
void ActivateUserSelection() ;
protected:
QGridLayout* GeometryGUI_FillingHoleDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QHBoxLayout* Layout2;
QGridLayout* GroupButtonsLayout;
};
#endif // GEOMETRYGUI_FILLINGHOLE_H

View File

@ -1,251 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_FuseDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_FuseDlg.h"
#include "GeometryGUI.h"
#include "QAD_Desktop.h"
//=================================================================================
// class : GeometryGUI_FuseDlg()
// purpose : Constructs a GeometryGUI_FuseDlg 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.
//=================================================================================
GeometryGUI_FuseDlg::GeometryGUI_FuseDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
:GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FUSE")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
setCaption(tr("GEOM_FUSE_TITLE"));
/***************************************************************/
GroupConstructors->setTitle(tr("GEOM_FUSE"));
RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE);
RadioButton3->close(TRUE);
GroupFuse = new GeometryGUI_2Sel_QTD(this, "GroupFuse");
GroupFuse->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupFuse->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
GroupFuse->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
GroupFuse->PushButton1->setPixmap(image1);
GroupFuse->PushButton2->setPixmap(image1);
Layout1->addWidget(GroupFuse, 1, 0);
/***************************************************************/
/* Initialisation */
myBooleanGUI = theBooleanGUI;
Init();
}
//=================================================================================
// function : ~GeometryGUI_FuseDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_FuseDlg::~GeometryGUI_FuseDlg()
{
/* no need to delete child widgets, Qt does it all for us */
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_FuseDlg::Init()
{
/* init variables */
myEditCurrentArgument = GroupFuse->LineEdit1;
myShape1.Nullify();
myShape2.Nullify();
myOkShape1 = myOkShape2 = false;
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupFuse->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupFuse->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupFuse->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupFuse->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* displays Dialog */
GroupFuse->show();
this->show();
return;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_FuseDlg::ClickOnOk()
{
this->ClickOnApply();
ClickOnCancel();
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_FuseDlg::ClickOnApply()
{
myGeomGUI->GetDesktop()->putInfo(tr(""));
if(myOkShape1 && myOkShape2)
myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3);
return;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void GeometryGUI_FuseDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) {
if(myEditCurrentArgument == GroupFuse->LineEdit1)
myOkShape1 = false;
else if( myEditCurrentArgument == GroupFuse->LineEdit2)
myOkShape2 = false;
return;
}
/* nbSel == 1 */
TopoDS_Shape S;
Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
return;
if(myEditCurrentArgument == GroupFuse->LineEdit1) {
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
if(!testResult)
return;
myShape1 = S;
GroupFuse->LineEdit1->setText(aString);
myOkShape1 = true;
}
else if(myEditCurrentArgument == GroupFuse->LineEdit2) {
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
if(!testResult)
return;
myShape2 = S;
GroupFuse->LineEdit2->setText(aString);
myOkShape2 = true;
}
return;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_FuseDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
if(send == GroupFuse->PushButton1) {
GroupFuse->LineEdit1->setFocus();
myEditCurrentArgument = GroupFuse->LineEdit1;
}
else if(send == GroupFuse->PushButton2) {
GroupFuse->LineEdit2->setFocus();
myEditCurrentArgument = GroupFuse->LineEdit2;
}
SelectionIntoArgument();
return;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_FuseDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if(send == GroupFuse->LineEdit1)
myEditCurrentArgument = GroupFuse->LineEdit1;
else if(send == GroupFuse->LineEdit2)
myEditCurrentArgument = GroupFuse->LineEdit2;
else
return;
GeometryGUI_Skeleton::LineEditReturnPressed();
return;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_FuseDlg::ActivateThisDialog()
{
GeometryGUI_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
return;
}
//=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
void GeometryGUI_FuseDlg::enterEvent(QEvent* e)
{
if(GroupConstructors->isEnabled())
return;
this->ActivateThisDialog();
return;
}

View File

@ -1,76 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_FuseDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_FUSE_H
#define DIALOGBOX_FUSE_H
#include "GeometryGUI_Skeleton.h"
#include "GeometryGUI_2Sel_QTD.h"
#include "BooleanGUI.h"
#include <BRepAlgoAPI_Fuse.hxx>
//=================================================================================
// class : GeometryGUI_FuseDlg
// purpose :
//=================================================================================
class GeometryGUI_FuseDlg : public GeometryGUI_Skeleton
{
Q_OBJECT
public:
GeometryGUI_FuseDlg(QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
~GeometryGUI_FuseDlg();
private:
void Init();
void enterEvent(QEvent* e);
BooleanGUI* myBooleanGUI;
TopoDS_Shape myShape1; /* topology used to fuse */
TopoDS_Shape myShape2; /* topology used to fuse */
GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
bool myOkShape1; /* to check when arguments are defined */
bool myOkShape2;
GeometryGUI_2Sel_QTD* GroupFuse;
private slots:
void ClickOnOk();
void ClickOnApply();
void SetEditCurrentArgument();
void SelectionIntoArgument();
void LineEditReturnPressed();
void ActivateThisDialog();
};
#endif // DIALOGBOX_FUSE_H

View File

@ -1,566 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_InertiaDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
using namespace std;
#include "GeometryGUI_InertiaDlg.h"
#include "GeometryGUI.h"
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_InertiaDlg()
// purpose : Constructs a GeometryGUI_InertiaDlg 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.
//=================================================================================
GeometryGUI_InertiaDlg::GeometryGUI_InertiaDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_INERTIA")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_InertiaDlg" );
resize( 356, 303 );
setCaption( tr( "GEOM_INERTIA_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_InertiaDlgLayout = new QGridLayout( this );
GeometryGUI_InertiaDlgLayout->setSpacing( 6 );
GeometryGUI_InertiaDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_INERTIA_CONSTR" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
GeometryGUI_InertiaDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_OBJECT_RESULT" ) );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
LineEditC1A1->setMinimumSize( QSize( 220, 0 ) );
GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 4 );
TextLabel_Matrix = new QLabel( GroupC1, "TextLabel_Matrix" );
TextLabel_Matrix->setText( tr( "GEOM_MATRIX" ) );
TextLabel_Matrix->setMinimumSize( QSize( 50, 0 ) );
TextLabel_Matrix->setFrameShape( QLabel::NoFrame );
TextLabel_Matrix->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabel_Matrix, 1, 0 );
TextLabelMatrix_11 = new QLabel( GroupC1, "TextLabelMatrix_11" );
TextLabelMatrix_11->setText( tr( "GEOM_INERTIA_I" ).arg("1") );
TextLabelMatrix_11->setMinimumSize( QSize( 0, 0 ) );
TextLabelMatrix_11->setFrameShape( QLabel::NoFrame );
TextLabelMatrix_11->setFrameShadow( QLabel::Plain );
TextLabelMatrix_11->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
GroupC1Layout->addWidget( TextLabelMatrix_11, 1, 1 );
TextLabelMatrix_21 = new QLabel( GroupC1, "TextLabelMatrix_21" );
TextLabelMatrix_21->setText( tr( "GEOM_INERTIA_I" ).arg("2") );
TextLabelMatrix_21->setMinimumSize( QSize( 0, 0 ) );
TextLabelMatrix_21->setFrameShape( QLabel::NoFrame );
TextLabelMatrix_21->setFrameShadow( QLabel::Plain );
TextLabelMatrix_21->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
GroupC1Layout->addWidget( TextLabelMatrix_21, 2, 1 );
TextLabelMatrix_31 = new QLabel( GroupC1, "TextLabelMatrix_31" );
TextLabelMatrix_31->setText( tr( "GEOM_INERTIA_I" ).arg("3") );
TextLabelMatrix_31->setMinimumSize( QSize( 0, 0 ) );
TextLabelMatrix_31->setFrameShape( QLabel::NoFrame );
TextLabelMatrix_31->setFrameShadow( QLabel::Plain );
TextLabelMatrix_31->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
GroupC1Layout->addWidget( TextLabelMatrix_31, 3, 1 );
LineEdit_L1C1 = new QLineEdit( GroupC1, "LineEdit_L1C1" );
LineEdit_L1C1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L1C1->sizePolicy().hasHeightForWidth() ) );
LineEdit_L1C1->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_L1C1->setEnabled( FALSE );
LineEdit_L1C1->setReadOnly( TRUE );
LineEdit_L1C1->setText( tr( "" ) );
GroupC1Layout->addWidget( LineEdit_L1C1, 1, 2 );
LineEdit_L1C2 = new QLineEdit( GroupC1, "LineEdit_L1C2" );
LineEdit_L1C2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L1C2->sizePolicy().hasHeightForWidth() ) );
LineEdit_L1C2->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_L1C2->setEnabled( FALSE );
LineEdit_L1C2->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_L1C2, 1, 3 );
LineEdit_L1C3 = new QLineEdit( GroupC1, "LineEdit_L1C3" );
LineEdit_L1C3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L1C3->sizePolicy().hasHeightForWidth() ) );
LineEdit_L1C3->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_L1C3->setEnabled( FALSE );
LineEdit_L1C3->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_L1C3, 1, 4 );
LineEdit_L2C1 = new QLineEdit( GroupC1, "LineEdit_L2C1" );
LineEdit_L2C1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L2C1->sizePolicy().hasHeightForWidth() ) );
LineEdit_L2C1->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_L2C1->setEnabled( FALSE );
LineEdit_L2C1->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_L2C1, 2, 2 );
LineEdit_L2C2 = new QLineEdit( GroupC1, "LineEdit_L2C2" );
LineEdit_L2C2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L2C2->sizePolicy().hasHeightForWidth() ) );
LineEdit_L2C2->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_L2C2->setEnabled( FALSE );
LineEdit_L2C2->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_L2C2, 2, 3 );
LineEdit_L2C3 = new QLineEdit( GroupC1, "LineEdit_L2C3" );
LineEdit_L2C3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L2C3->sizePolicy().hasHeightForWidth() ) );
LineEdit_L2C3->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_L2C3->setEnabled( FALSE );
LineEdit_L2C3->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_L2C3, 2, 4 );
LineEdit_L3C1 = new QLineEdit( GroupC1, "LineEdit_L3C1" );
LineEdit_L3C1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L3C1->sizePolicy().hasHeightForWidth() ) );
LineEdit_L3C1->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_L3C1->setEnabled( FALSE );
LineEdit_L3C1->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_L3C1, 3, 2 );
LineEdit_L3C2 = new QLineEdit( GroupC1, "LineEdit_L3C2" );
LineEdit_L3C2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L3C2->sizePolicy().hasHeightForWidth() ) );
LineEdit_L3C2->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_L3C2->setEnabled( FALSE );
LineEdit_L3C2->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_L3C2, 3, 3 );
LineEdit_L3C3 = new QLineEdit( GroupC1, "LineEdit_L3C3" );
LineEdit_L3C3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L3C3->sizePolicy().hasHeightForWidth() ) );
LineEdit_L3C3->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_L3C3->setEnabled( FALSE );
LineEdit_L3C3->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_L3C3, 3, 4 );
LineEdit_IX = new QLineEdit( GroupC1, "LineEdit_IX" );
LineEdit_IX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_IX->sizePolicy().hasHeightForWidth() ) );
LineEdit_IX->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_IX->setEnabled( FALSE );
LineEdit_IX->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_IX, 4, 2 );
LineEdit_IY = new QLineEdit( GroupC1, "LineEdit_IY" );
LineEdit_IY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_IY->sizePolicy().hasHeightForWidth() ) );
LineEdit_IY->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_IY->setEnabled( FALSE );
LineEdit_IY->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_IY, 4, 3 );
LineEdit_IZ = new QLineEdit( GroupC1, "LineEdit_IZ" );
LineEdit_IZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_IZ->sizePolicy().hasHeightForWidth() ) );
LineEdit_IZ->setMinimumSize( QSize( 70, 0 ) );
//LineEdit_IZ->setEnabled( FALSE );
LineEdit_IZ->setReadOnly( TRUE );
GroupC1Layout->addWidget( LineEdit_IZ, 4, 4 );
TextLabel_IXIYIZ = new QLabel( GroupC1, "TextLabel_IXIYIZ" );
TextLabel_IXIYIZ->setText( tr( "GEOM_INERTIA_IXYZ" ) );
TextLabel_IXIYIZ->setMinimumSize( QSize( 50, 0 ) );
TextLabel_IXIYIZ->setFrameShape( QLabel::NoFrame );
TextLabel_IXIYIZ->setFrameShadow( QLabel::Plain );
TextLabel_IXIYIZ->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
GroupC1Layout->addMultiCellWidget( TextLabel_IXIYIZ, 4, 4, 0, 1 );
GeometryGUI_InertiaDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 1 );
QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_8, 0, 0 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
GeometryGUI_InertiaDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_InertiaDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_InertiaDlg::~GeometryGUI_InertiaDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_InertiaDlg::Init( SALOME_Selection* Sel )
{
LineEdit_L1C1->setMaxLength( 10 );
LineEdit_L1C2->setMaxLength( 10 );
LineEdit_L1C3->setMaxLength( 10 );
LineEdit_L2C1->setMaxLength( 10 );
LineEdit_L2C2->setMaxLength( 10 );
LineEdit_L2C3->setMaxLength( 10 );
LineEdit_L3C1->setMaxLength( 10 );
LineEdit_L3C2->setMaxLength( 10 );
LineEdit_L3C3->setMaxLength( 10 );
LineEdit_IX->setMaxLength( 10 );
LineEdit_IY->setMaxLength( 10 );
LineEdit_IZ->setMaxLength( 10 );
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( GroupConstructors, SIGNAL(clicked(int) ), this, SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_InertiaDlg::ConstructorsClicked(int constructorId)
{
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_InertiaDlg::ClickOnCancel()
{
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_InertiaDlg::SelectionIntoArgument()
{
LineEdit_L1C1->setText("") ;
LineEdit_L1C2->setText("") ;
LineEdit_L1C3->setText("") ;
LineEdit_L2C1->setText("") ;
LineEdit_L2C2->setText("") ;
LineEdit_L2C3->setText("") ;
LineEdit_L3C1->setText("") ;
LineEdit_L3C2->setText("") ;
LineEdit_L3C3->setText("") ;
LineEdit_IX->setText("") ;
LineEdit_IY->setText("") ;
LineEdit_IZ->setText("") ;
myEditCurrentArgument->setText("") ;
QString aString = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
return ;
}
/* nbSel == 1 */
TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) || S.IsNull() )
return ;
LineEditC1A1->setText(aString) ;
this->CalculateAndDisplayInertia(S) ;
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_InertiaDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_InertiaDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_InertiaDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_InertiaDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_InertiaDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_InertiaDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : CalculateAndDisplayInertia()
// purpose :
//=================================================================================
void GeometryGUI_InertiaDlg::CalculateAndDisplayInertia(const TopoDS_Shape& S)
{
LineEdit_L1C1->setText("") ;
LineEdit_L1C2->setText("") ;
LineEdit_L1C3->setText("") ;
LineEdit_L2C1->setText("") ;
LineEdit_L2C2->setText("") ;
LineEdit_L2C3->setText("") ;
LineEdit_L3C1->setText("") ;
LineEdit_L3C2->setText("") ;
LineEdit_L3C3->setText("") ;
LineEdit_IX->setText("") ;
LineEdit_IY->setText("") ;
LineEdit_IZ->setText("") ;
if( S.IsNull() )
return ;
try {
QString resString;
GProp_GProps System;
if ( S.ShapeType() == TopAbs_VERTEX || S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE ) {
BRepGProp::LinearProperties(S, System);
}
else if ( S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL ) {
BRepGProp::SurfaceProperties(S, System);
}
else {
BRepGProp::VolumeProperties(S, System);
}
gp_Mat I = System.MatrixOfInertia() ;
GProp_PrincipalProps Pr = System.PrincipalProperties();
Standard_Real Ix,Iy,Iz;
Pr.Moments(Ix,Iy,Iz);
/* matrix 3x3 */
resString = tr("%1").arg( I(1,1), 12, 'f', 6 ) ;
LineEdit_L1C1->setText(resString) ;
resString = tr("%1").arg( I(1,2), 12, 'f', 6 ) ;
LineEdit_L1C2->setText(resString) ;
resString = tr("%1").arg( I(1,3), 12, 'f', 6 ) ;
LineEdit_L1C3->setText(resString) ;
resString = tr("%1").arg( I(2,1), 12, 'f', 6 ) ;
LineEdit_L2C1->setText(resString) ;
resString = tr("%1").arg( I(2,2), 12, 'f', 6 ) ;
LineEdit_L2C2->setText(resString) ;
resString = tr("%1").arg( I(2,3), 12, 'f', 6 ) ;
LineEdit_L2C3->setText(resString) ;
resString = tr("%1").arg( I(3,1), 12, 'f', 6 ) ;
LineEdit_L3C1->setText(resString) ;
resString = tr("%1").arg( I(3,2), 12, 'f', 6 ) ;
LineEdit_L3C2->setText(resString) ;
resString = tr("%1").arg( I(3,3), 12, 'f', 6 ) ;
LineEdit_L3C3->setText(resString) ;
/* moments */
resString = tr("%1").arg( Ix, 12, 'f', 6 ) ;
LineEdit_IX->setText(resString) ;
resString = tr("%1").arg( Ix, 12, 'f', 6 ) ;
LineEdit_IY->setText(resString) ;
resString = tr("%1").arg( Iz, 12, 'f', 6 ) ;
LineEdit_IZ->setText(resString) ;
}
catch(Standard_Failure) {
MESSAGE("Catch intercepted in CalculateAndDisplayInertia()" << endl ) ;
}
return ;
}

View File

@ -1,124 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_InertiaDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_INERTIA_H
#define DIALOGBOX_INERTIA_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <BRepGProp.hxx>
#include <GProp_GProps.hxx>
#include <GProp_PrincipalProps.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_InertiaDlg
// purpose :
//=================================================================================
class GeometryGUI_InertiaDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_InertiaDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_InertiaDlg();
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
void CalculateAndDisplayInertia(const TopoDS_Shape& S) ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ;
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupC1;
QLabel* TextLabelC1A1;
QPushButton* SelectButtonC1A1;
QLineEdit* LineEditC1A1;
QLabel* TextLabel_Matrix;
QLabel* TextLabelMatrix_11;
QLabel* TextLabelMatrix_21;
QLabel* TextLabelMatrix_31;
QLineEdit* LineEdit_L1C1;
QLineEdit* LineEdit_L1C2;
QLineEdit* LineEdit_L1C3;
QLineEdit* LineEdit_L2C1;
QLineEdit* LineEdit_L2C2;
QLineEdit* LineEdit_L2C3;
QLineEdit* LineEdit_L3C1;
QLineEdit* LineEdit_L3C2;
QLineEdit* LineEdit_L3C3;
QLineEdit* LineEdit_IX;
QLineEdit* LineEdit_IY;
QLineEdit* LineEdit_IZ;
QLabel* TextLabel_IXIYIZ;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnCancel();
void SetEditCurrentArgument() ;
void LineEditReturnPressed() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_InertiaDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupButtonsLayout;
};
#endif // DIALOGBOX_INERTIA_H

View File

@ -1,518 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_LineDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_LineDlg.h"
#include "GeometryGUI.h"
#include <Precision.hxx>
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_LineDlg()
// purpose : Constructs a GeometryGUI_LineDlg 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.
//=================================================================================
GeometryGUI_LineDlg::GeometryGUI_LineDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_LINE_2P")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_LINE_PV")));
QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_LINE_EDGE")));
if ( !name )
setName( "GeometryGUI_LineDlg" );
resize( 303, 225 );
setCaption( tr( "GEOM_LINE_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_LineDlgLayout = new QGridLayout( this );
GeometryGUI_LineDlgLayout->setSpacing( 6 );
GeometryGUI_LineDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_LINE" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_3, 0, 5 );
GeometryGUI_LineDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_POINTS" ) );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
SelectButtonC1A2->setText( tr( "" ) );
SelectButtonC1A2->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_POINT_I" ).arg("1") );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_POINT_I" ).arg("2") );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
GeometryGUI_LineDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_LineDlgLayout->addWidget( GroupButtons, 2, 0 );
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_LineDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_LineDlg::~GeometryGUI_LineDlg()
{
/* no need to delete child widgets, Qt does it all for us */
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_LineDlg::Init( SALOME_Selection* Sel )
{
GroupC1->show();
// GroupC2->hide();
// GroupC3->hide();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myPoint1.SetCoord( 0.0, 0.0, 0.0 );
myPoint2.SetCoord( 0.0, 0.0, 0.0 );
myOkPoint1 = myOkPoint2 = false ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filters definition */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom );
mySelection->AddFilter(myVertexFilter) ; /* first filter used */
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_LineDlg::ConstructorsClicked(int constructorId)
{
myGeomGUI->EraseSimulationShape() ;
switch (constructorId)
{
case 0:
{
GroupC1->show();
//
//
myConstructorId = constructorId ;
myEditCurrentArgument = LineEditC1A1 ;
Constructor1->setChecked( TRUE );
LineEditC1A1->setText(tr("")) ;
LineEditC1A2->setText(tr("")) ;
myOkPoint1 = myOkPoint2 = false ;
/* filter for next selections */
mySelection->ClearFilters() ;
mySelection->AddFilter( myVertexFilter );
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
break;
}
case 1:
{
break;
}
case 2:
{
break;
}
}
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_LineDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_LineDlg::ClickOnApply()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
switch(myConstructorId)
{
case 0 :
{
if(myOkPoint1 && myOkPoint2)
myGeomGUI->MakeLineAndDisplay( myPoint1, myPoint2 ) ;
break ;
}
case 1 :
{
break ;
}
case 2 :
{
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_LineDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_LineDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender() ;
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else if ( send == LineEditC1A2 )
myEditCurrentArgument = LineEditC1A2 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_LineDlg::SelectionIntoArgument()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
if ( myEditCurrentArgument == LineEditC1A1 ) {
myEditCurrentArgument->setText("") ;
myOkPoint1 = false ;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
myEditCurrentArgument->setText("") ;
myOkPoint2 = false ;
}
return ;
}
// nbSel == 1 !
TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
/* Constructor 1 treatment */
if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
myEditCurrentArgument->setText(aString) ;
myOkPoint1 = true ;
}
else if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint(S, myPoint2) ) {
myEditCurrentArgument->setText(aString) ;
myOkPoint2 = true ;
}
if( myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion() ) {
mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape();
/* Try to add an arrow at simulation shape */
bool notNeedToTest = this->AddArrowToSimulation(mySimulationTopoDs) ;
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_LineDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
mySelection->ClearFilters() ;
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
}
else if(send == SelectButtonC1A2) {
LineEditC1A2->setFocus() ;
myEditCurrentArgument = LineEditC1A2;
}
mySelection->AddFilter(myVertexFilter) ;
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_LineDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
mySelection->ClearFilters() ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_LineDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_LineDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_LineDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ; /* same than click on cancel button */
}
//=================================================================================
// function : AddArrowToSimulation()
// purpose : An arrow (cone topology) is added to 'modifiedShape'
// : to simulate a vector or an 'oriented line' display. The result is in 'modifiedShape'.
// : If an arrow can't be added returns false and 'modifiedShape' isn't modified !
//=================================================================================
bool GeometryGUI_LineDlg::AddArrowToSimulation( TopoDS_Shape& modifiedShape )
{
TopoDS_Shape arrow ;
/* Try to add a cone simulation shape to show direction of a linear edge */
if( myGeomGUI->CreateArrowForLinearEdge( modifiedShape, arrow ) ) {
TopoDS_Compound Comp ;
BRep_Builder B;
B.MakeCompound (Comp);
B.Add( Comp, modifiedShape ) ;
B.Add( Comp, arrow ) ;
modifiedShape = Comp ;
return true ;
}
return false ;
}

View File

@ -1,125 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_LineDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_LINE_H
#define DIALOGBOX_LINE_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Pnt.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS_Compound.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_LineDlg
// purpose :
//=================================================================================
class GeometryGUI_LineDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_LineDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_LineDlg();
private :
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
SALOME_Selection* mySelection ; /* User shape selection */
gp_Pnt myPoint1 ; /* Points containing the vector */
gp_Pnt myPoint2 ;
bool myOkPoint1 ; /* Are true when myPoint is defined */
bool myOkPoint2 ;
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
int myConstructorId ; /* Current constructor id = radio button id */
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */
Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filter selection */
void closeEvent( QCloseEvent* e ) ;
void enterEvent( QEvent* e);
void Init( SALOME_Selection* Sel ) ;
bool AddArrowToSimulation( TopoDS_Shape& modifiedShape ) ;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QRadioButton* Constructor2;
QRadioButton* Constructor3;
QGroupBox* GroupC1;
QLabel* TextLabelC1A1;
QPushButton* SelectButtonC1A2;
QLineEdit* LineEditC1A1;
QLabel* TextLabelC1A2;
QLineEdit* LineEditC1A2;
QPushButton* SelectButtonC1A1;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void LineEditReturnPressed() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_LineDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupButtonsLayout;
};
#endif // DIALOGBOX_LINE_H

View File

@ -1,547 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_MaxToleranceDlg.cxx
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_MaxToleranceDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
// Open CASCADE Includes
#include <TopExp_Explorer.hxx>
#include <BRep_Tool.hxx>
// QT Includes
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_MaxToleranceDlg()
// purpose : Constructs a GeometryGUI_MaxToleranceDlg 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.
//=================================================================================
GeometryGUI_MaxToleranceDlg::GeometryGUI_MaxToleranceDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TOLERANCE")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_MaxToleranceDlg" );
resize( 303, 275 );
setCaption( tr( "GEOM_TOLERANCE_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_MaxToleranceDlgLayout = new QGridLayout( this );
GeometryGUI_MaxToleranceDlgLayout->setSpacing( 6 );
GeometryGUI_MaxToleranceDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_TOLERANCE" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 60, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_MaxToleranceDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" );
GroupConstructor1->setTitle( tr( "GEOM_TOLERANCE_CONSTR" ) );
GroupConstructor1->setColumnLayout(0, Qt::Vertical );
GroupConstructor1->layout()->setSpacing( 0 );
GroupConstructor1->layout()->setMargin( 0 );
GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() );
GroupConstructor1Layout->setAlignment( Qt::AlignTop );
GroupConstructor1Layout->setSpacing( 6 );
GroupConstructor1Layout->setMargin( 11 );
LineEditC1A1 = new QLineEdit( GroupConstructor1, "LineEditC1A1" );
LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
// GroupConstructor1Layout->addWidget( LineEditC1A1, 0, 2 );
SelectButtonC1A1 = new QPushButton( GroupConstructor1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
// GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 );
TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
// GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 );
QHBoxLayout* bl = new QHBoxLayout;
bl->setMargin(0); bl->setSpacing(6);
bl->addWidget(TextLabelC1A1); bl->addWidget(SelectButtonC1A1); bl->addWidget(LineEditC1A1);
GroupConstructor1Layout->addMultiCellLayout(bl, 0, 0, 0, 2);
TextLabel_Min = new QLabel( GroupConstructor1, "TextLabel_Min" );
TextLabel_Min->setText( tr( "GEOM_MIN" ) );
TextLabel_Min->setMinimumSize( QSize( 50, 0 ) );
TextLabel_Min->setFrameShape( QLabel::NoFrame );
TextLabel_Min->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabel_Min, 1, 1 );
TextLabel_Max = new QLabel( GroupConstructor1, "TextLabel_Max" );
TextLabel_Max->setText( tr( "GEOM_MAX" ) );
TextLabel_Max->setMinimumSize( QSize( 50, 0 ) );
TextLabel_Max->setFrameShape( QLabel::NoFrame );
TextLabel_Max->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabel_Max, 1, 2 );
TextLabel_Face = new QLabel( GroupConstructor1, "TextLabel_Face" );
TextLabel_Face->setText( tr( "GEOM_TOLERANCE_FACE" ) );
TextLabel_Face->setMinimumSize( QSize( 50, 0 ) );
TextLabel_Face->setFrameShape( QLabel::NoFrame );
TextLabel_Face->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabel_Face, 2, 0 );
LineEdit_MinFace = new QLineEdit( GroupConstructor1, "LineEdit_MinFace" );
LineEdit_MinFace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
LineEdit_MinFace->sizePolicy().hasHeightForWidth() ) );
//LineEdit_MinFace->setEnabled( FALSE );
LineEdit_MinFace->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_MinFace, 2, 1 );
LineEdit_MaxFace = new QLineEdit( GroupConstructor1, "LineEdit_MaxFace" );
LineEdit_MaxFace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
LineEdit_MaxFace->sizePolicy().hasHeightForWidth() ) );
//LineEdit_MaxFace->setEnabled( FALSE );
LineEdit_MaxFace->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_MaxFace, 2, 2 );
TextLabel_Edge = new QLabel( GroupConstructor1, "TextLabel_Edge" );
TextLabel_Edge->setText( tr( "GEOM_TOLERANCE_EDGE" ) );
TextLabel_Edge->setMinimumSize( QSize( 50, 0 ) );
TextLabel_Edge->setFrameShape( QLabel::NoFrame );
TextLabel_Edge->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabel_Edge, 3, 0 );
LineEdit_MinEdge = new QLineEdit( GroupConstructor1, "LineEdit_MinEdge" );
LineEdit_MinEdge->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
LineEdit_MinEdge->sizePolicy().hasHeightForWidth() ) );
//LineEdit_MinEdge->setEnabled( FALSE );
LineEdit_MinEdge->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_MinEdge, 3, 1 );
LineEdit_MaxEdge = new QLineEdit( GroupConstructor1, "LineEdit_MaxEdge" );
LineEdit_MaxEdge->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
LineEdit_MaxEdge->sizePolicy().hasHeightForWidth() ) );
//LineEdit_MaxEdge->setEnabled( FALSE );
LineEdit_MaxEdge->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_MaxEdge, 3, 2 );
TextLabel_Vertex = new QLabel( GroupConstructor1, "TextLabel_Vertex" );
TextLabel_Vertex->setText( tr( "GEOM_TOLERANCE_VERTEX" ) );
TextLabel_Vertex->setMinimumSize( QSize( 50, 0 ) );
TextLabel_Vertex->setFrameShape( QLabel::NoFrame );
TextLabel_Vertex->setFrameShadow( QLabel::Plain );
GroupConstructor1Layout->addWidget( TextLabel_Vertex, 4, 0 );
LineEdit_MinVertex = new QLineEdit( GroupConstructor1, "LineEdit_MinVertex" );
LineEdit_MinVertex->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
LineEdit_MinVertex->sizePolicy().hasHeightForWidth() ) );
//LineEdit_MinVertex->setEnabled( FALSE );
LineEdit_MinVertex->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_MinVertex, 4, 1 );
LineEdit_MaxVertex = new QLineEdit( GroupConstructor1, "LineEdit_MaxVertex" );
LineEdit_MaxVertex->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0,
LineEdit_MaxVertex->sizePolicy().hasHeightForWidth() ) );
//LineEdit_MaxVertex->setEnabled( FALSE );
LineEdit_MaxVertex->setReadOnly( TRUE );
GroupConstructor1Layout->addWidget( LineEdit_MaxVertex, 4, 2 );
GeometryGUI_MaxToleranceDlgLayout->addWidget( GroupConstructor1, 1, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 1 );
// buttonApply = new QPushButton( GroupButtons, "buttonApply" );
// buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
// buttonApply->setAutoDefault( TRUE );
// GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_8, 0, 0 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
// buttonOk = new QPushButton( GroupButtons, "buttonOk" );
// buttonOk->setText( tr( "GEOM_BUT_OK" ) );
// buttonOk->setAutoDefault( TRUE );
// buttonOk->setDefault( TRUE );
// GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_MaxToleranceDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_MaxToleranceDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_MaxToleranceDlg::~GeometryGUI_MaxToleranceDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_MaxToleranceDlg::Init( SALOME_Selection* Sel )
{
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_MaxToleranceDlg::ConstructorsClicked(int constructorId)
{
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_MaxToleranceDlg::ClickOnCancel()
{
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_MaxToleranceDlg::SelectionIntoArgument()
{
LineEdit_MinFace->setText("") ;
LineEdit_MinEdge->setText("") ;
LineEdit_MinVertex->setText("") ;
LineEdit_MaxFace->setText("") ;
LineEdit_MaxEdge->setText("") ;
LineEdit_MaxVertex->setText("") ;
myEditCurrentArgument->setText("") ;
QString aString = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
return ;
}
/* nbSel == 1 */
TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if( S.IsNull() ) {
myEditCurrentArgument->setText( "" );
return ;
}
LineEditC1A1->setText(aString) ;
this->CalculateMaxTolerance(S) ;
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_MaxToleranceDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_MaxToleranceDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_MaxToleranceDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ;
GroupConstructor1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_MaxToleranceDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupConstructor1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_MaxToleranceDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_MaxToleranceDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : CalculateMaxTolerance()
// purpose :
//=================================================================================
void GeometryGUI_MaxToleranceDlg::CalculateMaxTolerance(const TopoDS_Shape& S)
{
LineEdit_MinFace->setText("") ;
LineEdit_MinEdge->setText("") ;
LineEdit_MinVertex->setText("") ;
LineEdit_MaxFace->setText("") ;
LineEdit_MaxEdge->setText("") ;
LineEdit_MaxVertex->setText("") ;
if( S.IsNull() )
return ;
Standard_Real T,TMF,TME,TMV,TmF,TmE,TmV;
Standard_Integer nbF,nbE,nbV;
TMF=TME=TMV=-RealLast();
TmF=TmE=TmV=RealLast();
nbF=nbE=nbV=0;
bool m_isFace = false;
bool m_isEdge = false;
bool m_isVertex = false;
try
{
for( TopExp_Explorer ExF(S,TopAbs_FACE); ExF.More(); ExF.Next() )
{
m_isFace = true;
TopoDS_Face Face=TopoDS::Face(ExF.Current());
T=BRep_Tool::Tolerance(Face);
if(T>TMF) TMF=T;
if(T<TmF) TmF=T;
nbF++;
}
for( TopExp_Explorer ExE(S,TopAbs_EDGE); ExE.More(); ExE.Next() )
{
m_isEdge = true;
TopoDS_Edge Edge=TopoDS::Edge(ExE.Current());
T=BRep_Tool::Tolerance(Edge);
if(T>TME) TME=T;
if(T<TmE) TmE=T;
nbE++;
}
for( TopExp_Explorer ExV(S,TopAbs_VERTEX); ExV.More(); ExV.Next() )
{
m_isVertex = true;
TopoDS_Vertex Vertex=TopoDS::Vertex(ExV.Current());
T=BRep_Tool::Tolerance(Vertex);
if(T>TMV) TMV=T;
if(T<TmV) TmV=T;
nbV++;
}
if (m_isFace)
{
LineEdit_MinFace->setText( tr("%1").arg( TmF, 5, 'e', 8 ) ) ;
LineEdit_MaxFace->setText( tr("%1").arg( TMF, 5, 'e', 8 ) ) ;
}
else
{
LineEdit_MinFace->setText( "" ) ;
LineEdit_MaxFace->setText( "" ) ;
}
if (m_isEdge)
{
LineEdit_MinEdge->setText( tr("%1").arg( TmE, 5, 'e', 8 ) ) ;
LineEdit_MaxEdge->setText( tr("%1").arg( TME, 5, 'e', 8 ) ) ;
}
else
{
LineEdit_MinEdge->setText( "" ) ;
LineEdit_MaxEdge->setText( "" ) ;
}
if (m_isVertex)
{
LineEdit_MinVertex->setText( tr("%1").arg( TmV, 5, 'e', 8 ) ) ;
LineEdit_MaxVertex->setText( tr("%1").arg( TMV, 5, 'e', 8 ) ) ;
}
else
{
LineEdit_MinVertex->setText( "" ) ;
LineEdit_MaxVertex->setText( "" ) ;
}
}
catch(Standard_Failure)
{
MESSAGE("Catch intercepted in CalculateMaxTolerance()" << endl ) ;
}
return ;
}

View File

@ -1,119 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_MaxToleranceDlg.h
// Author : Nicolas REJNERI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_MAXTOLERANCE_H
#define DIALOGBOX_MAXTOLERANCE_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : DialogBox_PROPERTIES
// purpose :
//=================================================================================
class GeometryGUI_MaxToleranceDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_MaxToleranceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_MaxToleranceDlg();
private:
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
void CalculateMaxTolerance(const TopoDS_Shape& S) ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupConstructor1;
QLineEdit* LineEditC1A1;
QPushButton* SelectButtonC1A1;
QLabel* TextLabelC1A1;
QLabel* TextLabel_Min;
QLabel* TextLabel_Max;
QLabel* TextLabel_Face;
QLabel* TextLabel_Edge;
QLabel* TextLabel_Vertex;
QLineEdit* LineEdit_MinFace;
QLineEdit* LineEdit_MinEdge;
QLineEdit* LineEdit_MinVertex;
QLineEdit* LineEdit_MaxFace;
QLineEdit* LineEdit_MaxEdge;
QLineEdit* LineEdit_MaxVertex;
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnCancel();
void SetEditCurrentArgument() ;
void LineEditReturnPressed() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_MaxToleranceDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupConstructor1Layout;
QGridLayout* GroupButtonsLayout;
};
#endif // DIALOGBOX_MAXTOLERANCE_H

View File

@ -1,525 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_MirrorDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_MirrorDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
#include <Geom_Plane.hxx>
#include <BRep_Tool.hxx>
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_MirrorDlg()
// purpose : Constructs a GeometryGUI_MirrorDlg 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.
//=================================================================================
GeometryGUI_MirrorDlg::GeometryGUI_MirrorDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MIRROR")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_MirrorDlg" );
resize( 303, 225 );
setCaption( tr( "GEOM_MIRROR_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_MirrorDlgLayout = new QGridLayout( this );
GeometryGUI_MirrorDlgLayout->setSpacing( 6 );
GeometryGUI_MirrorDlgLayout->setMargin( 11 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_MirrorDlgLayout->addWidget( GroupButtons, 2, 0 );
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_MIRROR" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 1 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
GeometryGUI_MirrorDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_PLANE_MIRROR" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
TextLabelC1A2->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
SelectButtonC1A2->setText( tr( "" ) );
SelectButtonC1A2->setPixmap( image1 );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
GeometryGUI_MirrorDlgLayout->addWidget( GroupC1, 1, 0 );
/* Initialisation */
Init( Sel ) ;
}
//=================================================================================
// function : ~GeometryGUI_MirrorDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_MirrorDlg::~GeometryGUI_MirrorDlg()
{
/* no need to delete child widgets, Qt does it all for us */
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_MirrorDlg::Init( SALOME_Selection* Sel )
{
mySelection = Sel ;
myShape1.Nullify() ;
myShape2.Nullify() ;
mySimulationTopoDs.Nullify() ;
myConstructorId = 0 ;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
GroupC1->show();
myEditCurrentArgument = LineEditC1A1 ;
Constructor1->setChecked( TRUE );
myOkShape1 = myOkShape2 = false ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* Filter definition */
myFaceFilter = new GEOM_FaceFilter( StdSelect_Plane, myGeom );
// TODO previous selection into argument ?
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* Displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_MirrorDlg::ConstructorsClicked(int constructorId)
{
GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ;
switch (constructorId)
{
case 0:
{
GroupC1->show();
myConstructorId = constructorId ;
myEditCurrentArgument = LineEditC1A1 ;
LineEditC1A2->setText(tr("")) ;
Constructor1->setChecked( TRUE );
myOkShape1 = myOkShape2 = false ;
break;
}
}
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_MirrorDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_MirrorDlg::ClickOnApply()
{
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
{
case 0 :
{
if(myOkShape1 && myOkShape2) {
myGeomGUI->MakeMirrorAndDisplay(myGeomShape1 ,myGeomShape2 ) ;
}
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_MirrorDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
//=================================================================================
void GeometryGUI_MirrorDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("") ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
switch (myConstructorId)
{
case 0:
{
if ( myEditCurrentArgument == LineEditC1A1 ) {
myOkShape1 = false ;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
myOkShape2 = false ;
}
break ;
}
}
return ;
}
/* nbSel == 1 */
TopoDS_Shape S;
Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if ( myEditCurrentArgument == LineEditC1A1 ) {
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
myShape1 = S ;
LineEditC1A1->setText(aString) ;
myOkShape1 = true ;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
myShape2 = S ;
LineEditC1A2->setText(aString) ;
myOkShape2 = true ;
}
if(myOkShape1 && myOkShape2) {
MakeMirrorSimulationAndDisplay( myShape1, myShape2 ) ;
}
return ;
}
//=================================================================================
// function : MakeMirrorSimulationAndDisplay()
// purpose : S1 is a shape and S2 a mirror.
//=================================================================================
void GeometryGUI_MirrorDlg::MakeMirrorSimulationAndDisplay( const TopoDS_Shape& S1, const TopoDS_Shape& S2 )
{
this->mySimulationTopoDs.Nullify() ;
try {
Handle(Geom_Surface) surf = BRep_Tool::Surface(TopoDS::Face(S2)) ;
Handle(Geom_Plane) myPlane = Handle(Geom_Plane)::DownCast(surf) ;
const gp_Ax3 pos = myPlane->Position() ;
const gp_Pnt loc = pos.Location() ; /* location of the plane */
const gp_Dir dir = pos.Direction() ; /* Main direction of the plane (Z axis) */
/* plane used for mirroring */
gp_Ax2 pln(loc, dir) ;
gp_Trsf theTransformation ;
theTransformation.SetMirror(pln) ;
BRepBuilderAPI_Transform myBRepTransformation( S1, theTransformation, Standard_False ) ;
this->mySimulationTopoDs = myBRepTransformation.Shape() ;
if( this->mySimulationTopoDs.IsNull() )
return ;
else
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
}
catch(Standard_Failure) {
MESSAGE( "Exception catched in MakeMirrorSimulationAndDisplay" ) ;
return ;
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_MirrorDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0:
{
if( send == SelectButtonC1A1 ) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1 ;
mySelection->ClearFilters() ;
SelectionIntoArgument() ;
}
else if(send == SelectButtonC1A2) {
LineEditC1A2->setFocus() ;
myEditCurrentArgument = LineEditC1A2;
mySelection->AddFilter(myFaceFilter) ;
SelectionIntoArgument() ;
}
break;
}
}
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_MirrorDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else if ( send == LineEditC1A2 )
myEditCurrentArgument = LineEditC1A2 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_MirrorDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
}
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_MirrorDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ; /* same than click on cancel button */
}
//=================================================================================
// function : enterEvent()
// purpose : when mouse enter onto the QWidget
//=================================================================================
void GeometryGUI_MirrorDlg::enterEvent( QEvent * )
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_MirrorDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate any active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ;
}

View File

@ -1,118 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_MirrorDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_MIRROR_H
#define DIALOGBOX_MIRROR_H
#include "SALOME_Selection.h"
#include "GEOM_FaceFilter.hxx"
#include <BRepBuilderAPI_Transform.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_MirrorDlg
// purpose :
//=================================================================================
class GeometryGUI_MirrorDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_MirrorDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_MirrorDlg();
private :
void closeEvent( QCloseEvent* e ) ;
void enterEvent( QEvent* e); /* Mouse enter the QWidget */
void Init( SALOME_Selection* Sel ) ;
void MakeMirrorSimulationAndDisplay( const TopoDS_Shape& S1, const TopoDS_Shape& S2 ) ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape myShape1 ; /* topology used */
TopoDS_Shape myShape2 ; /* topology used */
GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */
GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
bool myOkShape1 ;
bool myOkShape2 ; /* to check when arguments are defined */
int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
Handle(GEOM_FaceFilter) myFaceFilter; /* To filter selections */
QGroupBox* GroupButtons;
QPushButton* buttonApply;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupC1;
QLabel* TextLabelC1A1;
QLabel* TextLabelC1A2;
QPushButton* SelectButtonC1A1;
QPushButton* SelectButtonC1A2;
QLineEdit* LineEditC1A1;
QLineEdit* LineEditC1A2;
private slots :
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void LineEditReturnPressed() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
protected:
QGridLayout* GeometryGUI_MirrorDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
};
#endif // DIALOGBOX_MIRROR_H

View File

@ -1,986 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_MultiTranslationDlg.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_MultiRotationDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
#include "utilities.h"
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRep_Builder.hxx>
#include <BRepGProp.hxx>
#include <GProp_GProps.hxx>
#include <TopoDS_Compound.hxx>
#include <Geom_Line.hxx>
#include <Precision.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qvalidator.h>
#include <qpixmap.h>
#include <qspinbox.h>
//=================================================================================
// class : GeometryGUI_MultiRotationDlg()
// purpose : Constructs a GeometryGUI_MultiRotationDlg 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.
//=================================================================================
GeometryGUI_MultiRotationDlg::GeometryGUI_MultiRotationDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MULTIROTATION_SIMPLE")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MULTIROTATION_DOUBLE")));
if ( !name )
setName( "GeometryGUI_MultiTranlationDlg" );
resize( 303, 251 );
setCaption( tr( "GEOM_MULTIROTATION_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_MultiRotationDlgLayout = new QGridLayout( this );
GeometryGUI_MultiRotationDlgLayout->setSpacing( 6 );
GeometryGUI_MultiRotationDlgLayout->setMargin( 11 );
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_MULTIROTATION" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" );
Constructor2->setText( tr( "" ) );
Constructor2->setPixmap( image2 );
Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) );
Constructor2->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor2, 0, 2 );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_2, 0, 3 );
QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer_3, 0, 1 );
GeometryGUI_MultiRotationDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_MultiRotationDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_MULTIROTATION_SIMPLE" ) );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
TextLabelC1A2->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
TextLabelC1A3->setText( tr( "GEOM_NB_TIMES" ) );
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A3->setFrameShape( QLabel::NoFrame );
TextLabelC1A3->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
/* a QSpinBox */
SpinBox_C1A3 = new QSpinBox( GroupC1, "SpinBox_C1A3" ) ;
SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
SelectButtonC1A2->setText( tr( "" ) );
SelectButtonC1A2->setPixmap( image1 );
SelectButtonC1A2->setToggleButton( FALSE );
SelectButtonC1A2->setMaximumSize( QSize( 28, 32767 ) );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
GeometryGUI_MultiRotationDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
GroupC2 = new QGroupBox( this, "GroupC2" );
GroupC2->setTitle( tr( "GEOM_MULTIROTATION_DOUBLE" ) );
GroupC2->setMinimumSize( QSize( 0, 0 ) );
GroupC2->setFrameShape( QGroupBox::Box );
GroupC2->setFrameShadow( QGroupBox::Sunken );
GroupC2->setColumnLayout(0, Qt::Vertical );
GroupC2->layout()->setSpacing( 0 );
GroupC2->layout()->setMargin( 0 );
GroupC2Layout = new QGridLayout( GroupC2->layout() );
GroupC2Layout->setAlignment( Qt::AlignTop );
GroupC2Layout->setSpacing( 6 );
GroupC2Layout->setMargin( 11 );
TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" );
TextLabelC2A1->setText( tr( "GEOM_MAIN_OBJECT" ) );
TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC2A1->setFrameShape( QLabel::NoFrame );
TextLabelC2A1->setFrameShadow( QLabel::Plain );
GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 );
TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" );
TextLabelC2A2->setText( tr( "GEOM_VECTOR" ) );
TextLabelC2A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC2A2->setFrameShape( QLabel::NoFrame );
TextLabelC2A2->setFrameShadow( QLabel::Plain );
GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 );
TextLabelC2A3 = new QLabel( GroupC2, "TextLabelC2A3" );
TextLabelC2A3->setText( tr( "GEOM_ANGLE" ) );
TextLabelC2A3->setMinimumSize( QSize( 50, 0 ) );
TextLabelC2A3->setFrameShape( QLabel::NoFrame );
TextLabelC2A3->setFrameShadow( QLabel::Plain );
GroupC2Layout->addWidget( TextLabelC2A3, 2, 0 );
TextLabelC2A4 = new QLabel( GroupC2, "TextLabelC2A4" );
TextLabelC2A4->setText( tr( "GEOM_NB_TIMES" ) );
TextLabelC2A4->setMinimumSize( QSize( 50, 0 ) );
TextLabelC2A4->setFrameShape( QLabel::NoFrame );
TextLabelC2A4->setFrameShadow( QLabel::Plain );
GroupC2Layout->addWidget( TextLabelC2A4, 3, 0 );
TextLabelC2A5 = new QLabel( GroupC2, "TextLabelC2A5" );
TextLabelC2A5->setText( tr( "GEOM_STEP" ) );
TextLabelC2A5->setMinimumSize( QSize( 50, 0 ) );
TextLabelC2A5->setFrameShape( QLabel::NoFrame );
TextLabelC2A5->setFrameShadow( QLabel::Plain );
GroupC2Layout->addWidget( TextLabelC2A5, 5, 0 );
TextLabelC2A6 = new QLabel( GroupC2, "TextLabelC2A6" );
TextLabelC2A6->setText( tr( "GEOM_NB_TIMES" ) );
TextLabelC2A6->setMinimumSize( QSize( 50, 0 ) );
TextLabelC2A6->setFrameShape( QLabel::NoFrame );
TextLabelC2A6->setFrameShadow( QLabel::Plain );
GroupC2Layout->addWidget( TextLabelC2A6, 6, 0 );
LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" );
GroupC2Layout->addWidget( LineEditC2A1, 0, 2 );
LineEditC2A2 = new QLineEdit( GroupC2, "LineEditC2A2" );
GroupC2Layout->addWidget( LineEditC2A2, 1, 2 );
/* a GeometryGUI_SpinBox */
SpinBox_C2A3 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A3" ) ;
SpinBox_C2A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A3->sizePolicy().hasHeightForWidth() ) );
GroupC2Layout->addWidget( SpinBox_C2A3, 2, 2 );
/* a QSpinBox */
SpinBox_C2A4 = new QSpinBox( GroupC2, "SpinBox_C2A4" ) ;
SpinBox_C2A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A4->sizePolicy().hasHeightForWidth() ) );
GroupC2Layout->addWidget( SpinBox_C2A4, 3, 2 );
/* a GeometryGUI_SpinBox */
SpinBox_C2A5 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A5" ) ;
SpinBox_C2A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A5->sizePolicy().hasHeightForWidth() ) );
GroupC2Layout->addWidget( SpinBox_C2A5, 5, 2 );
/* a QSpinBox */
SpinBox_C2A6 = new QSpinBox( GroupC2, "SpinBox_C2A6" ) ;
SpinBox_C2A6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A6->sizePolicy().hasHeightForWidth() ) );
GroupC2Layout->addWidget( SpinBox_C2A6, 6, 2 );
CheckBoxReverse = new QCheckBox( GroupC2, "CheckBoxReverse" );
CheckBoxReverse->setText( tr( "GEOM_REVERSE" ) );
GroupC2Layout->addWidget( CheckBoxReverse, 4, 0 );
SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" );
SelectButtonC2A1->setText( tr( "" ) );
SelectButtonC2A1->setPixmap( image1 );
SelectButtonC2A1->setToggleButton( FALSE );
SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) );
GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 );
SelectButtonC2A2 = new QPushButton( GroupC2, "SelectButtonC2A2" );
SelectButtonC2A2->setText( tr( "" ) );
SelectButtonC2A2->setPixmap( image1 );
SelectButtonC2A2->setToggleButton( FALSE );
SelectButtonC2A2->setMaximumSize( QSize( 28, 32767 ) );
GroupC2Layout->addWidget( SelectButtonC2A2, 1, 1 );
GeometryGUI_MultiRotationDlgLayout->addWidget( GroupC2, 1, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_MultiRotationDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_MultiRotationDlg::~GeometryGUI_MultiRotationDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_MultiRotationDlg::Init( SALOME_Selection* Sel )
{
/* Get setting of step value from file configuration */
double step ;
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
step = St.toDouble() ;
/* min, max, step and decimals for geom spin boxes */
SpinBox_C2A3->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* angle : constructor 2 */
SpinBox_C2A3->SetValue( 45.0 ) ;
SpinBox_C2A5->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* step : constructor 2 */
SpinBox_C2A5->SetValue( 50.0 ) ;
/* min, max, step for QT spin boxes */
SpinBox_C1A3->setMinValue( 2 ); /* myNbTimes : constructor 1 */
SpinBox_C1A3->setMaxValue( 10000 );
SpinBox_C1A3->setWrapping( TRUE );
SpinBox_C1A3->setValue(2) ;
SpinBox_C2A4->setMinValue( 2 ); /* myNbTimes1 : constructor 2 */
SpinBox_C2A4->setMaxValue( 10000 );
SpinBox_C2A4->setWrapping( TRUE );
SpinBox_C2A4->setValue(2) ;
SpinBox_C2A6->setMinValue( 2 ); /* myNbTimes2 : constructor 2 */
SpinBox_C2A6->setMaxValue( 10000 );
SpinBox_C2A6->setWrapping( TRUE );
SpinBox_C2A6->setValue(2) ;
myAng = 45.0 ;
myStep = 50.0 ;
myNbTimes1 = 2;
myNbTimes2 = 2;
GroupC1->show();
GroupC2->hide() ;
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myOkBase = myOkDir = false ;
mySimulationTopoDs.Nullify() ;
myBase.Nullify() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : set previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom );
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC2A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC2A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
/* GeometryGUI_SpinBox */
connect( SpinBox_C2A3, SIGNAL ( valueChanged( double) ), this, SLOT( valueChangedInSpinBox( double) ) ) ;
connect( SpinBox_C2A5, SIGNAL ( valueChanged( double) ), this, SLOT( valueChangedInSpinBox( double) ) ) ;
/* QSpinBox */
connect( SpinBox_C1A3, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; /* Not const ! */
connect( SpinBox_C2A4, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ;
connect( SpinBox_C2A6, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ;
connect( CheckBoxReverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle(int) ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ReverseAngle()
// purpose : 'state' not used here
//=================================================================================
void GeometryGUI_MultiRotationDlg::ReverseAngle(int state)
{
myAng = -myAng ;
SpinBox_C2A3->SetValue( myAng ) ;
if( myOkBase && myOkDir ) {
MakeMultiRotationSimulationAndDisplay() ;
}
else {
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_MultiRotationDlg::ConstructorsClicked(int constructorId)
{
myEditCurrentArgument->setText(tr("")) ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myAng = 45.0 ;
myStep = 50.0 ;
myNbTimes1 = 2;
myNbTimes2 = 2;
myOkBase = myOkDir = false ;
myConstructorId = constructorId ;
switch (constructorId)
{
case 0: /* Rotate simple */
{
GroupC1->show();
GroupC2->hide() ;
myEditCurrentArgument = LineEditC1A1 ;
SpinBox_C1A3->setValue( 2 ) ;
LineEditC1A1->setText(tr("")) ;
LineEditC1A2->setText(tr("")) ;
break;
}
case 1: /* Rotate double */
{
GroupC1->hide();
GroupC2->show() ;
myEditCurrentArgument = LineEditC2A1 ;
SpinBox_C2A3->SetValue( 45.0 ) ;
SpinBox_C2A4->setValue( 2 ) ;
SpinBox_C2A5->SetValue( 50.0 ) ;
SpinBox_C2A6->setValue( 2 ) ;
LineEditC2A1->setText(tr("")) ;
LineEditC2A2->setText(tr("")) ;
break ;
}
}
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_MultiRotationDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_MultiRotationDlg::ClickOnApply()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
{
case 0 :
{
if(myOkBase && myOkDir) {
myGeomGUI->MakeMultiRotation1DAndDisplay( myGeomShape, myDir, myLoc, myNbTimes1 ) ;
}
break ;
}
case 1 :
{
if(myOkBase && myOkDir) {
myGeomGUI->MakeMultiRotation2DAndDisplay( myGeomShape, myDir, myLoc, myAng, myNbTimes1, myStep, myNbTimes2 ) ;
}
break ;
}
}
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_MultiRotationDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_MultiRotationDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender() ;
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else if ( send == LineEditC1A2 )
myEditCurrentArgument = LineEditC1A2 ;
else if ( send == LineEditC2A1 )
myEditCurrentArgument = LineEditC2A1;
else if ( send == LineEditC2A2 )
myEditCurrentArgument = LineEditC2A2 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_MultiRotationDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("") ;
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
/* Name of future selection */
QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
TopoDS_Shape S;
Standard_Boolean testResult ;
switch (myConstructorId)
{
case 0 :
{
if ( nbSel != 1 ) {
if ( myEditCurrentArgument == LineEditC1A1 ) {
myEditCurrentArgument->setText("") ;
myOkBase = false ;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
myEditCurrentArgument->setText("") ;
myOkDir = false ;
}
return ;
}
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if ( myEditCurrentArgument == LineEditC1A1 ) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
myEditCurrentArgument->setText(aString) ;
myBase = S ;
myOkBase = true ;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
BRepAdaptor_Curve curv(TopoDS::Edge(S));
myDir = curv.Line().Direction();
myLoc = curv.Line().Location();
myEditCurrentArgument->setText(aString) ;
myOkDir = true ;
}
if (myOkBase && myOkDir ) {
MakeMultiRotationSimulationAndDisplay() ;
}
else {
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
}
case 1 :
{
if ( nbSel != 1 ) {
if ( myEditCurrentArgument == LineEditC2A1 ) {
myEditCurrentArgument->setText("") ;
myOkBase = false ;
}
else if ( myEditCurrentArgument == LineEditC2A2 ) {
myEditCurrentArgument->setText("") ;
myOkDir = false ;
}
return ;
}
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
if ( myEditCurrentArgument == LineEditC2A1 ) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
myEditCurrentArgument->setText(aString) ;
myBase = S ;
myOkBase = true ;
}
else if ( myEditCurrentArgument == LineEditC2A2 ) {
BRepAdaptor_Curve curv(TopoDS::Edge(S));
myDir = curv.Line().Direction();
myLoc = curv.Line().Location();
myEditCurrentArgument->setText(aString) ;
myOkDir = true ;
}
if ( myOkBase && myOkDir ) {
MakeMultiRotationSimulationAndDisplay() ;
}
else {
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
}
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_MultiRotationDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0 :
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
mySelection->ClearFilters() ;
}
else if(send == SelectButtonC1A2) {
LineEditC1A2->setFocus() ;
myEditCurrentArgument = LineEditC1A2;
mySelection->AddFilter(myEdgeFilter) ;
}
SelectionIntoArgument() ;
break;
}
case 1 :
{
if(send == SelectButtonC2A1) {
LineEditC2A1->setFocus() ;
myEditCurrentArgument = LineEditC2A1;
mySelection->ClearFilters() ;
}
else if(send == SelectButtonC2A2) {
LineEditC2A2->setFocus() ;
myEditCurrentArgument = LineEditC2A2;
mySelection->AddFilter(myEdgeFilter) ;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : ValueChangedInt()
// purpose :
//=================================================================================
void GeometryGUI_MultiRotationDlg::ValueChangedInt( int newIntValue )
{
QSpinBox* send = (QSpinBox*)sender();
if( send == SpinBox_C1A3 ) {
myNbTimes1 = newIntValue ;
}
else if(send == SpinBox_C2A4 ) {
myNbTimes1 = newIntValue ;
}
else if(send == SpinBox_C2A6 ) {
myNbTimes2 = newIntValue ;
}
switch (myConstructorId)
{
case 0 :
{
if (myOkBase && myOkDir ) {
MakeMultiRotationSimulationAndDisplay() ;
}
else {
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
}
case 1 :
{
if (myOkBase && myOkDir ) {
MakeMultiRotationSimulationAndDisplay() ;
}
else {
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
}
}
return ;
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose : (specifig for GeometryGUI_SpinBox)
//=================================================================================
void GeometryGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue )
{
GeometryGUI_SpinBox* send = (GeometryGUI_SpinBox*)sender();
if( send == SpinBox_C2A3 ) {
myAng = newValue ;
}
else if( send == SpinBox_C2A5 ) {
myStep = newValue ;
}
switch (myConstructorId)
{
case 0 :
{
if (myOkBase && myOkDir ) {
MakeMultiRotationSimulationAndDisplay() ;
}
else {
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
}
case 1 :
{
if (myOkBase && myOkDir ) {
MakeMultiRotationSimulationAndDisplay() ;
}
else {
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
}
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_MultiRotationDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupC2->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
mySelection->ClearFilters() ;
myGeomGUI->ResetState() ;
myGeomGUI->SetActiveDialogBox(0) ;
myGeomGUI->OnDisplayAll(true) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_MultiRotationDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupC2->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_MultiRotationDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_MultiRotationDlg::closeEvent( QCloseEvent* e )
{
this->ClickOnCancel() ; /* same than click on cancel button */
return ;
}
//=================================================================================
// function : MakeMultiRotationSimulationAndDisplay()
// purpose :
//=================================================================================
void GeometryGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay()
{
myGeomGUI->EraseSimulationShape() ;
gp_Trsf theTransformation ;
gp_Trsf theTransformation1 ;
gp_Trsf theTransformation2 ;
mySimulationTopoDs.Nullify() ;
int i ;
int j ;
Standard_Real DX ;
Standard_Real DY ;
Standard_Real DZ ;
GProp_GProps System ;
gp_Pnt myPoint ;
TopoDS_Compound compound;
BRep_Builder B;
B.MakeCompound( compound );
if ( myBase.ShapeType() == TopAbs_VERTEX) {
myGeomGUI->VertexToPoint( myBase, myPoint );
}
else if ( myBase.ShapeType() == TopAbs_EDGE || myBase.ShapeType() == TopAbs_WIRE ) {
BRepGProp::LinearProperties(myBase, System);
myPoint = System.CentreOfMass() ;
}
else if ( myBase.ShapeType() == TopAbs_FACE || myBase.ShapeType() == TopAbs_SHELL ) {
BRepGProp::SurfaceProperties(myBase, System);
myPoint = System.CentreOfMass() ;
}
else {
BRepGProp::VolumeProperties(myBase, System);
myPoint = System.CentreOfMass() ;
}
TopoDS_Shape S = BRepBuilderAPI_MakeVertex(myPoint).Shape();
try {
switch (myConstructorId)
{
case 0 :
{
gp_Ax1 AX1( myLoc, myDir ) ;
Standard_Real angle = 360/myNbTimes1;
for ( i = 0; i < myNbTimes1; i++ ) {
theTransformation.SetRotation(AX1, i*angle*PI180) ;
BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False) ;
B.Add( compound, myBRepTransformation.Shape() );
}
mySimulationTopoDs = compound;
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
break;
}
case 1 :
{
gp_Ax1 AX2( myLoc, myDir ) ;
Handle(Geom_Line) Line = new Geom_Line(AX2);
gp_Pnt P2 = GeomAPI_ProjectPointOnCurve( myPoint, Line ) ;
if ( myPoint.IsEqual(P2, Precision::Confusion() ) )
return;
gp_Vec Vec(P2, myPoint) ;
Vec.Normalize();
for ( i = 0; i < myNbTimes2; i++ ) {
for ( j = 0; j < myNbTimes1; j++ ) {
DX = i * myStep * Vec.X() ;
DY = i * myStep * Vec.Y() ;
DZ = i * myStep * Vec.Z() ;
myVec.SetCoord( DX, DY, DZ ) ;
theTransformation1.SetTranslation(myVec) ;
theTransformation2.SetRotation(AX2, j*myAng*PI180) ;
BRepBuilderAPI_Transform myBRepTransformation1(S, theTransformation1, Standard_False) ;
BRepBuilderAPI_Transform myBRepTransformation2(myBRepTransformation1.Shape(), theTransformation2, Standard_False) ;
B.Add( compound, myBRepTransformation2.Shape() );
}
}
mySimulationTopoDs = compound ;
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
break;
}
}
}
catch(Standard_Failure) {
MESSAGE( "Exception catched in MakeMultitranslationSimulationAndDisplay" ) ;
return ;
}
return ;
}

View File

@ -1,162 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_MultiRotationDlg.h
// Author : Damien COQUERET
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_MULTIROTATION_H
#define DIALOGBOX_MULTIROTATION_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include "GEOM_EdgeFilter.hxx"
#include "GeometryGUI_SpinBox.h"
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QCheckBox;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QSpinBox;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_MultiRotationDlg
// purpose :
//=================================================================================
class GeometryGUI_MultiRotationDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_MultiRotationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_MultiRotationDlg();
private :
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */
SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape myBase ;
GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */
gp_Vec myVec ;
int myNbTimes1 ;
int myNbTimes2 ;
Standard_Real myAng ;
Standard_Real myStep ;
gp_Dir myDir ;
gp_Pnt myLoc ;
bool myOkBase ;
bool myOkDir ;
bool myOkAng ;
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
int myConstructorId ; /* Current constructor id = radio button id */
Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
void closeEvent( QCloseEvent* e ) ;
void enterEvent( QEvent* e);
void Init( SALOME_Selection* Sel ) ;
void MakeMultiRotationSimulationAndDisplay() ;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QRadioButton* Constructor2;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QGroupBox* GroupC1;
QPushButton* SelectButtonC1A1;
QPushButton* SelectButtonC1A2;
QLabel* TextLabelC1A1;
QLabel* TextLabelC1A2;
QLabel* TextLabelC1A3;
QLineEdit* LineEditC1A1;
QLineEdit* LineEditC1A2;
QSpinBox* SpinBox_C1A3; /* int : Nb times */
QGroupBox* GroupC2;
QPushButton* SelectButtonC2A1;
QPushButton* SelectButtonC2A2;
QLabel* TextLabelC2A1;
QLabel* TextLabelC2A2;
QLabel* TextLabelC2A3;
QLabel* TextLabelC2A4;
QLabel* TextLabelC2A5;
QLabel* TextLabelC2A6;
QLineEdit* LineEditC2A1;
QLineEdit* LineEditC2A2;
GeometryGUI_SpinBox* SpinBox_C2A3 ; /* double : angle */
QSpinBox* SpinBox_C2A4; /* int : Nb times 1 */
GeometryGUI_SpinBox* SpinBox_C2A5 ; /* double : step value */
QSpinBox* SpinBox_C2A6; /* int : Nb times 2 */
QCheckBox* CheckBoxReverse;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void LineEditReturnPressed() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
void ReverseAngle(int) ;
void ValueChangedInSpinBox( double newValue ) ; /* for GeometryGUI_SpinBox */
void ValueChangedInt( int newIntValue ) ; /* for QT spin box ! not const ! */
protected:
QGridLayout* GeometryGUI_MultiRotationDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
};
#endif // DIALOGBOX_MULTIROTATION_H

File diff suppressed because it is too large Load Diff

View File

@ -1,169 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_MultiTranslationDlg.h
// Author : Damien COQUERET
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_MULTITRANSLATION_H
#define DIALOGBOX_MULTITRANSLATION_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include "GEOM_EdgeFilter.hxx"
#include "GeometryGUI_SpinBox.h"
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QCheckBox;
class QGroupBox;
class QLabel;
class QSpinBox;
class QLineEdit;
class QPushButton;
class QSpinBox;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_MultiTranslationDlg
// purpose :
//=================================================================================
class GeometryGUI_MultiTranslationDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_MultiTranslationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_MultiTranslationDlg();
private :
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */
SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape myBase ;
GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */
gp_Vec myVec ;
int myNbTimes1 ;
int myNbTimes2 ;
Standard_Real myStep1 ;
Standard_Real myStep2 ;
gp_Dir myDir1 ;
gp_Dir myDir2 ;
bool myOkBase ;
bool myOkDir1 ;
bool myOkDir2 ;
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
int myConstructorId ; /* Current constructor id = radio button id */
Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
void closeEvent( QCloseEvent* e ) ;
void enterEvent( QEvent* e);
void Init( SALOME_Selection* Sel ) ;
void MakeMultiTranslationSimulationAndDisplay() ;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QRadioButton* Constructor2;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QGroupBox* GroupC1;
QPushButton* SelectButtonC1A2;
QLineEdit* LineEditC1A1;
QLineEdit* LineEditC1A2;
QPushButton* SelectButtonC1A1;
QLabel* TextLabelC1A1;
QLabel* TextLabelC1A2;
QLabel* TextLabelC1A3;
QLabel* TextLabelC1A4;
GeometryGUI_SpinBox* SpinBox_C1A3 ;
QSpinBox* SpinBox_C1A4 ;
QGroupBox* GroupC2;
QPushButton* SelectButtonC2A2;
QLineEdit* LineEditC2A1;
QLineEdit* LineEditC2A2;
QPushButton* SelectButtonC2A1;
QLineEdit* LineEditC2A3;
QPushButton* SelectButtonC2A3;
QLabel* TextLabelC2A1;
QLabel* TextLabelC2A2;
QLabel* TextLabelC2A3;
QLabel* TextLabelC2A4;
QLabel* TextLabelC2A5;
QLabel* TextLabelC2A6;
QLabel* TextLabelC2A7;
GeometryGUI_SpinBox* SpinBox_C2A4 ;
QSpinBox* SpinBox_C2A5;
GeometryGUI_SpinBox* SpinBox_C2A6 ;
QSpinBox* SpinBox_C2A7 ;
QCheckBox* CheckBoxReverse0;
QCheckBox* CheckBoxReverse1;
QCheckBox* CheckBoxReverse2;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
void LineEditReturnPressed() ;
void ReverseAngle1(int) ;
void ReverseAngle2(int) ;
void ValueChangedInSpinBox( double newValue ) ; /* for GeometryGUI_SpinBox */
void ValueChangedInt( int newIntValue ) ; /* for QT spin box ! not const ! */
protected:
QGridLayout* GeometryGUI_MultiTranslationDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
};
#endif // DIALOGBOX_MULTITRANSLATION_H

View File

@ -1,135 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_NbIsosDlg.cxx
// Author :
// Module : GEOM
// $Header:
using namespace std;
#include "GeometryGUI_NbIsosDlg.h"
#include "GeometryGUI.h"
#include "QAD_Tools.h"
#include <qlabel.h>
#include <qpushbutton.h>
#include <qgroupbox.h>
#include <qlayout.h>
#include <qspinbox.h>
//=================================================================================
// class : GeometryGUI_NbIsosDlg()
// purpose : Constructs a GeometryGUI_NbIsosDlg 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.
//=================================================================================
GeometryGUI_NbIsosDlg::GeometryGUI_NbIsosDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
if ( !name )
setName( "GeometryGUI_NbIsosDlg" );
setCaption( name );
setSizeGripEnabled( TRUE );
QGridLayout* MyDialogLayout = new QGridLayout( this );
MyDialogLayout->setSpacing( 6 );
MyDialogLayout->setMargin( 11 );
/***************************************************************/
QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabel1 = new QLabel( GroupC1, "TextLabel1" );
TextLabel1->setText( tr( "GEOM_MEN_ISOU") );
GroupC1Layout->addWidget( TextLabel1, 0, 0 );
SpinBoxU = new QSpinBox( GroupC1, "SpinBoxU" );
SpinBoxU->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SpinBoxU->setMinValue( 1 );
SpinBoxU->setValue( 1 );
GroupC1Layout->addWidget( SpinBoxU, 0, 1 );
TextLabel2 = new QLabel( GroupC1, "TextLabel2" );
TextLabel2->setText( tr( "GEOM_MEN_ISOV") ) ;
GroupC1Layout->addWidget( TextLabel2, 0, 2 );
SpinBoxV = new QSpinBox( GroupC1, "SpinBoxV");
SpinBoxV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SpinBoxV->setValue( 1 );
SpinBoxV->setMinValue( 1 );
GroupC1Layout->addWidget( SpinBoxV, 0, 3 );
/***************************************************************/
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) ) ;
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ) ;
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
/***************************************************************/
MyDialogLayout->addWidget( GroupC1, 0, 0 );
MyDialogLayout->addWidget( GroupButtons, 1, 0 );
/* Retrieve GeomGUI */
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
// signals and slots connections
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
/* Move widget on the botton right corner of main widget */
QAD_Tools::centerWidget( this, parent );
}
//=================================================================================
// function : ~GeometryGUI_NbIsosDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_NbIsosDlg::~GeometryGUI_NbIsosDlg()
{
// no need to delete child widgets, Qt does it all for us
}

View File

@ -1,61 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_NbIsosDlg.h
// Author :
// Module : GEOM
// $Header:
#ifndef GEOMETRYGUI_NBISOSDLG_H
#define GEOMETRYGUI_NBISOSDLG_H
#include <qdialog.h>
class QLabel;
class QSpinBox;
class QPushButton;
class GeometryGUI;
//=================================================================================
// class : GeometryGUI_NbIsosDlg
// purpose :
//=================================================================================
class GeometryGUI_NbIsosDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_NbIsosDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_NbIsosDlg();
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
QPushButton* buttonOk;
QPushButton* buttonCancel;
QLabel* TextLabel1 ;
QLabel* TextLabel2 ;
QSpinBox* SpinBoxU ;
QSpinBox* SpinBoxV ;
};
#endif // GEOMETRYGUI_NBISOSDLG_H

View File

@ -1,608 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_OrientationDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_OrientationDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "QAD_Config.h"
#include "utilities.h"
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <TopExp_Explorer.hxx>
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qvalidator.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
//=================================================================================
// class : GeometryGUI_OrientationDlg()
// purpose : Constructs a GeometryGUI_OrientationDlg 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.
//=================================================================================
GeometryGUI_OrientationDlg::GeometryGUI_OrientationDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_ORIENTATION")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
if ( !name )
setName( "GeometryGUI_OrientationDlg" );
resize( 303, 242 );
setCaption( tr( "GEOM_ORIENTATION_TITLE" ) );
setSizeGripEnabled( TRUE );
GeometryGUI_OrientationDlgLayout = new QGridLayout( this );
GeometryGUI_OrientationDlgLayout->setSpacing( 6 );
GeometryGUI_OrientationDlgLayout->setMargin( 11 );
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_ORIENTATION" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
GeometryGUI_OrientationDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GeometryGUI_OrientationDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
/* Spin box construction */
SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A2" ) ;
GroupC1Layout->addWidget( SpinBox_C1A2, 1, 2 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_VECTOR_LENGTH" ) );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
CheckBoxReverse = new QCheckBox( GroupC1, "CheckBoxReverse" );
CheckBoxReverse->setText( tr( "GEOM_ORIENTATION_OPT" ) );
GroupC1Layout->addMultiCellWidget( CheckBoxReverse, 2, 2, 0, 2 );
GeometryGUI_OrientationDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_OrientationDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_OrientationDlg::~GeometryGUI_OrientationDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_OrientationDlg::Init( SALOME_Selection* Sel )
{
double step ;
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
step = St.toDouble() ;
/* min, max, step and decimals for spin boxes */
SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ;
SpinBox_C1A2->SetValue( 25.0 ) ; /* = myLength */
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
CheckBoxReverse->setChecked( FALSE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myLength = 25.0 ;
myOkShape = false ;
myOkLength = true;
mySimulationTopoDs.Nullify() ;
myShape.Nullify() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ?
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( CheckBoxReverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseOrientation(int) ) ) ;
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void GeometryGUI_OrientationDlg::ConstructorsClicked(int constructorId)
{
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_OrientationDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_OrientationDlg::ClickOnApply()
{
/* Leave simulation display in this method ! */
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
{
case 0 :
{
if(myOkShape && CheckBoxReverse->isChecked() && myOkLength == true ) {
myGeomGUI->MakeOrientationChangeAndDisplay( myGeomShape ) ;
CheckBoxReverse->setChecked( FALSE );
}
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_OrientationDlg::ClickOnCancel()
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_OrientationDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_OrientationDlg::SelectionIntoArgument()
{
myGeomGUI->EraseSimulationShape() ;
this->mySimulationTopoDs.Nullify() ;
/* Name of future selection */
QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) {
if ( myEditCurrentArgument == LineEditC1A1 ) {
LineEditC1A1->setText("") ;
this->myOkShape = false ;
}
return ;
}
/* nbSel == 1 ! */
TopoDS_Shape S;
Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
return ;
/* Constructor */
if ( myEditCurrentArgument == LineEditC1A1 ) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
LineEditC1A1->setText(aString) ;
myShape = S ;
myOkShape = true ;
}
if( myOkShape && myOkLength ) {
MakeOrientationSimulationAndDisplay( this->myShape, this->myLength ) ;
}
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_OrientationDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1 ;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void GeometryGUI_OrientationDlg::ValueChangedInSpinBox( double newValue )
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
QObject* send = (QObject*)sender() ;
if( send == SpinBox_C1A2 ) {
this->myLength = newValue ;
myOkLength = true ;
}
if ( myConstructorId == 0 && myOkShape && myOkLength == true ) {
MakeOrientationSimulationAndDisplay( this->myShape, this->myLength ) ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_OrientationDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
GroupC1->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_OrientationDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
GroupC1->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_OrientationDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_OrientationDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}
//===========================================================================================
// function : ReverseOrientation()
// purpose :
//===========================================================================================
void GeometryGUI_OrientationDlg::ReverseOrientation(int state)
{
if( this->myOkShape && myOkLength == true ) {
MakeOrientationSimulationAndDisplay( this->myShape, this-> myLength ) ;
}
return ;
}
//===========================================================================================
// function : MakeOrientationSimulationAndDisplay()
// purpose : Create 'aCompound1' and 'aCompound2' each contains edges oriented
// : respectively FORWARD and REVERSE for all faces of 'aTopoDS'
// : These edges represent normal vectors on faces of 'aTopoDS'
// : For a unique edge an arrow is displayed to show its orientation.
//===========================================================================================
void GeometryGUI_OrientationDlg::MakeOrientationSimulationAndDisplay(const TopoDS_Shape& aTopoDS, Standard_Real length )
{
myGeomGUI->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
TopoDS_Compound aCompound1, aCompound2 ;
TopoDS_Compound NullComp ;
BRep_Builder aBuilder1, aBuilder2;
aCompound1 = aCompound2 = NullComp ;
aBuilder1.MakeCompound(aCompound1) ;
aBuilder2.MakeCompound(aCompound2) ;
if( aTopoDS.IsNull() )
return ;
/* Case of an edge */
if( aTopoDS.ShapeType() == TopAbs_EDGE ) {
/* Try to display a cone simulation shape to show direction of edge */
TopoDS_Shape tmpShape = aTopoDS ;
if( this->CheckBoxReverse->isChecked() ) {
if( aTopoDS.Orientation() == TopAbs_FORWARD)
tmpShape.Orientation(TopAbs_REVERSED) ;
else
tmpShape.Orientation(TopAbs_FORWARD) ;
}
if( myGeomGUI->CreateArrowForLinearEdge( tmpShape, mySimulationTopoDs ) ) {
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
}
return ;
}
gp_Pnt P1, P2 ;
gp_Vec V, V1, V2 ;
TopExp_Explorer ex( aTopoDS, TopAbs_FACE );
int test = 0 ;
while (ex.More()) {
const TopoDS_Face& F = TopoDS::Face(ex.Current());
/* find the center of the minmax */
BRepAdaptor_Surface SF(F);
Standard_Real u, v, x;
u = SF.FirstUParameter();
x = SF.LastUParameter();
if ( Precision::IsInfinite(u) ) {
if( Precision::IsInfinite(x) ) u = 0.0 ; else u = x ;
}
else if ( !Precision::IsInfinite(x) )
u = (u+x) / 2.0 ;
v = SF.FirstVParameter();
x = SF.LastVParameter();
if ( Precision::IsInfinite(v) ) {
if ( Precision::IsInfinite(x) ) v = 0.0 ; else v = x ;
}
else if ( !Precision::IsInfinite(x) )
v = (v+x) / 2.0 ;
SF.D1( u, v, P1, V1, V2 );
V = V1.Crossed(V2);
x = V.Magnitude();
if ( x > 1.e-10 )
V.Multiply( length/x );
else {
V.SetCoord( length/2.0, 0.0, 0.0 ) ;
MESSAGE ("Null normal in Orientation " << endl ) ;
}
P2 = P1;
/* test orientation of each face and displays forward (aCompound1) */
if( F.Orientation() == TopAbs_FORWARD )
P2.Translate(V);
else
P2.Translate(-V) ;
BRepBuilderAPI_MakeEdge anEdge(P1, P2) ;
aBuilder1.Add( aCompound1, anEdge ) ;
P2 = P1;
/* test orientation of each face and displays forward (aCompound2) */
if( F.Orientation() == TopAbs_FORWARD )
P2.Translate(-V);
else
P2.Translate(V) ;
anEdge = BRepBuilderAPI_MakeEdge(P1, P2) ;
aBuilder2.Add( aCompound2, anEdge ) ;
ex.Next();
test++ ;
}
/* display simulation compounds */
if( test > 0 && this->CheckBoxReverse->isChecked() ) {
mySimulationTopoDs = aCompound1 ;
}
else if ( test > 0 && !CheckBoxReverse->isChecked() ) {
mySimulationTopoDs = aCompound2 ;
}
if(!mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ;
return ;
}

View File

@ -1,124 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_OrientationDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_ORIENTATION_H
#define DIALOGBOX_ORIENTATION_H
#include "SALOME_Selection.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include "GeometryGUI_SpinBox.h"
#include <Precision.hxx>
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QCheckBox;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
class GeometryGUI;
//=================================================================================
// class : DialogBox_ORIENTATION
// purpose :
//=================================================================================
class GeometryGUI_OrientationDlg : public QDialog
{
Q_OBJECT
public:
GeometryGUI_OrientationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~GeometryGUI_OrientationDlg();
private :
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
GeometryGUI* myGeomGUI ; /* Current GeomGUI object */
TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */
SALOME_Selection* mySelection ; /* User shape selection */
GEOM::GEOM_Shape_var myGeomShape ; /* is myShape */
TopoDS_Shape myShape ; /* topology used */
Standard_Real myLength ; /* to simulate normal vector */
bool myOkShape ;
bool myOkLength ;
QDoubleValidator *myVa ; /* Double validator for numeric input */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
int myConstructorId ; /* Current constructor id = radio button id */
void closeEvent( QCloseEvent* e ) ;
void enterEvent( QEvent* e);
void Init( SALOME_Selection* Sel ) ;
void MakeOrientationSimulationAndDisplay( const TopoDS_Shape& aTopoDS, Standard_Real length ) ;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QGroupBox* GroupC1;
QLineEdit* LineEditC1A1;
GeometryGUI_SpinBox* SpinBox_C1A2 ;
QPushButton* SelectButtonC1A1;
QLabel* TextLabelC1A1;
QLabel* TextLabelC1A2;
QCheckBox* CheckBoxReverse;
private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk();
void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ;
void SelectionIntoArgument() ;
void LineEditReturnPressed() ;
void DeactivateActiveDialog() ;
void ActivateThisDialog() ;
void ReverseOrientation(int state) ;
void ValueChangedInSpinBox( double newValue ) ;
protected:
QGridLayout* GeometryGUI_OrientationDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
};
#endif // DIALOGBOX_ORIENTATION_H

View File

@ -1,530 +0,0 @@
// 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
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GeometryGUI_PartitionDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
using namespace std;
#include "GeometryGUI_PartitionDlg.h"
#include "GeometryGUI.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include "utilities.h"
#include <qbuttongroup.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qimage.h>
#include <qpixmap.h>
#define MIN_EDIT_SIZE 150
//=================================================================================
// class : GeometryGUI_PartitionDlg()
// purpose : Constructs a GeometryGUI_PartitionDlg 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.
//=================================================================================
GeometryGUI_PartitionDlg::GeometryGUI_PartitionDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_PARTITION")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
// QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_PARTITION_KEEP_FACES")));
if ( !name )
setName( "GeometryGUI_PartitionDlg" );
setCaption( tr( "GEOM_PARTITION_TITLE" ) );
setSizeGripEnabled( TRUE );
QGridLayout* GeometryGUI_PartitionDlgLayout = new QGridLayout( this );
GeometryGUI_PartitionDlgLayout->setSpacing( 6 );
GeometryGUI_PartitionDlgLayout->setMargin( 11 );
/***************************************************************/
/* Constructor group */
/***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
GroupConstructors->setTitle( tr( "GEOM_PARTITION" ) );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
QGridLayout* GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setPixmap( image0 );
Constructor1->setChecked( TRUE );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
GroupConstructorsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 0 );
GeometryGUI_PartitionDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
/* Arguments group */
/***************************************************************/
/* Shapes and Tools */
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "GEOM_PARTITION" ) );
GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 );
QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setPixmap( image1 );
SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
LineEditC1A1->setMinimumSize(MIN_EDIT_SIZE, 0);
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "GEOM_TOOL_OBJECT" ) );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
SelectButtonC1A2->setPixmap( image1 );
SelectButtonC1A2->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
LineEditC1A2->setMinimumSize(MIN_EDIT_SIZE, 0);
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
/* Limit */
TextLabelComboBox1 = new QLabel( GroupC1, "TextLabelComboBox1" );
TextLabelComboBox1->setText( tr( "RECONSTRUCTION_LIMIT") );
GroupC1Layout->addWidget( TextLabelComboBox1, 2, 0 );
ComboBox1 = new QComboBox( FALSE, GroupC1, "ComboBox1" );
ComboBox1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
ComboBox1->setMinimumSize(MIN_EDIT_SIZE, 0);
GroupC1Layout->addWidget( ComboBox1, 2, 2 );
GeometryGUI_PartitionDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
/* Result suppresion */
/***************************************************************/
GroupC2 = new QGroupBox( this, "GroupC2" );
GroupC2->setTitle( tr( "SUPPRESS_RESULT") );
GroupC2->setColumnLayout(0, Qt::Vertical );
GroupC2->layout()->setSpacing( 0 );
GroupC2->layout()->setMargin( 0 );
QGridLayout* GroupC2Layout = new QGridLayout( GroupC2->layout() );
GroupC2Layout->setAlignment( Qt::AlignTop );
GroupC2Layout->setSpacing( 6 );
GroupC2Layout->setMargin( 11 );
TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" );
TextLabelC2A1->setText( tr( "SUPPRESS_RESULT_INSIDE") );
GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 );
SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" );
SelectButtonC2A1->setPixmap( image1 );
GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 );
LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" );
GroupC2Layout->addWidget( LineEditC2A1, 0, 2 );
TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" );
TextLabelC2A2->setText( tr( "SUPPRESS_RESULT_OUTSIDE") );
GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 );
SelectButtonC2A2 = new QPushButton( GroupC2, "SelectButtonC2A2" );
SelectButtonC2A2->setPixmap( image1 );
GroupC2Layout->addWidget( SelectButtonC2A2, 1, 1 );
LineEditC2A2 = new QLineEdit( GroupC2, "LineEditC2A2" );
GroupC2Layout->addWidget( LineEditC2A2, 1, 2 );
GeometryGUI_PartitionDlgLayout->addWidget( GroupC2, 2, 0 );
/***************************************************************/
/* <OK>, <Apply>, <Cancel> buttons */
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
GeometryGUI_PartitionDlgLayout->addWidget( GroupButtons, 3, 0 );
/***************************************************************/
Init(Sel) ; /* Initialisations */
}
//=================================================================================
// function : ~GeometryGUI_PartitionDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
GeometryGUI_PartitionDlg::~GeometryGUI_PartitionDlg()
{
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void GeometryGUI_PartitionDlg::Init( SALOME_Selection* Sel )
{
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
myGeomGUI = GeometryGUI::GetGeometryGUI() ;
myOkListShapes = myOkListTools = myOkKeepShape = myOkRemoveShape = false ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
/* type for sub shape selection */
// ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_SHAPE" ) );
ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_SOLID" ) );
ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_SHELL" ) );
ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_FACE" ) );
ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_WIRE" ) );
ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_EDGE" ) );
ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_VERTEX" ) );
/* Current item is 'Shape' */
ComboBox1->setCurrentItem(0);
myLimit = ComboBox1->currentItem();
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
// connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( ComboBox1, SIGNAL( activated(int) ), this, SLOT( ComboTextChanged() ) );
connect( SelectButtonC1A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC2A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC2A2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEditC1A1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC1A2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC2A1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( LineEditC2A2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
/* to close dialog if study change */
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
/* Move widget on the botton right corner of main widget */
int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ;
this->show() ; /* displays Dialog */
ComboTextChanged();
return ;
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void GeometryGUI_PartitionDlg::ClickOnOk()
{
this->ClickOnApply() ;
this->ClickOnCancel() ;
return ;
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
void GeometryGUI_PartitionDlg::ClickOnApply()
{
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
if (myOkListShapes || myOkListTools || myOkKeepShape || myOkRemoveShape)
{
GEOM::shape_type limit;
switch (myLimit) {
// case 0: limit = GEOM::SOLID ; break;
case 0: limit = GEOM::SHAPE ; break;
case 1: limit = GEOM::SHELL ; break;
case 2: limit = GEOM::FACE ; break;
case 3: limit = GEOM::WIRE ; break;
case 4: limit = GEOM::EDGE ; break;
case 5: limit = GEOM::VERTEX; break;
default:limit = GEOM::SHAPE;
}
myGeomGUI->MakePartitionAndDisplay (myListShapes,
myListTools,
myListKeepInside,
myListRemoveInside,
limit);
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void GeometryGUI_PartitionDlg::ClickOnCancel()
{
myGeomGUI->EraseSimulationShape() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose :
//=================================================================================
// void GeometryGUI_PartitionDlg::ConstructorsClicked(int constructorId)
// {
// }
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void GeometryGUI_PartitionDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("") ;
QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel < 1 ) {
if ( myEditCurrentArgument == LineEditC1A1 ) {
myOkListShapes = false ;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
myOkListTools = false ;
}
else if ( myEditCurrentArgument == LineEditC2A1 ) {
myOkListTools = false ;
}
else if ( myEditCurrentArgument == LineEditC2A2 ) {
myOkListTools = false ;
}
return ;
}
if ( myEditCurrentArgument == LineEditC1A1 ) {
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ;
myEditCurrentArgument->setText(aString) ;
myOkListShapes = true ;
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListTools) ;
myEditCurrentArgument->setText(aString) ;
myOkListTools = true ;
}
else if ( myEditCurrentArgument == LineEditC2A1 ) {
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListRemoveInside) ;
myEditCurrentArgument->setText(aString) ;
myOkKeepShape = true ;
}
else if ( myEditCurrentArgument == LineEditC2A2 ) {
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListKeepInside) ;
myEditCurrentArgument->setText(aString) ;
myOkRemoveShape = true ;
}
/* no simulation */
return ;
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void GeometryGUI_PartitionDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
if (send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1 ;
}
else if(send == SelectButtonC1A2) {
LineEditC1A2->setFocus() ;
myEditCurrentArgument = LineEditC1A2 ;
}
else if(send == SelectButtonC2A1) {
LineEditC2A1->setFocus() ;
myEditCurrentArgument = LineEditC2A1 ;
}
else if(send == SelectButtonC2A2) {
LineEditC2A2->setFocus() ;
myEditCurrentArgument = LineEditC2A2 ;
}
SelectionIntoArgument() ;
return ;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void GeometryGUI_PartitionDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if( send == LineEditC1A1 )
myEditCurrentArgument = LineEditC1A1 ;
else if ( send == LineEditC1A2 )
myEditCurrentArgument = LineEditC1A2 ;
else if ( send == LineEditC2A1 )
myEditCurrentArgument = LineEditC2A1 ;
else if ( send == LineEditC2A2 )
myEditCurrentArgument = LineEditC2A2 ;
else
return ;
/* User name of object input management */
/* If successfull the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ;
}
return ;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void GeometryGUI_PartitionDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupC2->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
return ;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void GeometryGUI_PartitionDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
myGeomGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ;
GroupC2->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
return ;
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void GeometryGUI_PartitionDlg::enterEvent(QEvent* e)
{
if ( GroupConstructors->isEnabled() )
return ;
ActivateThisDialog() ;
return ;
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void GeometryGUI_PartitionDlg::closeEvent( QCloseEvent* e )
{
/* same than click on cancel button */
this->ClickOnCancel() ;
return ;
}
//=======================================================================
//function : ComboTextChanged
//purpose :
//=======================================================================
void GeometryGUI_PartitionDlg::ComboTextChanged()
{
myLimit = ComboBox1->currentItem();
GroupC2->setEnabled( ComboBox1->currentItem() < 3 );
return ;
}

Some files were not shown because too many files have changed in this diff Show More