*** empty log message ***

This commit is contained in:
vsr 2007-10-18 14:47:58 +00:00
parent b6cf20bd37
commit f70f07e7db
25 changed files with 1407 additions and 1548 deletions

View File

@ -5,8 +5,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>217</width> <width>213</width>
<height>120</height> <height>116</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
@ -26,11 +26,14 @@
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="margin" > <property name="margin" >
<number>11</number> <number>9</number>
</property> </property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<item rowspan="4" row="0" column="0" >
<widget class="QTreeWidget" name="ListView1" />
</item>
<item row="3" column="1" > <item row="3" column="1" >
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
@ -41,14 +44,21 @@
</property> </property>
<property name="sizeHint" > <property name="sizeHint" >
<size> <size>
<width>0</width> <width>16</width>
<height>23</height> <height>120</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item rowspan="4" row="0" column="0" > <item row="2" column="1" >
<widget class="QListView" name="ListView1" /> <widget class="QPushButton" name="PushButton1" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QSpinBox" name="SpinBox1" />
</item> </item>
<item row="0" column="1" > <item row="0" column="1" >
<widget class="QLabel" name="TextLabel1" > <widget class="QLabel" name="TextLabel1" >
@ -60,16 +70,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" >
<widget class="QSpinBox" name="SpinBox1" />
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="PushButton1" >
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -77,6 +77,11 @@
</widget> </widget>
<layoutdefault spacing="6" margin="11" /> <layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<tabstops>
<tabstop>ListView1</tabstop>
<tabstop>SpinBox1</tabstop>
<tabstop>PushButton1</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -74,7 +74,7 @@ GEOMBase_Skeleton::GEOMBase_Skeleton( GeometryGUI* theGeometryGUI, QWidget* pare
myRBGroup->addButton( myMainFrame->RadioButton1, 0 ); myRBGroup->addButton( myMainFrame->RadioButton1, 0 );
myRBGroup->addButton( myMainFrame->RadioButton2, 1 ); myRBGroup->addButton( myMainFrame->RadioButton2, 1 );
myRBGroup->addButton( myMainFrame->RadioButton3, 2 ); myRBGroup->addButton( myMainFrame->RadioButton3, 2 );
myRBGroup->addButton( myMainFrame->RadioButton4, 4 ); myRBGroup->addButton( myMainFrame->RadioButton4, 3 );
connect( myRBGroup, SIGNAL( buttonClicked( int ) ), this, SIGNAL( constructorsClicked( int ) ) ); connect( myRBGroup, SIGNAL( buttonClicked( int ) ), this, SIGNAL( constructorsClicked( int ) ) );

View File

@ -19,13 +19,10 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : GEOMBase
# #
#
# File : Makefile.in
# Author : Damien COQUERET (OCC)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
# $Header:
include $(top_srcdir)/adm_local/unix/make_common_starter.am include $(top_srcdir)/adm_local/unix/make_common_starter.am

View File

@ -19,13 +19,10 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : GEOMFiltersSelection
# #
#
# File : Makefile.in
# Author : Patrick GOLDBRONN (CEA)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
# $Header$
include $(top_srcdir)/adm_local/unix/make_common_starter.am include $(top_srcdir)/adm_local/unix/make_common_starter.am

View File

@ -19,13 +19,10 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : GEOMGUI
# #
#
# File : Makefile.in
# Author : Marc Tajchman (CEA)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
# $Header$
include $(top_srcdir)/adm_local/unix/make_common_starter.am include $(top_srcdir)/adm_local/unix/make_common_starter.am

View File

@ -19,13 +19,10 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : OperationGUI
# #
#
# File : Makefile.in
# Author : Damien COQUERET (OCC)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
# $Header:
include $(top_srcdir)/adm_local/unix/make_common_starter.am include $(top_srcdir)/adm_local/unix/make_common_starter.am
@ -36,6 +33,14 @@ salomeinclude_HEADERS =
lib_LTLIBRARIES = libOperationGUI.la lib_LTLIBRARIES = libOperationGUI.la
dist_libOperationGUI_la_SOURCES = \ dist_libOperationGUI_la_SOURCES = \
OperationGUI.h \
OperationGUI_ArchimedeDlg.h \
OperationGUI_PartitionDlg.h \
OperationGUI_MaterialDlg.h \
OperationGUI_FilletDlg.h \
OperationGUI_ChamferDlg.h \
OperationGUI_ClippingDlg.h \
\
OperationGUI.cxx \ OperationGUI.cxx \
OperationGUI_ArchimedeDlg.cxx \ OperationGUI_ArchimedeDlg.cxx \
OperationGUI_PartitionDlg.cxx \ OperationGUI_PartitionDlg.cxx \
@ -77,6 +82,7 @@ libOperationGUI_la_CPPFLAGS = \
-I$(srcdir)/../OBJECT \ -I$(srcdir)/../OBJECT \
-I$(srcdir)/../GEOMClient \ -I$(srcdir)/../GEOMClient \
-I$(srcdir)/../GEOMImpl \ -I$(srcdir)/../GEOMImpl \
-I$(top_builddir)/src/DlgRef \
-I$(top_builddir)/idl \ -I$(top_builddir)/idl \
-I$(top_builddir)/salome_adm/unix -I$(top_builddir)/salome_adm/unix

View File

@ -19,18 +19,17 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI.cxx // File : OperationGUI.cxx
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "OperationGUI.h" #include "OperationGUI.h"
#include "SUIT_Session.h" #include <GeometryGUI.h>
#include "SUIT_Desktop.h"
#include "SalomeApp_Application.h" #include <SUIT_Session.h>
#include <SUIT_Desktop.h>
#include <SalomeApp_Application.h>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
@ -40,16 +39,14 @@
#include "OperationGUI_ArchimedeDlg.h" // Method ARCHIMEDE #include "OperationGUI_ArchimedeDlg.h" // Method ARCHIMEDE
#include "OperationGUI_FilletDlg.h" // Method FILLET #include "OperationGUI_FilletDlg.h" // Method FILLET
#include "OperationGUI_ChamferDlg.h" // Method CHAMFER #include "OperationGUI_ChamferDlg.h" // Method CHAMFER
#include "OperationGUI_ClippingDlg.h" // Clipping dialog box
#include "OperationGUI_ClippingDlg.h"
using namespace std;
//======================================================================= //=======================================================================
// function : OperationGUI() // function : OperationGUI()
// purpose : Constructor // purpose : Constructor
//======================================================================= //=======================================================================
OperationGUI::OperationGUI(GeometryGUI* parent) : GEOMGUI(parent) OperationGUI::OperationGUI( GeometryGUI* parent ) :
GEOMGUI( parent )
{ {
} }
@ -73,8 +70,7 @@ bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
getGeometryGUI()->EmitSignalDeactivateDialog(); getGeometryGUI()->EmitSignalDeactivateDialog();
switch (theCommandID) switch ( theCommandID ) {
{
case 503: ( new OperationGUI_PartitionDlg( getGeometryGUI(), parent ) )->show(); break; case 503: ( new OperationGUI_PartitionDlg( getGeometryGUI(), parent ) )->show(); break;
case 504: ( new OperationGUI_ArchimedeDlg( getGeometryGUI(), parent ) )->show(); break; case 504: ( new OperationGUI_ArchimedeDlg( getGeometryGUI(), parent ) )->show(); break;
case 505: ( new OperationGUI_FilletDlg ( getGeometryGUI(), parent ) )->show(); break; case 505: ( new OperationGUI_FilletDlg ( getGeometryGUI(), parent ) )->show(); break;

View File

@ -19,17 +19,14 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI.h // File : OperationGUI.h
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef OPERATIONGUI_H #ifndef OPERATIONGUI_H
#define OPERATIONGUI_H #define OPERATIONGUI_H
#include "GEOMGUI.h" #include <GEOMGUI.h>
#include "GEOMBase.h"
//================================================================================= //=================================================================================
// class : OperationGUI // class : OperationGUI
@ -38,10 +35,10 @@
class OperationGUI : public GEOMGUI class OperationGUI : public GEOMGUI
{ {
public : public :
OperationGUI( GeometryGUI* parent ); OperationGUI( GeometryGUI* );
~OperationGUI(); ~OperationGUI();
bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); bool OnGUIEvent( int, SUIT_Desktop* );
}; };
#endif #endif // OPERATIONGUI_H

View File

@ -19,22 +19,21 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI_ArchimedeDlg.cxx // File : OperationGUI_ArchimedeDlg.cxx
// Author : Nicolas REJNERI // Author : Nicolas REJNERI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "OperationGUI_ArchimedeDlg.h" #include "OperationGUI_ArchimedeDlg.h"
#include "DlgRef_1Sel3Spin.h"
#include "SUIT_Desktop.h" #include <GEOM_DlgRef.h>
#include "SUIT_Session.h" #include <GeometryGUI.h>
#include "SalomeApp_Application.h" #include <GEOMBase.h>
#include "LightApp_SelectionMgr.h"
#include <qlabel.h> #include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
//================================================================================= //=================================================================================
// class : OperationGUI_ArchimedeDlg() // class : OperationGUI_ArchimedeDlg()
@ -44,30 +43,34 @@
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton(theGeometryGUI, parent, "ArchimedeDlg", false, : GEOMBase_Skeleton( theGeometryGUI, parent, false )
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_ARCHIMEDE" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_ARCHIMEDE" ) ) );
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_ARCHIMEDE_TITLE")); setWindowTitle( tr( "GEOM_ARCHIMEDE_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_ARCHIMEDE")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ARCHIMEDE" ) );
RadioButton1->setPixmap(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->close(TRUE); mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(TRUE); mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1Sel3Spin(this, "GroupPoints"); GroupPoints = new DlgRef_1Sel3Spin( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
GroupPoints->TextLabel2->setText( tr( "GEOM_WEIGHT" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_WEIGHT" ) );
GroupPoints->TextLabel3->setText( tr( "GEOM_WATER_DENSITY" ) ); GroupPoints->TextLabel3->setText( tr( "GEOM_WATER_DENSITY" ) );
GroupPoints->TextLabel4->setText( tr( "GEOM_MESHING_DEFLECTION" ) ); GroupPoints->TextLabel4->setText( tr( "GEOM_MESHING_DEFLECTION" ) );
GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton1->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
Layout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
setHelpFileName( "archimede.htm" ); setHelpFileName( "archimede.htm" );
@ -103,23 +106,25 @@ void OperationGUI_ArchimedeDlg::Init()
double SpecificStep1 = 0.1; double SpecificStep1 = 0.1;
double SpecificStep2 = 0.01; double SpecificStep2 = 0.01;
/* min, max, myStep and decimals for spin boxes & initial values */ /* min, max, myStep and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, myStep, 3); initSpinBox( GroupPoints->SpinBox_DX, 0.001, COORD_MAX, myStep, 3 );
GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep1, 3); initSpinBox( GroupPoints->SpinBox_DY, 0.001, COORD_MAX, SpecificStep1, 3 );
GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep2, 3); initSpinBox( GroupPoints->SpinBox_DZ, 0.001, COORD_MAX, SpecificStep2, 3 );
GroupPoints->SpinBox_DX->SetValue( 100.0 ); GroupPoints->SpinBox_DX->setValue( 100.0 );
GroupPoints->SpinBox_DY->SetValue( 1.0 ); GroupPoints->SpinBox_DY->setValue( 1.0 );
GroupPoints->SpinBox_DZ->SetValue( 0.01 ); GroupPoints->SpinBox_DZ->setValue( 0.01 );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
// VSR: TODO ->>
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) ); connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DX, SLOT( SetStep( double ) ) );
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DY, SLOT( SetStep( double ) ) ); connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DY, SLOT( SetStep( double ) ) );
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DZ, SLOT( SetStep( double ) ) ); connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupPoints->SpinBox_DZ, SLOT( SetStep( double ) ) );
// <<-
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
this, SLOT( SelectionIntoArgument() ) ); this, SLOT( SelectionIntoArgument() ) );
@ -172,8 +177,7 @@ void OperationGUI_ArchimedeDlg::SelectionIntoArgument()
Standard_Boolean testResult = Standard_False; Standard_Boolean testResult = Standard_False;
myShape = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); myShape = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if ( !testResult || myShape->_is_nil() || !GEOMBase::IsShape( myShape ) ) if ( !testResult || myShape->_is_nil() || !GEOMBase::IsShape( myShape ) ) {
{
myShape = GEOM::GEOM_Object::_nil(); myShape = GEOM::GEOM_Object::_nil();
return; return;
} }
@ -195,7 +199,6 @@ void OperationGUI_ArchimedeDlg::LineEditReturnPressed()
return; return;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
return;
} }
//================================================================================= //=================================================================================
@ -208,7 +211,6 @@ void OperationGUI_ArchimedeDlg::ActivateThisDialog()
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return;
} }
@ -216,12 +218,11 @@ void OperationGUI_ArchimedeDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void OperationGUI_ArchimedeDlg::enterEvent(QEvent* e) void OperationGUI_ArchimedeDlg::enterEvent( QEvent* )
{ {
if(GroupConstructors->isEnabled()) if ( mainFrame()->GroupConstructors->isEnabled() )
return; return;
this->ActivateThisDialog(); this->ActivateThisDialog();
return;
} }
@ -251,9 +252,9 @@ bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects )
{ {
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
double aWeight = GroupPoints->SpinBox_DX->GetValue(); double aWeight = GroupPoints->SpinBox_DX->value();
double aWaterDensity = GroupPoints->SpinBox_DY->GetValue(); double aWaterDensity = GroupPoints->SpinBox_DY->value();
double aMeshDeflection = GroupPoints->SpinBox_DZ->GetValue(); double aMeshDeflection = GroupPoints->SpinBox_DZ->value();
anObj = GEOM::GEOM_ILocalOperations::_narrow( anObj = GEOM::GEOM_ILocalOperations::_narrow(
getOperation() )->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection ); getOperation() )->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection );

View File

@ -19,16 +19,14 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI_ArchimedeDlg.h // File : OperationGUI_ArchimedeDlg.h
// Author : Nicolas REJNERI // Author : Nicolas REJNERI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_ARCHIMEDE_H #ifndef OPERATIONGUI_ARCHIMEDEDLG_H
#define DIALOGBOX_ARCHIMEDE_H #define OPERATIONGUI_ARCHIMEDEDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class DlgRef_1Sel3Spin; class DlgRef_1Sel3Spin;
@ -41,18 +39,18 @@ class OperationGUI_ArchimedeDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
OperationGUI_ArchimedeDlg(GeometryGUI* theGeometryGUI, QWidget* parent); OperationGUI_ArchimedeDlg( GeometryGUI* , QWidget* );
~OperationGUI_ArchimedeDlg(); ~OperationGUI_ArchimedeDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& msg ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
private: private:
GEOM::GEOM_Object_var myShape; GEOM::GEOM_Object_var myShape;
@ -67,4 +65,4 @@ private slots:
void SelectionIntoArgument(); void SelectionIntoArgument();
}; };
#endif // DIALOGBOX_ARCHIMEDE_H #endif // OPERATIONGUI_ARCHIMEDEDLG_H

View File

@ -19,29 +19,28 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI_ChamferDlg.cxx // File : OperationGUI_ChamferDlg.cxx
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "OperationGUI_ChamferDlg.h" #include "OperationGUI_ChamferDlg.h"
#include "DlgRef_SpinBox.h"
#include "SUIT_Desktop.h" #include <GEOM_DlgRef.h>
#include "SUIT_Session.h" #include <GeometryGUI.h>
#include "SalomeApp_Application.h" #include <GEOMBase.h>
#include "LightApp_SelectionMgr.h"
#include "OCCViewer_ViewModel.h" #include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <OCCViewer_ViewModel.h>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <qlabel.h> #include <GEOMImpl_Types.hxx>
#include "qpixmap.h"
#include <list>
#include "GEOMImpl_Types.hxx"
//================================================================================= //=================================================================================
// class : OperationGUI_ChamferDlg() // class : OperationGUI_ChamferDlg()
@ -51,102 +50,86 @@
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
OperationGUI_ChamferDlg::OperationGUI_ChamferDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) OperationGUI_ChamferDlg::OperationGUI_ChamferDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton(theGeometryGUI, parent, "ChamferDlg", false, : GEOMBase_Skeleton( theGeometryGUI, parent, false )
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
myConstructorId = -1;
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_ALL" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_ALL" ) ) );
QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_EDGE" ) ) ); QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_EDGE" ) ) );
QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_FACE" ) ) ); QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CHAMFER_FACE" ) ) );
QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption( tr( "GEOM_CHAMFER_TITLE" ) ); setWindowTitle( tr( "GEOM_CHAMFER_TITLE" ) );
GroupConstructors->setTitle( tr( "GEOM_CHAMFER" ) ); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_CHAMFER" ) );
RadioButton1->setPixmap( image1 ); mainFrame()->RadioButton1->setIcon( image1 );
RadioButton2->setPixmap( image2 ); mainFrame()->RadioButton2->setIcon( image2 );
RadioButton3->setPixmap( image3 ); mainFrame()->RadioButton3->setIcon( image3 );
// Create first group // Create first group
myGrp1 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_ALL" ), this ); myGrp1 = new QGroupBox( tr( "GEOM_CHAMFER_ALL" ), centralWidget() );
QGroupBox* aSelGrp1 = new QGroupBox( 3, Qt::Horizontal, myGrp1 ); QGridLayout* aLayout = new QGridLayout( myGrp1 );
aSelGrp1->setFrameStyle( QFrame::NoFrame ); aLayout->setMargin( 9 ); aLayout->setSpacing( 6 );
aSelGrp1->setInsideMargin( 0 );
createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp1, MainObj1 ); createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, myGrp1, aLayout, MainObj1 );
QGroupBox* aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp1 ); int row = aLayout->rowCount();
aSpinGrp->setFrameStyle( QFrame::NoFrame ); aLayout->addWidget( new QLabel( tr( "D" ), myGrp1 ), row, 0 );
aSpinGrp->setInsideMargin( 0 ); aLayout->addWidget( ( mySpinBox[ SpinBox1 ] = new QDoubleSpinBox( myGrp1 ) ), row++, 2 );
aLayout->setRowStretch( row, 10 );
new QLabel( tr( "D" ), aSpinGrp );
mySpinBox[ SpinBox1 ] = new DlgRef_SpinBox( aSpinGrp );
( new QFrame( myGrp1 ) )->setSizePolicy(
QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
// Create second group // Create second group
myGrp2 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_EDGES" ), this ); myGrp2 = new QGroupBox( tr( "GEOM_CHAMFER_EDGES" ), centralWidget() );
QGroupBox* aSelGrp2 = new QGroupBox( 3, Qt::Horizontal, myGrp2 ); aLayout = new QGridLayout( myGrp2 );
aSelGrp2->setFrameStyle( QFrame::NoFrame ); aLayout->setMargin( 9 ); aLayout->setSpacing( 6 );
aSelGrp2->setInsideMargin( 0 );
createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp2, MainObj2 ); createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, myGrp2, aLayout, MainObj2 );
createSelWg( tr( "FACE_1" ), iconSelect, aSelGrp2, Face1 ); createSelWg( tr( "FACE_1" ), iconSelect, myGrp2, aLayout, Face1 );
createSelWg( tr( "FACE_2" ), iconSelect, aSelGrp2, Face2 ); createSelWg( tr( "FACE_2" ), iconSelect, myGrp2, aLayout, Face2 );
aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp2 ); row = aLayout->rowCount();
aSpinGrp->setFrameStyle( QFrame::NoFrame );
aSpinGrp->setInsideMargin( 0 );
new QLabel( tr( "GEOM_D1" ), aSpinGrp ); aLayout->addWidget( new QLabel( tr( "GEOM_D1" ), myGrp2 ), row, 0 );
mySpinBox[ SpinBox21 ] = new DlgRef_SpinBox( aSpinGrp ); aLayout->addWidget( ( mySpinBox[ SpinBox21 ] = new QDoubleSpinBox( myGrp2 ) ), row++, 2 );
aLayout->addWidget( new QLabel( tr( "GEOM_D2" ), myGrp2 ), row, 0 );
new QLabel( tr( "GEOM_D2" ), aSpinGrp ); aLayout->addWidget( ( mySpinBox[ SpinBox22 ] = new QDoubleSpinBox( myGrp2 ) ), row++, 2 );
mySpinBox[ SpinBox22 ] = new DlgRef_SpinBox( aSpinGrp ); aLayout->setRowStretch( row, 10 );
// Create third group // Create third group
myGrp3 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_FACES" ), this ); myGrp3 = new QGroupBox( tr( "GEOM_CHAMFER_FACES" ), centralWidget() );
QGroupBox* aSelGrp3 = new QGroupBox( 3, Qt::Horizontal, myGrp3 ); aLayout = new QGridLayout( myGrp3 );
aSelGrp3->setFrameStyle( QFrame::NoFrame ); aLayout->setMargin( 9 ); aLayout->setSpacing( 6 );
aSelGrp3->setInsideMargin( 0 );
createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp3, MainObj3 ); createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, myGrp3, aLayout, MainObj3 );
createSelWg( tr( "SELECTED_FACES" ), iconSelect, aSelGrp3, Faces ); createSelWg( tr( "SELECTED_FACES" ), iconSelect, myGrp3, aLayout, Faces );
aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp3 ); row = aLayout->rowCount();
aSpinGrp->setFrameStyle( QFrame::NoFrame );
aSpinGrp->setInsideMargin( 0 );
new QLabel( tr( "GEOM_D1" ), aSpinGrp ); aLayout->addWidget( new QLabel( tr( "GEOM_D1" ), myGrp3 ), row, 0 );
mySpinBox[ SpinBox31 ] = new DlgRef_SpinBox( aSpinGrp ); aLayout->addWidget( ( mySpinBox[ SpinBox31 ] = new QDoubleSpinBox( myGrp3 ) ), row++, 2 );
aLayout->addWidget( new QLabel( tr( "GEOM_D2" ), myGrp3 ), row, 0 );
new QLabel( tr( "GEOM_D2" ), aSpinGrp ); aLayout->addWidget( ( mySpinBox[ SpinBox32 ] = new QDoubleSpinBox( myGrp3 ) ), row++, 2 );
mySpinBox[ SpinBox32 ] = new DlgRef_SpinBox( aSpinGrp ); aLayout->setRowStretch( row, 10 );
( new QLabel( myGrp3 ) )->setSizePolicy(
QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
// Add groups to layout // Add groups to layout
Layout1->addWidget( myGrp1, 2, 0 ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
Layout1->addWidget( myGrp2, 2, 0 ); layout->setMargin( 0 ); layout->setSpacing( 6 );
Layout1->addWidget( myGrp3, 2, 0 ); layout->addWidget( myGrp1 );
layout->addWidget( myGrp2 );
layout->addWidget( myGrp3 );
// Set range of spinboxes // Set range of spinboxes
double SpecificStep = 10.0; double SpecificStep = 10.0;
QMap< int, DlgRef_SpinBox* >::iterator anIter; QMap< int, QDoubleSpinBox* >::iterator anIter;
for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter ) for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )
anIter.data()->RangeStepAndValidator( 0.001, COORD_MAX, SpecificStep, 3 ); initSpinBox( anIter.value(), 0.001, COORD_MAX, SpecificStep, 3 );
setHelpFileName( "chamfer.htm" ); setHelpFileName( "chamfer.htm" );
@ -172,35 +155,32 @@ void OperationGUI_ChamferDlg::Init()
{ {
myConstructorId = -1; myConstructorId = -1;
reset(); reset();
RadioButton1->setChecked( true );
myEditCurrentArgument = mySelName[ MainObj1 ];
/* signals and slots connections */ /* signals and slots connections */
// main buttons // main buttons
connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
// group box // group box
connect( GroupConstructors, SIGNAL( clicked( int ) ), connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
this, SLOT( ConstructorsClicked( int ) ) );
// push buttons // push buttons
QMap< int, QPushButton* >::iterator anIterBtn; QMap< int, QPushButton* >::iterator anIterBtn;
for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn ) for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn )
connect( anIterBtn.data(), SIGNAL( clicked() ), connect( anIterBtn.value(), SIGNAL( clicked() ),
this, SLOT( SetEditCurrentArgument() ) ); this, SLOT( SetEditCurrentArgument() ) );
// line edits // line edits
QMap< int, QLineEdit* >::iterator anIterLE2; QMap< int, QLineEdit* >::iterator anIterLE2;
for ( anIterLE2 = mySelName.begin(); anIterLE2 != mySelName.end(); ++anIterLE2 ) for ( anIterLE2 = mySelName.begin(); anIterLE2 != mySelName.end(); ++anIterLE2 )
connect( anIterLE2.data(), SIGNAL( returnPressed() ), connect( anIterLE2.value(), SIGNAL( returnPressed() ),
this, SLOT( LineEditReturnPressed() ) ); this, SLOT( LineEditReturnPressed() ) );
// spin boxes // spin boxes
QMap< int, DlgRef_SpinBox* >::iterator anIterSpin; QMap< int, QDoubleSpinBox* >::iterator anIterSpin;
for ( anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin ) for ( anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin )
connect( anIterSpin.data(), SIGNAL( valueChanged( double ) ), connect( anIterSpin.value(), SIGNAL( valueChanged( double ) ),
this, SLOT( ValueChangedInSpinBox( double ) ) ); this, SLOT( ValueChangedInSpinBox( double ) ) );
// selection // selection
@ -209,9 +189,7 @@ void OperationGUI_ChamferDlg::Init()
initName( tr( "GEOM_CHAMFER" ) ); initName( tr( "GEOM_CHAMFER" ) );
myGrp2->hide(); ConstructorsClicked( 0 );
myGrp3->hide();
myGrp1->show();
} }
@ -223,9 +201,8 @@ void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId )
{ {
// Activate next widget // Activate next widget
if ( myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType() if ( myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type()) != OCCViewer_Viewer::Type() ) {
{ mainFrame()->RadioButton1->setChecked( true );
RadioButton1->setChecked( true );
return; return;
} }
@ -235,41 +212,38 @@ void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId )
// Get values from previous widget // Get values from previous widget
double D1 = 5, D2 = 5; double D1 = 5, D2 = 5;
if ( myConstructorId == 0 ) if ( myConstructorId == 0 )
D1 = D2 = mySpinBox[ SpinBox1 ]->GetValue(); D1 = D2 = mySpinBox[ SpinBox1 ]->value();
else if ( myConstructorId == 1 ) else if ( myConstructorId == 1 ) {
{ D1 = mySpinBox[ SpinBox21 ]->value();
D1 = mySpinBox[ SpinBox21 ]->GetValue(); D2 = mySpinBox[ SpinBox22 ]->value();
D2 = mySpinBox[ SpinBox22 ]->GetValue();
} }
else if ( myConstructorId == 2 ) else if ( myConstructorId == 2 ) {
{ D1 = mySpinBox[ SpinBox31 ]->value();
D1 = mySpinBox[ SpinBox31 ]->GetValue(); D2 = mySpinBox[ SpinBox32 ]->value();
D2 = mySpinBox[ SpinBox32 ]->GetValue();
} }
myConstructorId = constructorId; myConstructorId = constructorId;
switch ( constructorId ) switch ( constructorId ) {
{
case 0: case 0:
myGrp1->show();
myGrp2->hide(); myGrp2->hide();
myGrp3->hide(); myGrp3->hide();
mySpinBox[ SpinBox1 ]->SetValue( D1 ); myGrp1->show();
mySpinBox[ SpinBox1 ]->setValue( D1 );
break; break;
case 1: case 1:
myGrp1->hide(); myGrp1->hide();
myGrp2->show();
myGrp3->hide(); myGrp3->hide();
mySpinBox[ SpinBox21 ]->SetValue( D1 ); myGrp2->show();
mySpinBox[ SpinBox22 ]->SetValue( D2 ); mySpinBox[ SpinBox21 ]->setValue( D1 );
mySpinBox[ SpinBox22 ]->setValue( D2 );
break; break;
case 2: case 2:
myGrp1->hide(); myGrp1->hide();
myGrp2->hide(); myGrp2->hide();
myGrp3->show(); myGrp3->show();
mySpinBox[ SpinBox31 ]->SetValue( D1 ); mySpinBox[ SpinBox31 ]->setValue( D1 );
mySpinBox[ SpinBox32 ]->SetValue( D2 ); mySpinBox[ SpinBox32 ]->setValue( D2 );
break; break;
default: default:
break; break;
@ -290,6 +264,10 @@ void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId )
else else
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
displayPreview(); displayPreview();
} }
@ -330,24 +308,21 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
// Get index of current selection focus // Get index of current selection focus
int aCurrFocus = -1; int aCurrFocus = -1;
QMap< int, QLineEdit* >::iterator anIter; QMap< int, QLineEdit* >::iterator anIter;
for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter ) {
if ( myEditCurrentArgument == anIter.data() ) if ( myEditCurrentArgument == anIter.value() ) {
{
aCurrFocus = anIter.key(); aCurrFocus = anIter.key();
break; break;
} }
}
// If selection of main object is activated // If selection of main object is activated
if ( aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 ) if ( aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 ) {
{ if ( IObjectCount() == 1 ) {
if ( IObjectCount() == 1 )
{
Standard_Boolean aResult = Standard_False; Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
if ( aResult && !anObj->_is_nil() ) if ( aResult && !anObj->_is_nil() ) {
{
myShape = anObj; myShape = anObj;
mySelName[ aCurrFocus ]->setText( GEOMBase::GetName( anObj ) ); mySelName[ aCurrFocus ]->setText( GEOMBase::GetName( anObj ) );
displayPreview(); displayPreview();
@ -360,21 +335,17 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
enableWidgets(); enableWidgets();
} }
// If face selection of second tab is activated // If face selection of second tab is activated
else if ( aCurrFocus == Face1 || aCurrFocus == Face2 ) else if ( aCurrFocus == Face1 || aCurrFocus == Face2 ) {
{ if ( IObjectCount() == 1 ) {
if ( IObjectCount() == 1 )
{
Standard_Boolean aResult = Standard_False; Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
if ( aResult && !anObj->_is_nil() ) if ( aResult && !anObj->_is_nil() ) {
{
TColStd_IndexedMapOfInteger anIndexes; TColStd_IndexedMapOfInteger anIndexes;
( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr()->GetIndexes( firstIObject(), anIndexes );
if ( anIndexes.Extent() == 1 ) if ( anIndexes.Extent() == 1 ) {
{
int anIndex = anIndexes( 1 ); int anIndex = anIndexes( 1 );
QString aFaceName = QString( GEOMBase::GetName( anObj ) ) + ":%1"; QString aFaceName = QString( GEOMBase::GetName( anObj ) ) + ":%1";
myEditCurrentArgument->setText( aFaceName.arg( anIndex ) ); myEditCurrentArgument->setText( aFaceName.arg( anIndex ) );
@ -388,30 +359,26 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
myFace[ aCurrFocus ] = -1; myFace[ aCurrFocus ] = -1;
} }
// If face selection of third tab is activated // If face selection of third tab is activated
else if ( aCurrFocus == Faces ) else if ( aCurrFocus == Faces ) {
{ if ( IObjectCount() == 1 ) {
if ( IObjectCount() == 1 )
{
Standard_Boolean aResult = Standard_False; Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
if ( aResult && !anObj->_is_nil() ) if ( aResult && !anObj->_is_nil() ) {
{
TColStd_IndexedMapOfInteger anIndexes; TColStd_IndexedMapOfInteger anIndexes;
( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr()->GetIndexes( firstIObject(), anIndexes );
if ( anIndexes.Extent() > 0 ) if ( anIndexes.Extent() > 0 ) {
{
QString aFaceName; QString aFaceName;
if ( anIndexes.Extent() == 1 ) if ( anIndexes.Extent() == 1 ) {
{
int anIndex = anIndexes( 1 ); int anIndex = anIndexes( 1 );
aFaceName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex ); aFaceName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex );
} }
else else {
aFaceName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() ); aFaceName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() );
}
myEditCurrentArgument->setText( aFaceName ); myEditCurrentArgument->setText( aFaceName );
myFaces = anIndexes; myFaces = anIndexes;
@ -435,8 +402,8 @@ void OperationGUI_ChamferDlg::LineEditReturnPressed()
QMap< int, QLineEdit* >::iterator anIterLE; QMap< int, QLineEdit* >::iterator anIterLE;
for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE ) for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
if ( anIterLE.data() == aSender ) if ( anIterLE.value() == aSender )
myEditCurrentArgument = anIterLE.data(); myEditCurrentArgument = anIterLE.value();
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -451,12 +418,12 @@ void OperationGUI_ChamferDlg::SetEditCurrentArgument()
QPushButton* aSender = ( QPushButton* )sender(); QPushButton* aSender = ( QPushButton* )sender();
QMap< int, QPushButton* >::iterator anIter; QMap< int, QPushButton* >::iterator anIter;
for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) {
if ( anIter.data() == aSender ) if ( anIter.value() == aSender ) {
{
mySelName[ anIter.key() ]->setFocus(); mySelName[ anIter.key() ]->setFocus();
myEditCurrentArgument = mySelName[ anIter.key() ]; myEditCurrentArgument = mySelName[ anIter.key() ];
} }
}
activateSelection(); activateSelection();
} }
@ -482,9 +449,9 @@ void OperationGUI_ChamferDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void OperationGUI_ChamferDlg::enterEvent(QEvent* e) void OperationGUI_ChamferDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
this->ActivateThisDialog(); this->ActivateThisDialog();
} }
@ -493,7 +460,7 @@ void OperationGUI_ChamferDlg::enterEvent(QEvent* e)
// function : ValueChangedInSpinBox() // function : ValueChangedInSpinBox()
// purpose : // purpose :
//================================================================================= //=================================================================================
void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue ) void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double )
{ {
displayPreview(); displayPreview();
} }
@ -506,13 +473,18 @@ void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue )
void OperationGUI_ChamferDlg::createSelWg( const QString& theLbl, void OperationGUI_ChamferDlg::createSelWg( const QString& theLbl,
QPixmap& thePix, QPixmap& thePix,
QWidget* theParent, QWidget* theParent,
QGridLayout* theLayout,
const int theId ) const int theId )
{ {
new QLabel( theLbl, theParent ); QLabel* lab = new QLabel( theLbl, theParent );
mySelBtn[ theId ] = new QPushButton( theParent ); mySelBtn[ theId ] = new QPushButton( theParent );
mySelBtn[ theId ]->setPixmap( thePix ); mySelBtn[ theId ]->setIcon( thePix );
mySelName[ theId ] = new QLineEdit( theParent ); mySelName[ theId ] = new QLineEdit( theParent );
mySelName[ theId ]->setReadOnly( true ); mySelName[ theId ]->setReadOnly( true );
int row = theLayout->rowCount();
theLayout->addWidget( lab, row, 0 );
theLayout->addWidget( mySelBtn[ theId ], row, 1 );
theLayout->addWidget( mySelName[ theId ], row, 2 );
} }
//================================================================================= //=================================================================================
@ -522,14 +494,14 @@ void OperationGUI_ChamferDlg::createSelWg( const QString& theLbl,
void OperationGUI_ChamferDlg::reset() void OperationGUI_ChamferDlg::reset()
{ {
// Set Initial values of spinboxes // Set Initial values of spinboxes
QMap< int, DlgRef_SpinBox* >::iterator anIter; QMap< int, QDoubleSpinBox* >::iterator anIter;
for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter ) for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )
anIter.data()->SetValue( 5 ); anIter.value()->setValue( 5 );
// clear line edits // clear line edits
QMap< int, QLineEdit* >::iterator anIterLE; QMap< int, QLineEdit* >::iterator anIterLE;
for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE ) for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
anIterLE.data()->setText( "" ); anIterLE.value()->setText( "" );
// constructor id // constructor id
int aConstructorId = getConstructorId(); int aConstructorId = getConstructorId();
@ -551,15 +523,6 @@ void OperationGUI_ChamferDlg::reset()
enableWidgets(); enableWidgets();
} }
//=================================================================================
// function : getConstructorId()
// purpose :
//=================================================================================
int OperationGUI_ChamferDlg::getConstructorId() const
{
return GroupConstructors->id( GroupConstructors->selected() );
}
//================================================================================= //=================================================================================
// function : activateSelection // function : activateSelection
// purpose : Activate selection in accordance with myEditCurrentArgument // purpose : Activate selection in accordance with myEditCurrentArgument
@ -653,18 +616,16 @@ bool OperationGUI_ChamferDlg::execute( ObjectList& objects )
if ( anId == 0 ) if ( anId == 0 )
anObj = GEOM::GEOM_ILocalOperations::_narrow( anObj = GEOM::GEOM_ILocalOperations::_narrow(
getOperation() )->MakeChamferAll( myShape, getOperation() )->MakeChamferAll( myShape,
mySpinBox[ SpinBox1 ]->GetValue() ); mySpinBox[ SpinBox1 ]->value() );
else if ( anId == 1 ) else if ( anId == 1 )
anObj = GEOM::GEOM_ILocalOperations::_narrow( anObj = GEOM::GEOM_ILocalOperations::_narrow(
getOperation() )->MakeChamferEdge( myShape, getOperation() )->MakeChamferEdge( myShape,
mySpinBox[ SpinBox21 ]->GetValue(), mySpinBox[ SpinBox21 ]->value(),
mySpinBox[ SpinBox22 ]->GetValue(), mySpinBox[ SpinBox22 ]->value(),
myFace[ Face1 ], myFace[ Face1 ],
myFace[ Face2 ] ); myFace[ Face2 ] );
else if ( anId == 2 ) else if ( anId == 2 )
{ {
int i = 0;
GEOM::ListOfLong_var anArray = new GEOM::ListOfLong; GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
anArray->length( myFaces.Extent() ); anArray->length( myFaces.Extent() );
@ -674,8 +635,8 @@ bool OperationGUI_ChamferDlg::execute( ObjectList& objects )
anObj = GEOM::GEOM_ILocalOperations::_narrow( anObj = GEOM::GEOM_ILocalOperations::_narrow(
getOperation() )->MakeChamferFaces( myShape, getOperation() )->MakeChamferFaces( myShape,
mySpinBox[ SpinBox31 ]->GetValue(), mySpinBox[ SpinBox31 ]->value(),
mySpinBox[ SpinBox32 ]->GetValue(), mySpinBox[ SpinBox32 ]->value(),
anArray ); anArray );
} }

View File

@ -19,19 +19,25 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI_ChamferDlg.h // File : OperationGUI_ChamferDlg.h
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_CHAMFER_H #ifndef OPERATIONGUI_CHAMFERDLG_H
#define DIALOGBOX_CHAMFER_H #define OPERATIONGUI_CHAMFERDLG_H
#include <GEOMBase_Skeleton.h>
#include "GEOMBase_Skeleton.h"
#include <TColStd_IndexedMapOfInteger.hxx> #include <TColStd_IndexedMapOfInteger.hxx>
class DlgRef_SpinBox; #include <QMap>
class QDoubleSpinBox;
class QGroupBox;
class QPushButton;
class QLineEdit;
class QDoubleSpinBox;
class QGridLayout;
//================================================================================= //=================================================================================
// class : OperationGUI_ChamferDlg // class : OperationGUI_ChamferDlg
@ -45,14 +51,14 @@ class OperationGUI_ChamferDlg : public GEOMBase_Skeleton
enum { SpinBox1, SpinBox21, SpinBox22, SpinBox31, SpinBox32 }; enum { SpinBox1, SpinBox21, SpinBox22, SpinBox31, SpinBox32 };
public: public:
OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QWidget* parent); OperationGUI_ChamferDlg( GeometryGUI*, QWidget* );
virtual ~OperationGUI_ChamferDlg(); virtual ~OperationGUI_ChamferDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& msg ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -61,15 +67,15 @@ private slots:
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ValueChangedInSpinBox( double newValue ); void ValueChangedInSpinBox( double );
void ConstructorsClicked( int constructorId ); void ConstructorsClicked( int );
private: private:
void Init(); void Init();
void enterEvent( QEvent* e ); void enterEvent( QEvent* );
void reset(); void reset();
void createSelWg( const QString&, QPixmap&, QWidget*, const int ); void createSelWg( const QString&, QPixmap&, QWidget*,
int getConstructorId() const; QGridLayout*, const int );
void activateSelection(); void activateSelection();
void enableWidgets(); void enableWidgets();
@ -80,13 +86,13 @@ private:
QMap< int, int > myFace; // indexes of faces from second tab ( Face1,2 ) QMap< int, int > myFace; // indexes of faces from second tab ( Face1,2 )
TColStd_IndexedMapOfInteger myFaces; // indexes of faces from first tab ( Faces ) TColStd_IndexedMapOfInteger myFaces; // indexes of faces from first tab ( Faces )
QFrame* myGrp1; QGroupBox* myGrp1;
QFrame* myGrp2; QGroupBox* myGrp2;
QFrame* myGrp3; QGroupBox* myGrp3;
QMap< int, QPushButton* > mySelBtn; QMap< int, QPushButton* > mySelBtn;
QMap< int, QLineEdit* > mySelName; QMap< int, QLineEdit* > mySelName;
QMap< int, DlgRef_SpinBox* > mySpinBox; QMap< int, QDoubleSpinBox* > mySpinBox;
}; };
#endif // DIALOGBOX_CHAMFER_H #endif // OPERATIONGUI_CHAMFERDLG_H

View File

@ -19,39 +19,30 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI_ClippingDlg.cxx // File : OperationGUI_ClippingDlg.cxx
// Author : Michael Zorin // Author : Michael Zorin, Open CASCADE S.A.S. (mikhail.zorin@opencascade.com)
// Module : GEOM //
// $Header:
#include "OperationGUI_ClippingDlg.h" #include "OperationGUI_ClippingDlg.h"
#include "DlgRef_SpinBox.h"
#include "SUIT_Session.h" #include <GEOM_DlgRef.h>
#include "SUIT_ViewWindow.h" #include <GeometryGUI.h>
#include "SVTK_ViewWindow.h" #include <GEOMBase.h>
#include "SVTK_ViewModel.h"
#include "OCCViewer_ViewWindow.h" #include <SUIT_Session.h>
#include "OCCViewer_ViewPort3d.h" #include <SUIT_Desktop.h>
#include <SUIT_ViewManager.h>
#include <SVTK_ViewWindow.h>
#include <SVTK_ViewModel.h>
#include <OCCViewer_ViewWindow.h>
#include <OCCViewer_ViewPort3d.h>
#include <VTKViewer.h>
#include "utilities.h" // OCC Includes
#include <V3d_View.hxx> #include <V3d_View.hxx>
#include <V3d.hxx> #include <V3d.hxx>
//#include <V3d_Plane.hxx>
// QT Includes
#include <qapplication.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qcombobox.h>
// VTK Includes // VTK Includes
#include "VTKViewer.h"
#include <vtkCamera.h> #include <vtkCamera.h>
#include <vtkRenderer.h> #include <vtkRenderer.h>
@ -60,61 +51,55 @@
// purpose : // purpose :
//================================================================================= //=================================================================================
OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton(theGeometryGUI, parent, "OperationGUI_ClippingDlg", false, : GEOMBase_Skeleton( theGeometryGUI, parent, false )
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
setCaption( tr( "Change clipping range" ) ); setWindowTitle( tr( "Change clipping range" ) );
GroupConstructors->close(); mainFrame()->GroupConstructors->setAttribute( Qt::WA_DeleteOnClose );
GroupBoxName->close(); mainFrame()->GroupConstructors->close();
mainFrame()->GroupBoxName->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->GroupBoxName->close();
/***************************************************************/ /***************************************************************/
GroupArguments = new QGroupBox( this, "GroupArguments" ); GroupArguments = new QGroupBox( centralWidget() );
GroupArguments->setColumnLayout(0, Qt::Vertical ); QGridLayout* GroupArgumentsLayout = new QGridLayout( GroupArguments );
GroupArguments->layout()->setSpacing( 0 );
GroupArguments->layout()->setMargin( 0 );
QGridLayout* GroupArgumentsLayout = new QGridLayout( GroupArguments->layout() );
GroupArgumentsLayout->setAlignment( Qt::AlignTop );
GroupArgumentsLayout->setSpacing( 6 ); GroupArgumentsLayout->setSpacing( 6 );
GroupArgumentsLayout->setMargin( 11 ); GroupArgumentsLayout->setMargin( 9 );
// Controls // Controls
TextLabelNear = new QLabel( GroupArguments, "TextLabelNear" ); TextLabelNear = new QLabel( tr( "Near" ), GroupArguments );
TextLabelNear->setText( tr( "Near" ) );
TextLabelNear->setFixedWidth(74);
GroupArgumentsLayout->addWidget( TextLabelNear, 0, 0 ); GroupArgumentsLayout->addWidget( TextLabelNear, 0, 0 );
SpinBox_Near = new DlgRef_SpinBox( GroupArguments, "SpinBox_Near"); SpinBox_Near = new QDoubleSpinBox( GroupArguments );
GroupArgumentsLayout->addWidget( SpinBox_Near, 0, 1 ); GroupArgumentsLayout->addWidget( SpinBox_Near, 0, 1 );
TextLabelFar = new QLabel( GroupArguments, "TextLabelFar" ); TextLabelFar = new QLabel( tr( "Far" ), GroupArguments );
TextLabelFar->setText( tr( "Far" ) );
TextLabelFar->setFixedWidth(74);
GroupArgumentsLayout->addWidget( TextLabelFar, 0, 2 ); GroupArgumentsLayout->addWidget( TextLabelFar, 0, 2 );
SpinBox_Far = new DlgRef_SpinBox( GroupArguments, "SpinBox_Far"); SpinBox_Far = new QDoubleSpinBox( GroupArguments );
GroupArgumentsLayout->addWidget( SpinBox_Far, 0, 3 ); GroupArgumentsLayout->addWidget( SpinBox_Far, 0, 3 );
resetButton = new QPushButton( GroupArguments, "resetButton" ); resetButton = new QPushButton( tr( "Reset" ), GroupArguments );
resetButton->setText( tr( "Reset" ) );
GroupArgumentsLayout->addWidget( resetButton, 0, 4 ); GroupArgumentsLayout->addWidget( resetButton, 0, 4 );
TypeCB = new QComboBox( GroupArguments, "TypeCB" ); TypeCB = new QComboBox( GroupArguments );
TypeCB->insertItem(tr("OFF")); TypeCB->addItem( tr( "OFF" ) );
TypeCB->insertItem(tr("BACK")); TypeCB->addItem( tr( "BACK" ) );
TypeCB->insertItem(tr("FRONT")); TypeCB->addItem( tr( "FRONT" ) );
TypeCB->insertItem(tr("SLICE")); TypeCB->addItem( tr( "SLICE" ) );
GroupArgumentsLayout->addMultiCellWidget( TypeCB, 1, 1, 0, 4 ); GroupArgumentsLayout->addWidget( TypeCB, 1, 0, 1, 5 );
Layout1->addWidget( GroupArguments, 2, 0 ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupArguments );
/* Initialisations */ /* Initialisations */
SpinBox_Near->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10.0, 3 ); initSpinBox( SpinBox_Near, COORD_MIN, COORD_MAX, 10.0, 3 );
SpinBox_Far->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10.0, 3 ); initSpinBox( SpinBox_Far, COORD_MIN, COORD_MAX, 10.0, 3 );
/* signals and slots connections */ /* signals and slots connections */
connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( resetButton, SIGNAL( clicked() ), this, SLOT( onReset() ) ) ; connect( resetButton, SIGNAL( clicked() ), this, SLOT( onReset() ) ) ;
@ -142,8 +127,7 @@ void OperationGUI_ClippingDlg::Init()
if ( !anActiveWindow ) if ( !anActiveWindow )
return; return;
if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
{
SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow ); SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow );
if ( !aVTKFrame ) if ( !aVTKFrame )
return; return;
@ -158,7 +142,6 @@ void OperationGUI_ClippingDlg::Init()
vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); vtkCamera* anActiveCamera = aRenderer->GetActiveCamera();
if ( anActiveCamera == NULL ) { if ( anActiveCamera == NULL ) {
MESSAGE("Trying to reset clipping range of non-existant camera");
return; return;
} }
@ -186,13 +169,12 @@ void OperationGUI_ClippingDlg::Init()
vtkFloatingPointType range[2] = { distance - width/2.0, distance + width/2.0 }; vtkFloatingPointType range[2] = { distance - width/2.0, distance + width/2.0 };
SpinBox_Near->SetValue(range[0]); SpinBox_Near->setValue( range[0] );
SpinBox_Far->SetValue(range[1]); SpinBox_Far->setValue( range[1] );
return; return;
} }
else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
{
OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow ); OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow );
TextLabelNear->setText( tr( "Depth" ) ); TextLabelNear->setText( tr( "Depth" ) );
@ -202,9 +184,9 @@ void OperationGUI_ClippingDlg::Init()
double depth, thickness; double depth, thickness;
int ztype = view3d->ZClipping( depth, thickness ); int ztype = view3d->ZClipping( depth, thickness );
SpinBox_Near->SetValue(depth); SpinBox_Near->setValue( depth );
SpinBox_Far->SetValue(thickness); SpinBox_Far->setValue( thickness );
TypeCB->setCurrentItem(ztype); TypeCB->setCurrentIndex( ztype );
//Handle(V3d_Plane) aPlane = new V3d_Plane( aOCCFrame->getViewer()->getViewer3d() ,0, 0, 1, -100); //Handle(V3d_Plane) aPlane = new V3d_Plane( aOCCFrame->getViewer()->getViewer3d() ,0, 0, 1, -100);
//aPlane->Display(view3d); //aPlane->Display(view3d);
@ -222,8 +204,7 @@ bool OperationGUI_ClippingDlg::ClickOnApply()
if ( !anActiveWindow ) if ( !anActiveWindow )
return false; return false;
if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
{
SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow ); SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow );
if ( !aVTKFrame ) if ( !aVTKFrame )
return false; return false;
@ -233,25 +214,23 @@ bool OperationGUI_ClippingDlg::ClickOnApply()
vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); vtkCamera* anActiveCamera = aRenderer->GetActiveCamera();
if ( anActiveCamera == NULL ) { if ( anActiveCamera == NULL ) {
MESSAGE("Trying to reset clipping range of non-existant camera");
return false; return false;
} }
vtkFloatingPointType range[2] = { SpinBox_Near->GetValue(), SpinBox_Far->GetValue() }; vtkFloatingPointType range[2] = { SpinBox_Near->value(), SpinBox_Far->value() };
if ( range[0] < 0.0 ) range[0] = 0.0; if ( range[0] < 0.0 ) range[0] = 0.0;
anActiveCamera->SetClippingRange( range ); anActiveCamera->SetClippingRange( range );
return true; return true;
} }
else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
{
OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow ); OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow );
Handle(V3d_View) view3d = ( (OCCViewer_ViewPort3d*)aOCCFrame->getViewPort() )->getView(); Handle(V3d_View) view3d = ( (OCCViewer_ViewPort3d*)aOCCFrame->getViewPort() )->getView();
double depth = SpinBox_Near->GetValue(); double depth = SpinBox_Near->value();
double thickness = SpinBox_Far->GetValue(); double thickness = SpinBox_Far->value();
int aType = TypeCB->currentItem(); int aType = TypeCB->currentIndex();
view3d->SetZClippingType( V3d_TypeOfZclipping( aType ) ); view3d->SetZClippingType( V3d_TypeOfZclipping( aType ) );
view3d->SetZClippingDepth( depth ); view3d->SetZClippingDepth( depth );
@ -267,7 +246,7 @@ bool OperationGUI_ClippingDlg::ClickOnApply()
//================================================================================= //=================================================================================
void OperationGUI_ClippingDlg::ClickOnOk() void OperationGUI_ClippingDlg::ClickOnOk()
{ {
ClickOnApply(); if ( ClickOnApply() )
ClickOnCancel(); ClickOnCancel();
} }
@ -287,7 +266,6 @@ void OperationGUI_ClippingDlg::onActivate()
void OperationGUI_ClippingDlg::enterEvent( QEvent* ) void OperationGUI_ClippingDlg::enterEvent( QEvent* )
{ {
this->setEnabled( true ); this->setEnabled( true );
return;
} }
//================================================================================= //=================================================================================
@ -310,8 +288,7 @@ void OperationGUI_ClippingDlg::onReset()
if ( !anActiveWindow ) if ( !anActiveWindow )
return; return;
if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
{
SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow ); SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow );
if ( !aVTKFrame ) if ( !aVTKFrame )
return; return;
@ -321,7 +298,6 @@ void OperationGUI_ClippingDlg::onReset()
vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); vtkCamera* anActiveCamera = aRenderer->GetActiveCamera();
if ( anActiveCamera == NULL ) { if ( anActiveCamera == NULL ) {
MESSAGE("Trying to reset clipping range of non-existant camera");
return; return;
} }
@ -349,13 +325,12 @@ void OperationGUI_ClippingDlg::onReset()
vtkFloatingPointType range[2] = { distance - width/2.0, distance + width/2.0 }; vtkFloatingPointType range[2] = { distance - width/2.0, distance + width/2.0 };
SpinBox_Near->SetValue(range[0]); SpinBox_Near->setValue( range[0] );
SpinBox_Far->SetValue(range[1]); SpinBox_Far->setValue( range[1] );
return; return;
} }
else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
{
OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow ); OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow );
TextLabelNear->setText( tr( "Depth" ) ); TextLabelNear->setText( tr( "Depth" ) );
@ -367,10 +342,8 @@ void OperationGUI_ClippingDlg::onReset()
view3d->ZFitAll(); view3d->ZFitAll();
double depth, thickness; double depth, thickness;
int ztype= view3d->ZClipping( depth, thickness ); int ztype= view3d->ZClipping( depth, thickness );
SpinBox_Near->SetValue(0); SpinBox_Near->setValue( 0 );
SpinBox_Far->SetValue(1000); SpinBox_Far->setValue( 1000 );
TypeCB->setCurrentItem(ztype); TypeCB->setCurrentIndex( ztype );
} }
return;
} }

View File

@ -19,22 +19,20 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI_ClippingDlg.h // File : OperationGUI_ClippingDlg.h
// Author : Michael Zorin // Author : Michael Zorin, Open CASCADE S.A.S. (mikhail.zorin@opencascade.com)
// Module : GEOM //
#ifndef DIALOGBOX_CLIPPINGRANGE_H #ifndef OPERATIONGUI_CLIPPINGDLG_H
#define DIALOGBOX_CLIPPING_H #define OPERATIONGUI_CLIPPINGDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
class QGroupBox; class QGroupBox;
class QLabel; class QLabel;
class QPushButton; class QPushButton;
class QComboBox; class QComboBox;
class DlgRef_SpinBox; class QDoubleSpinBox;
enum ViewerTypes { VTK, OCC, OTHER }; enum ViewerTypes { VTK, OCC, OTHER };
@ -47,22 +45,23 @@ class OperationGUI_ClippingDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
OperationGUI_ClippingDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0); OperationGUI_ClippingDlg( GeometryGUI*, QWidget* = 0 );
~OperationGUI_ClippingDlg(); ~OperationGUI_ClippingDlg();
private: private:
void Init(); void Init();
ViewerTypes myViewerType; virtual void closeEvent( QCloseEvent* );
void enterEvent( QEvent* );
virtual void closeEvent( QCloseEvent* e ); private:
void enterEvent(QEvent* e); ViewerTypes myViewerType;
QGroupBox* GroupArguments; QGroupBox* GroupArguments;
QLabel* TextLabelNear; QLabel* TextLabelNear;
DlgRef_SpinBox* SpinBox_Near; QDoubleSpinBox* SpinBox_Near;
QLabel* TextLabelFar; QLabel* TextLabelFar;
DlgRef_SpinBox* SpinBox_Far; QDoubleSpinBox* SpinBox_Far;
QPushButton* resetButton; QPushButton* resetButton;
QComboBox* TypeCB; QComboBox* TypeCB;
@ -73,4 +72,4 @@ private slots:
void onReset(); void onReset();
}; };
#endif // DIALOGBOX_CLIPPINGRANGE_H #endif // OPERATIONGUI_CLIPPINGDLG_H

View File

@ -19,30 +19,29 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI_FilletDlg.cxx // File : OperationGUI_FilletDlg.cxx
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "OperationGUI_FilletDlg.h" #include "OperationGUI_FilletDlg.h"
#include "DlgRef_1Sel1Spin.h"
#include "DlgRef_2Sel1Spin.h"
#include "SUIT_Desktop.h" #include <GEOM_DlgRef.h>
#include "SUIT_Session.h" #include <GeometryGUI.h>
#include "SalomeApp_Application.h" #include <GEOMBase.h>
#include "LightApp_SelectionMgr.h"
#include "OCCViewer_ViewModel.h" #include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <OCCViewer_ViewModel.h>
#include "qlabel.h"
#include "qpixmap.h"
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx> #include <TColStd_IndexedMapOfInteger.hxx>
#include <list>
#include "GEOMImpl_Types.hxx" #include <GEOMImpl_Types.hxx>
//================================================================================= //=================================================================================
// class : OperationGUI_FilletDlg() // class : OperationGUI_FilletDlg()
@ -52,11 +51,8 @@
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
OperationGUI_FilletDlg::OperationGUI_FilletDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) OperationGUI_FilletDlg::OperationGUI_FilletDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
:GEOMBase_Skeleton(theGeometryGUI, parent, "OperationGUI_FilletDlg", false, : GEOMBase_Skeleton( theGeometryGUI, parent, false )
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
myConstructorId = -1;
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_ALL" ) ) ); QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_ALL" ) ) );
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_EDGE" ) ) ); QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_EDGE" ) ) );
@ -64,50 +60,52 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg(GeometryGUI* theGeometryGUI, QWid
QPixmap iconSelect( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap iconSelect( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_FILLET_TITLE")); setWindowTitle( tr( "GEOM_FILLET_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle( tr( "GEOM_FILLET" ) ); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_FILLET" ) );
RadioButton1->setPixmap( image0 ); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setPixmap( image1 ); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->setPixmap( image2 ); mainFrame()->RadioButton3->setIcon( image2 );
Group1 = new DlgRef_1Sel1Spin( this, "Group1" ); Group1 = new DlgRef_1Sel1Spin( centralWidget() );
Group1->GroupBox1->setTitle( tr( "GEOM_FILLET_ALL" ) ); Group1->GroupBox1->setTitle( tr( "GEOM_FILLET_ALL" ) );
Group1->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); Group1->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
Group1->TextLabel2->setText( tr( "GEOM_RADIUS" ) ); Group1->TextLabel2->setText( tr( "GEOM_RADIUS" ) );
Group1->PushButton1->setPixmap( iconSelect ); Group1->PushButton1->setIcon( iconSelect );
Group1->LineEdit1->setReadOnly( true ); Group1->LineEdit1->setReadOnly( true );
Group2 = new DlgRef_2Sel1Spin( this, "Group2" ); Group2 = new DlgRef_2Sel1Spin( centralWidget() );
Group2->GroupBox1->setTitle( tr( "GEOM_FILLET_EDGES" ) ); Group2->GroupBox1->setTitle( tr( "GEOM_FILLET_EDGES" ) );
Group2->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); Group2->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
Group2->TextLabel2->setText( tr( "SELECTED_EDGES" ) ); Group2->TextLabel2->setText( tr( "SELECTED_EDGES" ) );
Group2->TextLabel3->setText( tr( "GEOM_RADIUS" ) ); Group2->TextLabel3->setText( tr( "GEOM_RADIUS" ) );
Group2->PushButton1->setPixmap( iconSelect ); Group2->PushButton1->setIcon( iconSelect );
Group2->PushButton2->setPixmap( iconSelect ); Group2->PushButton2->setIcon( iconSelect );
Group2->LineEdit1->setReadOnly( true ); Group2->LineEdit1->setReadOnly( true );
Group2->LineEdit2->setReadOnly( true ); Group2->LineEdit2->setReadOnly( true );
Group3 = new DlgRef_2Sel1Spin( this, "Group3" ); Group3 = new DlgRef_2Sel1Spin( centralWidget() );
Group3->GroupBox1->setTitle( tr( "GEOM_FILLET_FACES" ) ); Group3->GroupBox1->setTitle( tr( "GEOM_FILLET_FACES" ) );
Group3->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) ); Group3->TextLabel1->setText( tr( "GEOM_MAIN_OBJECT" ) );
Group3->TextLabel2->setText( tr( "SELECTED_FACES" ) ); Group3->TextLabel2->setText( tr( "SELECTED_FACES" ) );
Group3->TextLabel3->setText( tr( "GEOM_RADIUS" ) ); Group3->TextLabel3->setText( tr( "GEOM_RADIUS" ) );
Group3->PushButton1->setPixmap( iconSelect ); Group3->PushButton1->setIcon( iconSelect );
Group3->PushButton2->setPixmap( iconSelect ); Group3->PushButton2->setIcon( iconSelect );
Group3->LineEdit1->setReadOnly( true ); Group3->LineEdit1->setReadOnly( true );
Group3->LineEdit2->setReadOnly( true ); Group3->LineEdit2->setReadOnly( true );
Layout1->addWidget( Group1, 2, 0 ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
Layout1->addWidget( Group2, 2, 0 ); layout->setMargin( 0 ); layout->setSpacing( 6 );
Layout1->addWidget( Group3, 2, 0 ); layout->addWidget( Group1 );
layout->addWidget( Group2 );
layout->addWidget( Group3 );
/***************************************************************/ /***************************************************************/
double SpecificStep = 10.0; double SpecificStep = 10.0;
Group1->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, 3); initSpinBox( Group1->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3 );
Group2->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, 3); initSpinBox( Group2->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3 );
Group3->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, 3); initSpinBox( Group3->SpinBox_DX, 0.001, COORD_MAX, SpecificStep, 3 );
setHelpFileName( "fillet.htm" ); setHelpFileName( "fillet.htm" );
@ -133,15 +131,13 @@ void OperationGUI_FilletDlg::Init()
{ {
myConstructorId = -1; myConstructorId = -1;
reset(); reset();
RadioButton1->setChecked( true );
myEditCurrentArgument = Group1->LineEdit1;
// main buttons // main buttons
connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
// group box // group box
connect( GroupConstructors, SIGNAL( clicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
// push buttons // push buttons
connect( Group1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( Group1->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -166,9 +162,7 @@ void OperationGUI_FilletDlg::Init()
initName( tr( "GEOM_FILLET" ) ); initName( tr( "GEOM_FILLET" ) );
Group2->hide(); ConstructorsClicked( 0 );
Group3->hide();
Group1->show();
} }
@ -179,9 +173,8 @@ void OperationGUI_FilletDlg::Init()
void OperationGUI_FilletDlg::ConstructorsClicked( int constructorId ) void OperationGUI_FilletDlg::ConstructorsClicked( int constructorId )
{ {
if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type() ) != OCCViewer_Viewer::Type() ) {
{ mainFrame()->RadioButton1->setChecked( true );
RadioButton1->setChecked( true );
return; return;
} }
@ -190,31 +183,30 @@ void OperationGUI_FilletDlg::ConstructorsClicked( int constructorId )
// Get radius from previous widget // Get radius from previous widget
double R = 5; double R = 5;
if ( myConstructorId == 0 ) R = Group1->SpinBox_DX->GetValue(); if ( myConstructorId == 0 ) R = Group1->SpinBox_DX->value();
else if ( myConstructorId == 1 ) R = Group2->SpinBox_DX->GetValue(); else if ( myConstructorId == 1 ) R = Group2->SpinBox_DX->value();
else R = Group3->SpinBox_DX->GetValue(); else R = Group3->SpinBox_DX->value();
myConstructorId = constructorId; myConstructorId = constructorId;
switch ( constructorId ) switch ( constructorId ) {
{
case 0: case 0:
Group1->show();
Group2->hide(); Group2->hide();
Group3->hide(); Group3->hide();
Group1->SpinBox_DX->SetValue( R ); Group1->show();
Group1->SpinBox_DX->setValue( R );
break; break;
case 1: case 1:
Group1->hide(); Group1->hide();
Group2->show();
Group3->hide(); Group3->hide();
Group2->SpinBox_DX->SetValue( R ); Group2->show();
Group2->SpinBox_DX->setValue( R );
break; break;
case 2: case 2:
Group1->hide(); Group1->hide();
Group2->hide(); Group2->hide();
Group3->show(); Group3->show();
Group3->SpinBox_DX->SetValue( R ); Group3->SpinBox_DX->setValue( R );
break; break;
default: default:
break; break;
@ -227,14 +219,17 @@ void OperationGUI_FilletDlg::ConstructorsClicked( int constructorId )
activateSelection(); activateSelection();
enableWidgets(); enableWidgets();
if ( !myShape->_is_nil() ) if ( !myShape->_is_nil() ) {
{
myEditCurrentArgument->setText( GEOMBase::GetName( myShape ) ); myEditCurrentArgument->setText( GEOMBase::GetName( myShape ) );
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
else else
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
displayPreview(); displayPreview();
} }
@ -275,16 +270,13 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
// If selection of main object is activated // If selection of main object is activated
if ( myEditCurrentArgument == Group1->LineEdit1 || if ( myEditCurrentArgument == Group1->LineEdit1 ||
myEditCurrentArgument == Group2->LineEdit1 || myEditCurrentArgument == Group2->LineEdit1 ||
myEditCurrentArgument == Group3->LineEdit1 ) myEditCurrentArgument == Group3->LineEdit1 ) {
{ if ( IObjectCount() == 1 ) {
if ( IObjectCount() == 1 )
{
Standard_Boolean aResult = Standard_False; Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
if ( aResult && !anObj->_is_nil() ) if ( aResult && !anObj->_is_nil() ) {
{
myShape = anObj; myShape = anObj;
myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) ); myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) );
displayPreview(); displayPreview();
@ -298,24 +290,19 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
} }
// If face or edge selection is activated // If face or edge selection is activated
else if ( myEditCurrentArgument == Group2->LineEdit2 || else if ( myEditCurrentArgument == Group2->LineEdit2 ||
myEditCurrentArgument == Group3->LineEdit2 ) myEditCurrentArgument == Group3->LineEdit2 ) {
{ if ( IObjectCount() == 1 ) {
if ( IObjectCount() == 1 )
{
Standard_Boolean aResult = Standard_False; Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
if ( aResult && !anObj->_is_nil() ) if ( aResult && !anObj->_is_nil() ) {
{
TColStd_IndexedMapOfInteger anIndexes; TColStd_IndexedMapOfInteger anIndexes;
myGeomGUI->getApp()->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); myGeomGUI->getApp()->selectionMgr()->GetIndexes( firstIObject(), anIndexes );
if ( anIndexes.Extent() > 0 ) if ( anIndexes.Extent() > 0 ) {
{
QString aName; QString aName;
if ( anIndexes.Extent() == 1 ) if ( anIndexes.Extent() == 1 ) {
{
int anIndex = anIndexes( 1 ); int anIndex = anIndexes( 1 );
aName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex ); aName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex );
@ -358,7 +345,6 @@ void OperationGUI_FilletDlg::LineEditReturnPressed()
return; return;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
return;
} }
@ -370,28 +356,23 @@ void OperationGUI_FilletDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if ( send == Group1->PushButton1 ) if ( send == Group1->PushButton1 ) {
{
Group1->LineEdit1->setFocus(); Group1->LineEdit1->setFocus();
myEditCurrentArgument = Group1->LineEdit1; myEditCurrentArgument = Group1->LineEdit1;
} }
else if( send == Group2->PushButton1 ) else if ( send == Group2->PushButton1 ) {
{
Group2->LineEdit1->setFocus(); Group2->LineEdit1->setFocus();
myEditCurrentArgument = Group2->LineEdit1; myEditCurrentArgument = Group2->LineEdit1;
} }
else if( send == Group2->PushButton2 ) else if ( send == Group2->PushButton2 ) {
{
Group2->LineEdit2->setFocus(); Group2->LineEdit2->setFocus();
myEditCurrentArgument = Group2->LineEdit2; myEditCurrentArgument = Group2->LineEdit2;
} }
else if ( send == Group3->PushButton1 ) else if ( send == Group3->PushButton1 ) {
{
Group3->LineEdit1->setFocus(); Group3->LineEdit1->setFocus();
myEditCurrentArgument = Group3->LineEdit1; myEditCurrentArgument = Group3->LineEdit1;
} }
else if( send == Group3->PushButton2 ) else if ( send == Group3->PushButton2 ) {
{
Group3->LineEdit1->setFocus(); Group3->LineEdit1->setFocus();
myEditCurrentArgument = Group3->LineEdit2; myEditCurrentArgument = Group3->LineEdit2;
} }
@ -420,9 +401,9 @@ void OperationGUI_FilletDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void OperationGUI_FilletDlg::enterEvent( QEvent* e ) void OperationGUI_FilletDlg::enterEvent( QEvent* )
{ {
if ( !GroupConstructors->isEnabled() ) if ( !mainFrame()->GroupConstructors->isEnabled() )
this->ActivateThisDialog(); this->ActivateThisDialog();
} }
@ -430,7 +411,7 @@ void OperationGUI_FilletDlg::enterEvent( QEvent* e )
// function : ValueChangedInSpinBox() // function : ValueChangedInSpinBox()
// purpose : // purpose :
//================================================================================= //=================================================================================
void OperationGUI_FilletDlg::ValueChangedInSpinBox( double newValue ) void OperationGUI_FilletDlg::ValueChangedInSpinBox( double )
{ {
displayPreview(); displayPreview();
} }
@ -442,9 +423,9 @@ void OperationGUI_FilletDlg::ValueChangedInSpinBox( double newValue )
void OperationGUI_FilletDlg::reset() void OperationGUI_FilletDlg::reset()
{ {
// Set Initial values of spinboxes // Set Initial values of spinboxes
Group1->SpinBox_DX->SetValue( 5 ); Group1->SpinBox_DX->setValue( 5 );
Group2->SpinBox_DX->SetValue( 5 ); Group2->SpinBox_DX->setValue( 5 );
Group3->SpinBox_DX->SetValue( 5 ); Group3->SpinBox_DX->setValue( 5 );
Group1->LineEdit1->setText( "" ); Group1->LineEdit1->setText( "" );
Group2->LineEdit1->setText( "" ); Group2->LineEdit1->setText( "" );
@ -471,15 +452,6 @@ void OperationGUI_FilletDlg::reset()
enableWidgets(); enableWidgets();
} }
//=================================================================================
// function : getConstructorId()
// purpose :
//=================================================================================
int OperationGUI_FilletDlg::getConstructorId() const
{
return GroupConstructors->id( GroupConstructors->selected() );
}
//================================================================================= //=================================================================================
// function : activateSelection // function : activateSelection
// purpose : Activate selection in accordance with myEditCurrentArgument // purpose : Activate selection in accordance with myEditCurrentArgument
@ -491,8 +463,7 @@ void OperationGUI_FilletDlg::activateSelection()
localSelection( myShape, TopAbs_EDGE ); localSelection( myShape, TopAbs_EDGE );
else if ( !myShape->_is_nil() && myEditCurrentArgument == Group3->LineEdit2 ) else if ( !myShape->_is_nil() && myEditCurrentArgument == Group3->LineEdit2 )
localSelection( myShape, TopAbs_FACE ); localSelection( myShape, TopAbs_FACE );
else else {
{
TColStd_MapOfInteger aMap; TColStd_MapOfInteger aMap;
aMap.Add( GEOM_SHELL ); aMap.Add( GEOM_SHELL );
aMap.Add( GEOM_SOLID ); aMap.Add( GEOM_SOLID );
@ -513,24 +484,20 @@ void OperationGUI_FilletDlg::enableWidgets()
bool toEnable = !myShape->_is_nil(); bool toEnable = !myShape->_is_nil();
if ( anId == 1 ) if ( anId == 1 ) {
{
Group2->LineEdit2->setEnabled( toEnable ); Group2->LineEdit2->setEnabled( toEnable );
Group2->PushButton2->setEnabled( toEnable ); Group2->PushButton2->setEnabled( toEnable );
if ( !toEnable ) if ( !toEnable ) {
{
Group2->LineEdit2->setText( "" ); Group2->LineEdit2->setText( "" );
myEdges.Clear(); myEdges.Clear();
} }
} }
else if ( anId == 2 ) else if ( anId == 2 ) {
{
Group3->LineEdit2->setEnabled( toEnable ); Group3->LineEdit2->setEnabled( toEnable );
Group3->PushButton2->setEnabled( toEnable ); Group3->PushButton2->setEnabled( toEnable );
if ( !toEnable ) if ( !toEnable ) {
{
Group3->LineEdit2->setText( "" ); Group3->LineEdit2->setText( "" );
myFaces.Clear(); myFaces.Clear();
} }
@ -574,8 +541,7 @@ bool OperationGUI_FilletDlg::execute( ObjectList& objects )
anObj = GEOM::GEOM_ILocalOperations::_narrow( anObj = GEOM::GEOM_ILocalOperations::_narrow(
getOperation() )->MakeFilletAll( myShape, getOperation() )->MakeFilletAll( myShape,
getRadius() ); getRadius() );
else if ( anId == 1 ) else if ( anId == 1 ) {
{
GEOM::ListOfLong_var aList = new GEOM::ListOfLong; GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
aList->length( myEdges.Extent() ); aList->length( myEdges.Extent() );
@ -585,9 +551,7 @@ bool OperationGUI_FilletDlg::execute( ObjectList& objects )
anObj = GEOM::GEOM_ILocalOperations::_narrow( anObj = GEOM::GEOM_ILocalOperations::_narrow(
getOperation() )->MakeFilletEdges( myShape, getRadius(), aList ); getOperation() )->MakeFilletEdges( myShape, getRadius(), aList );
} }
else if ( anId == 2 ) else if ( anId == 2 ) {
{
int i = 0;
GEOM::ListOfLong_var aList = new GEOM::ListOfLong; GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
aList->length( myFaces.Extent() ); aList->length( myFaces.Extent() );
@ -611,7 +575,7 @@ bool OperationGUI_FilletDlg::execute( ObjectList& objects )
double OperationGUI_FilletDlg::getRadius() const double OperationGUI_FilletDlg::getRadius() const
{ {
int anId = getConstructorId(); int anId = getConstructorId();
if ( anId == 0 ) return Group1->SpinBox_DX->GetValue(); if ( anId == 0 ) return Group1->SpinBox_DX->value();
else if ( anId == 1 ) return Group2->SpinBox_DX->GetValue(); else if ( anId == 1 ) return Group2->SpinBox_DX->value();
else return Group3->SpinBox_DX->GetValue(); else return Group3->SpinBox_DX->value();
} }

View File

@ -19,16 +19,14 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI_FilletDlg.h // File : OperationGUI_FilletDlg.h
// Author : Damien COQUERET // Author : Damien COQUERET, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_FILLET_H #ifndef OPERATIONGUI_FILLETDLG_H
#define DIALOGBOX_FILLET_H #define OPERATIONGUI_FILLETDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
#include <TColStd_IndexedMapOfInteger.hxx> #include <TColStd_IndexedMapOfInteger.hxx>
@ -44,14 +42,14 @@ class OperationGUI_FilletDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
OperationGUI_FilletDlg(GeometryGUI* theGeometryGUI, QWidget* parent); OperationGUI_FilletDlg( GeometryGUI*, QWidget* );
~OperationGUI_FilletDlg(); ~OperationGUI_FilletDlg();
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& msg ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -60,14 +58,13 @@ private slots:
void LineEditReturnPressed(); void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ValueChangedInSpinBox( double newValue ); void ValueChangedInSpinBox( double );
void ConstructorsClicked( int constructorId ); void ConstructorsClicked( int );
private: private:
void Init(); void Init();
void enterEvent( QEvent* e ); void enterEvent( QEvent* );
void reset(); void reset();
int getConstructorId() const;
void activateSelection(); void activateSelection();
void enableWidgets(); void enableWidgets();
double getRadius() const; double getRadius() const;
@ -84,4 +81,4 @@ private:
DlgRef_2Sel1Spin* Group3; DlgRef_2Sel1Spin* Group3;
}; };
#endif // DIALOGBOX_FILLET_H #endif // OPERATIONGUI_FILLETDLG_H

View File

@ -18,27 +18,21 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI_MaterialDlg.cxx // File : OperationGUI_MaterialDlg.cxx
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
// Module : GEOM //
// $Header$
#include "OperationGUI_MaterialDlg.h" #include "OperationGUI_MaterialDlg.h"
#include "OperationGUI_PartitionDlg.h" #include "OperationGUI_PartitionDlg.h"
#include "SUIT_Session.h" #include <GEOM_DlgRef.h>
#include "SalomeApp_Application.h" #include <GEOMBase.h>
#include "LightApp_SelectionMgr.h" #include <GeometryGUI.h>
#include "utilities.h" #include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <qlabel.h> #include <SalomeApp_Application.h>
#include <qlistview.h> #include <LightApp_SelectionMgr.h>
#include <qspinbox.h>
using namespace std;
//================================================================================= //=================================================================================
// class : OperationGUI_MaterialDlg() // class : OperationGUI_MaterialDlg()
@ -48,36 +42,38 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
OperationGUI_MaterialDlg::OperationGUI_MaterialDlg( GeometryGUI* theGeometryGUI, QWidget* parent, OperationGUI_MaterialDlg::OperationGUI_MaterialDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
const char* name, GEOM::ListOfGO ListShapes, GEOM::ListOfGO ListShapes, bool modal )
bool modal, WFlags fl) : GEOMBase_Skeleton( theGeometryGUI, parent, modal )
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
myListShapes = ListShapes; myListShapes = ListShapes;
myParentDlg = parent;
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PARTITION" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PARTITION" ) ) );
setCaption(tr("GEOM_MATERIAL_TITLE")); setWindowTitle( tr( "GEOM_MATERIAL_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_PARTITION")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PARTITION" ) );
RadioButton1->setPixmap(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->close(TRUE); mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
RadioButton3->close(TRUE); mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_1List1Spin1Btn_QTD(this, "GroupPoints"); GroupPoints = new DlgRef_1List1Spin1Btn( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
myShapeCol = GroupPoints->ListView1->addColumn(tr("GEOM_MATERIAL_SHAPE")); QStringList columns;
myMaterCol = GroupPoints->ListView1->addColumn(tr("GEOM_MATERIAL_MATERIAL")); columns << tr( "GEOM_MATERIAL_SHAPE" ) << tr( "GEOM_MATERIAL_MATERIAL" );
GroupPoints->ListView1->setSelectionMode(QListView::Extended); GroupPoints->ListView1->setHeaderLabels( columns );
GroupPoints->ListView1->setSorting(-1); GroupPoints->ListView1->setSelectionMode( QAbstractItemView::ExtendedSelection );
GroupPoints->ListView1->setSortingEnabled( false );
GroupPoints->TextLabel1->setText( tr( "GEOM_MATERIAL_ID" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_MATERIAL_ID" ) );
GroupPoints->PushButton1->setText( tr( "GEOM_MATERIAL_SET" ) ); GroupPoints->PushButton1->setText( tr( "GEOM_MATERIAL_SET" ) );
Layout1->addWidget(GroupPoints, 1, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
setHelpFileName( "partition.htm" ); setHelpFileName( "partition.htm" );
@ -102,38 +98,27 @@ void OperationGUI_MaterialDlg::Init()
{ {
// get materials list from the parent dialog // get materials list from the parent dialog
OperationGUI_PartitionDlg* aParentDlg = OperationGUI_PartitionDlg* aParentDlg =
dynamic_cast<OperationGUI_PartitionDlg*>(myParentDlg); qobject_cast<OperationGUI_PartitionDlg*>( parentWidget() );
if ( aParentDlg ) if ( aParentDlg )
myListMaterials = aParentDlg->GetListMaterials(); myListMaterials = aParentDlg->GetListMaterials();
/* list filling */ /* list filling */
MESSAGE("Filling list with " << myListShapes.length() << " objects");
QString aMaterialId;
QListViewItem *anItem = NULL;
for ( int ind = 0; ind < myListShapes.length(); ind++ ) { for ( int ind = 0; ind < myListShapes.length(); ind++ ) {
GEOM::GEOM_Object_var anObject = myListShapes[ind]; GEOM::GEOM_Object_var anObject = myListShapes[ind];
if ( !anObject->_is_nil() ) { if ( !anObject->_is_nil() ) {
MESSAGE("Insert " << GEOMBase::GetName( anObject )); QStringList labels;
if (ind < myListMaterials.length()) labels << GEOMBase::GetName( anObject );
aMaterialId = QString::number(myListMaterials[ind]); labels << ( ind < myListMaterials.length() ?
else QString::number( myListMaterials[ind] ) : QString( "0" ) );
aMaterialId = "0"; GroupPoints->ListView1->addTopLevelItem( new QTreeWidgetItem( labels ) );
if (anItem)
// insert after aPrevItem
anItem = new QListViewItem(GroupPoints->ListView1, anItem,
GEOMBase::GetName( anObject ), aMaterialId);
else
// the first item creation
anItem = new QListViewItem(GroupPoints->ListView1,
GEOMBase::GetName( anObject ), aMaterialId);
} }
} }
MESSAGE("Filled");
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
buttonApply->close(TRUE); buttonApply()->setAttribute( Qt::WA_DeleteOnClose );
buttonCancel->setText(tr("GEOM_BUT_CANCEL")); buttonApply()->close();
buttonCancel()->setText( tr( "GEOM_BUT_CANCEL" ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetMaterial() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetMaterial() ) );
@ -148,28 +133,22 @@ void OperationGUI_MaterialDlg::Init()
//================================================================================= //=================================================================================
void OperationGUI_MaterialDlg::ClickOnOk() void OperationGUI_MaterialDlg::ClickOnOk()
{ {
SUIT_Session::session()->activeApplication()->putInfo(tr("")); SUIT_Session::session()->activeApplication()->putInfo( "" );
int nbSh = myListShapes.length(); int nbSh = myListShapes.length();
myListMaterials.length( nbSh ); myListMaterials.length( nbSh );
QListViewItemIterator it (GroupPoints->ListView1); QTreeWidgetItemIterator it( GroupPoints->ListView1 );
for (int i = 0; it.current() != 0; it++, i++) { for ( int i = 0; *it; it++, i++ )
QString aMatIdStr = it.current()->text(myMaterCol); myListMaterials[i] = (*it)->text( 1 ).toInt();
myListMaterials[i] = aMatIdStr.toInt();
MESSAGE("For shape # " << i << " material ID = " << myListMaterials[i]);
}
// set materials list to the parent dialog // set materials list to the parent dialog
OperationGUI_PartitionDlg* aParentDlg = OperationGUI_PartitionDlg* aParentDlg =
dynamic_cast<OperationGUI_PartitionDlg*>(myParentDlg); qobject_cast<OperationGUI_PartitionDlg*>( parentWidget() );
if ( aParentDlg ) if ( aParentDlg )
{
aParentDlg->SetListMaterials( myListMaterials ); aParentDlg->SetListMaterials( myListMaterials );
}
ClickOnCancel(); ClickOnCancel();
return;
} }
@ -199,15 +178,13 @@ void OperationGUI_MaterialDlg::SelectionIntoArgument()
//================================================================================= //=================================================================================
void OperationGUI_MaterialDlg::SetMaterial() void OperationGUI_MaterialDlg::SetMaterial()
{ {
int aMatId = GroupPoints->SpinBox1->value(); QString aMatIdStr = QString::number( GroupPoints->SpinBox1->value() );
QString aMatIdStr; QList<QTreeWidgetItem*> selectedItems = GroupPoints->ListView1->selectedItems();
aMatIdStr.setNum(aMatId);
QListViewItemIterator it (GroupPoints->ListView1); QListIterator<QTreeWidgetItem*> it( selectedItems );
for (; it.current() != 0; it++) { while ( it.hasNext() ) {
if (it.current()->isSelected()) it.next()->setText( 1, aMatIdStr );
it.current()->setText(myMaterCol, aMatIdStr);
} }
return;
} }
@ -228,8 +205,8 @@ void OperationGUI_MaterialDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void OperationGUI_MaterialDlg::enterEvent(QEvent* e) void OperationGUI_MaterialDlg::enterEvent( QEvent* )
{ {
if (!GroupConstructors->isEnabled()) if ( !mainFrame()->GroupConstructors->isEnabled() )
this->ActivateThisDialog(); this->ActivateThisDialog();
} }

View File

@ -18,18 +18,16 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI_MaterialDlg.h // File : OperationGUI_MaterialDlg.h
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH, Open CASCADE S.A.S. (julia.dorovskikh@opencascade.com)
// Module : GEOM //
#ifndef DIALOGBOX_MATERIAL_H #ifndef OPERATIONGUI_MATERIALDLG_H
#define DIALOGBOX_MATERIAL_H #define OPERATIONGUI_MATERIALDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
#include "DlgRef_1List1Spin1Btn_QTD.h"
class DlgRef_1List1Spin1Btn;
//================================================================================= //=================================================================================
// class : OperationGUI_MaterialDlg // class : OperationGUI_MaterialDlg
@ -40,24 +38,19 @@ class OperationGUI_MaterialDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
OperationGUI_MaterialDlg (GeometryGUI* theGeometryGUI, QWidget* parent, OperationGUI_MaterialDlg( GeometryGUI*, QWidget*, GEOM::ListOfGO,
const char* name, GEOM::ListOfGO ListShapes, bool = false );
bool modal = FALSE, WFlags fl = 0);
~OperationGUI_MaterialDlg(); ~OperationGUI_MaterialDlg();
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
QWidget* myParentDlg;
private:
GEOM::ListOfGO myListShapes; GEOM::ListOfGO myListShapes;
GEOM::ListOfLong myListMaterials; GEOM::ListOfLong myListMaterials;
DlgRef_1List1Spin1Btn_QTD* GroupPoints; DlgRef_1List1Spin1Btn* GroupPoints;
int myShapeCol;
int myMaterCol;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -66,4 +59,4 @@ private slots:
void SetMaterial(); void SetMaterial();
}; };
#endif // DIALOGBOX_MATERIAL_H #endif // OPERATIONGUI_MATERIALDLG_H

View File

@ -19,28 +19,24 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI_PartitionDlg.cxx // File : OperationGUI_PartitionDlg.cxx
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
// $Header$
#include "OperationGUI_PartitionDlg.h" #include "OperationGUI_PartitionDlg.h"
#include "OperationGUI_MaterialDlg.h" #include "OperationGUI_MaterialDlg.h"
#include "GEOMImpl_Types.hxx" #include <GEOM_DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include "SUIT_Desktop.h" #include <GEOMImpl_Types.hxx>
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
#include "LightApp_SelectionMgr.h"
#include <qcheckbox.h> #include <SUIT_Desktop.h>
#include <qcombobox.h> #include <SUIT_Session.h>
#include <qlabel.h> #include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include "utilities.h" #include <LightApp_SelectionMgr.h>
//================================================================================= //=================================================================================
// class : OperationGUI_PartitionDlg() // class : OperationGUI_PartitionDlg()
@ -50,34 +46,37 @@
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
:GEOMBase_Skeleton(theGeometryGUI, parent, "OperationGUI_PartitionDlg", false, : GEOMBase_Skeleton( theGeometryGUI, parent, false )
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{ {
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PARTITION" ) ) ); QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PARTITION" ) ) );
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PARTITION_PLANE" ) ) ); QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PARTITION_PLANE" ) ) );
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setCaption(tr("GEOM_PARTITION_TITLE")); setWindowTitle( tr( "GEOM_PARTITION_TITLE" ) );
/***************************************************************/ /***************************************************************/
GroupConstructors->setTitle(tr("GEOM_PARTITION")); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_PARTITION" ) );
RadioButton1->setPixmap(image0); mainFrame()->RadioButton1->setIcon( image0 );
RadioButton2->setPixmap(image1); mainFrame()->RadioButton2->setIcon( image1 );
RadioButton3->close(TRUE); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
// Full partition (contains half-space partition) // Full partition (contains half-space partition)
GroupPoints = new DlgRef_2Sel1List_QTD(this, "GroupPoints"); GroupPoints = new DlgRef_2Sel1List( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) );
GroupPoints->TextLabel3->setText( tr( "GEOM_RECONSTRUCTION_LIMIT" ) ); GroupPoints->TextLabel3->setText( tr( "GEOM_RECONSTRUCTION_LIMIT" ) );
GroupPoints->PushButton1->setPixmap(image2); GroupPoints->PushButton1->setIcon( image2 );
GroupPoints->PushButton2->setPixmap(image2); GroupPoints->PushButton2->setIcon( image2 );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true );
Layout1->addWidget(GroupPoints, 2, 0); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
/***************************************************************/ /***************************************************************/
setHelpFileName( "partition.htm" ); setHelpFileName( "partition.htm" );
@ -95,6 +94,15 @@ OperationGUI_PartitionDlg::~OperationGUI_PartitionDlg()
// no need to delete child widgets, Qt does it all for us // no need to delete child widgets, Qt does it all for us
} }
void OperationGUI_PartitionDlg::SetListMaterials( GEOM::ListOfLong ListMaterials )
{
myListMaterials = ListMaterials;
}
GEOM::ListOfLong OperationGUI_PartitionDlg::GetListMaterials()
{
return myListMaterials;
}
//================================================================================= //=================================================================================
// function : Init() // function : Init()
@ -103,17 +111,18 @@ OperationGUI_PartitionDlg::~OperationGUI_PartitionDlg()
void OperationGUI_PartitionDlg::Init() void OperationGUI_PartitionDlg::Init()
{ {
/* type for sub shape selection */ /* type for sub shape selection */
GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_SOLID")); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_SOLID" ) );
GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_SHELL")); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_SHELL" ) );
GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_FACE")); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_FACE" ) );
GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_WIRE")); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_WIRE" ) );
GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_EDGE")); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_EDGE" ) );
GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_VERTEX")); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -127,6 +136,7 @@ void OperationGUI_PartitionDlg::Init()
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
initName( tr( "GEOM_PARTITION" ) ); initName( tr( "GEOM_PARTITION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -146,39 +156,34 @@ void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId)
myListRemoveInside.length( 0 ); myListRemoveInside.length( 0 );
myListMaterials.length( 0 ); myListMaterials.length( 0 );
switch (constructorId) switch ( constructorId ) {
{
case 0: /*Full partition */ case 0: /*Full partition */
{
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECT" ) );
resize(0, 0);
GroupPoints->TextLabel3->show(); GroupPoints->TextLabel3->show();
GroupPoints->ComboBox1->show(); GroupPoints->ComboBox1->show();
GroupPoints->ComboBox1->setCurrentItem(0); GroupPoints->ComboBox1->setCurrentIndex( 0 );
break; break;
}
case 1: /*Half-space partition */ case 1: /*Half-space partition */
{
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION_HALFSPACE" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION_HALFSPACE" ) );
GroupPoints->TextLabel3->hide(); GroupPoints->TextLabel3->hide();
GroupPoints->ComboBox1->hide(); GroupPoints->ComboBox1->hide();
GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) );
resize(0, 0);
break; break;
} }
}
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->clear(); GroupPoints->LineEdit1->clear();
GroupPoints->LineEdit2->clear(); GroupPoints->LineEdit2->clear();
qApp->processEvents();
updateGeometry();
resize( minimumSize() );
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
MESSAGE(width()<<" "<<height());
} }
@ -219,10 +224,8 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true );
if ( nbSel < 1 ) if ( nbSel < 1 ) {
{ if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
{
myListShapes.length( 0 ); myListShapes.length( 0 );
myListMaterials.length( 0 ); myListMaterials.length( 0 );
} }
@ -232,21 +235,20 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
// One and only one plane can be selected // One and only one plane can be selected
if ( getConstructorId() == 1 && myEditCurrentArgument == GroupPoints->LineEdit2 && nbSel != 1 ) if ( getConstructorId() == 1 &&
{ myEditCurrentArgument == GroupPoints->LineEdit2 &&
nbSel != 1 ) {
myListTools.length( 0 ); myListTools.length( 0 );
return; return;
} }
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
{
GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListShapes, true ); GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListShapes, true );
myListMaterials.length( 0 ); myListMaterials.length( 0 );
if ( !myListShapes.length() ) if ( !myListShapes.length() )
return; return;
} }
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
{
GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListTools, true ); GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListTools, true );
if ( !myListTools.length() ) if ( !myListTools.length() )
return; return;
@ -266,8 +268,7 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument()
if ( send == GroupPoints->PushButton1 ) if ( send == GroupPoints->PushButton1 )
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
else if(send == GroupPoints->PushButton2) else if ( send == GroupPoints->PushButton2 ) {
{
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
if ( getConstructorId() == 1 ) if ( getConstructorId() == 1 )
globalSelection( GEOM_PLANE ); globalSelection( GEOM_PLANE );
@ -289,8 +290,7 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed()
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 || if ( send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2 ) send == GroupPoints->LineEdit2 ) {
{
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
@ -315,9 +315,9 @@ void OperationGUI_PartitionDlg::ActivateThisDialog()
// function : enterEvent() // function : enterEvent()
// purpose : // purpose :
//================================================================================= //=================================================================================
void OperationGUI_PartitionDlg::enterEvent(QEvent* e) void OperationGUI_PartitionDlg::enterEvent( QEvent* )
{ {
if (!GroupConstructors->isEnabled()) if ( !mainFrame()->GroupConstructors->isEnabled() )
this->ActivateThisDialog(); this->ActivateThisDialog();
} }
@ -336,7 +336,7 @@ GEOM::GEOM_IOperations_ptr OperationGUI_PartitionDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool OperationGUI_PartitionDlg::isValid( QString& msg ) bool OperationGUI_PartitionDlg::isValid( QString& )
{ {
return ( myListShapes.length() || myListTools.length() || return ( myListShapes.length() || myListTools.length() ||
myListKeepInside.length() || myListRemoveInside.length() ); myListKeepInside.length() || myListRemoveInside.length() );
@ -361,7 +361,6 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
aLimit = GEOM::SHAPE; aLimit = GEOM::SHAPE;
if ( isValid( msg ) ) { if ( isValid( msg ) ) {
anObj = GEOM::GEOM_IBooleanOperations::_narrow(getOperation())-> anObj = GEOM::GEOM_IBooleanOperations::_narrow(getOperation())->
MakePartition(myListShapes, myListTools, MakePartition(myListShapes, myListTools,
myListKeepInside, myListRemoveInside, myListKeepInside, myListRemoveInside,
@ -392,7 +391,7 @@ void OperationGUI_PartitionDlg::closeEvent( QCloseEvent* e )
//======================================================================= //=======================================================================
void OperationGUI_PartitionDlg::ComboTextChanged() void OperationGUI_PartitionDlg::ComboTextChanged()
{ {
bool IsEnabled = GroupPoints->ComboBox1->currentItem() < 3; //bool IsEnabled = GroupPoints->ComboBox1->currentItem() < 3;
//GroupPoints->LineEdit3->setEnabled(IsEnabled); //GroupPoints->LineEdit3->setEnabled(IsEnabled);
//GroupPoints->LineEdit4->setEnabled(IsEnabled); //GroupPoints->LineEdit4->setEnabled(IsEnabled);
//GroupPoints->TextLabel4->setEnabled(IsEnabled); //GroupPoints->TextLabel4->setEnabled(IsEnabled);
@ -408,10 +407,9 @@ void OperationGUI_PartitionDlg::ComboTextChanged()
//================================================================================= //=================================================================================
int OperationGUI_PartitionDlg::GetLimit() const int OperationGUI_PartitionDlg::GetLimit() const
{ {
int aLimit = GroupPoints->ComboBox1->currentItem(); int aLimit = GroupPoints->ComboBox1->currentIndex();
switch(aLimit) switch ( aLimit ) {
{
case 0: aLimit = GEOM::SOLID ; break; case 0: aLimit = GEOM::SOLID ; break;
case 1: aLimit = GEOM::SHELL ; break; case 1: aLimit = GEOM::SHELL ; break;
case 2: aLimit = GEOM::FACE ; break; case 2: aLimit = GEOM::FACE ; break;

View File

@ -19,17 +19,16 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
//
//
// File : OperationGUI_PartitionDlg.h // File : OperationGUI_PartitionDlg.h
// Author : Lucien PIGNOLONI // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
// Module : GEOM //
#ifndef DIALOGBOX_PARTITION_H #ifndef OPERATIONGUI_PARTITIONDLG_H
#define DIALOGBOX_PARTITION_H #define OPERATIONGUI_PARTITIONDLG_H
#include "GEOMBase_Skeleton.h" #include <GEOMBase_Skeleton.h>
#include "DlgRef_2Sel1List_QTD.h"
class DlgRef_2Sel1List;
//================================================================================= //=================================================================================
// class : OperationGUI_PartitionDlg // class : OperationGUI_PartitionDlg
@ -40,35 +39,33 @@ class OperationGUI_PartitionDlg : public GEOMBase_Skeleton
Q_OBJECT Q_OBJECT
public: public:
OperationGUI_PartitionDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0); OperationGUI_PartitionDlg( GeometryGUI*, QWidget* = 0 );
~OperationGUI_PartitionDlg(); ~OperationGUI_PartitionDlg();
void SetListMaterials(GEOM::ListOfLong ListMaterials) void SetListMaterials( GEOM::ListOfLong );
{ myListMaterials = ListMaterials; } GEOM::ListOfLong GetListMaterials();
GEOM::ListOfLong GetListMaterials()
{ return myListMaterials; }
protected: protected:
// redefined from GEOMBase_Helper // redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& ); virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects ); virtual bool execute( ObjectList& );
virtual void closeEvent( QCloseEvent* e ); virtual void closeEvent( QCloseEvent* );
private: private:
void Init(); void Init();
void enterEvent(QEvent* e); void enterEvent( QEvent* );
int GetLimit() const; int GetLimit() const;
private:
GEOM::ListOfGO myListShapes; GEOM::ListOfGO myListShapes;
GEOM::ListOfLong myListMaterials; GEOM::ListOfLong myListMaterials;
GEOM::ListOfGO myListTools; GEOM::ListOfGO myListTools;
GEOM::ListOfGO myListRemoveInside; GEOM::ListOfGO myListRemoveInside;
GEOM::ListOfGO myListKeepInside; GEOM::ListOfGO myListKeepInside;
DlgRef_2Sel1List_QTD* GroupPoints; DlgRef_2Sel1List* GroupPoints;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -78,7 +75,7 @@ private slots:
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ComboTextChanged(); void ComboTextChanged();
void ConstructorsClicked(int constructorId); void ConstructorsClicked( int );
}; };
#endif // DIALOGBOX_PARTITION_H #endif // OPERATIONGUI_PARTITIONDLG_H

View File

@ -21,7 +21,7 @@
# #
# File : Makefile.am # File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com) # Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : BooleanGUI # Package : TransformationGUI
# #
include $(top_srcdir)/adm_local/unix/make_common_starter.am include $(top_srcdir)/adm_local/unix/make_common_starter.am