From a343be80e584a017aed7fe0241e9192948420f82 Mon Sep 17 00:00:00 2001 From: ouv Date: Thu, 8 Sep 2005 07:49:29 +0000 Subject: [PATCH] Tab of preferences for Gauss Point results added --- src/VISUGUI/VISUM_images.po | 2 + src/VISUGUI/VISUM_msg_en.po | 56 ++++++++- src/VISUGUI/VisuGUI_GaussPointsDlg.cxx | 153 ++++++++++++++++++++++++- src/VISUGUI/VisuGUI_GaussPointsDlg.h | 11 +- 4 files changed, 218 insertions(+), 4 deletions(-) diff --git a/src/VISUGUI/VISUM_images.po b/src/VISUGUI/VISUM_images.po index 1bde3ccc..647fb721 100644 --- a/src/VISUGUI/VISUM_images.po +++ b/src/VISUGUI/VISUM_images.po @@ -39,3 +39,5 @@ msgstr "Visu_vvtk_switch.png" msgid "ICON_VVTK_SELECTION_MODE_SWITCH" msgstr "Visu_points.png" +msgid "ICON_LOAD_TEXTURE" +msgstr "Visu_load_texture.png" diff --git a/src/VISUGUI/VISUM_msg_en.po b/src/VISUGUI/VISUM_msg_en.po index 76e0e9c2..f1d76887 100644 --- a/src/VISUGUI/VISUM_msg_en.po +++ b/src/VISUGUI/VISUM_msg_en.po @@ -114,5 +114,59 @@ msgstr "Selection Mode Switch" msgid "VVTK_ViewWindow::DSC_VVTK_SELECTION_MODE_SWITCH" msgstr "Selection Mode Switch" +msgid "VisuGUI_GaussPointsDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_GaussPointsDlg::&OK" +msgstr "" + +msgid "VisuGUI_GaussPointsDlg::DLG_TITLE" +msgstr "Gauss Points" + +msgid "VisuGUI_GaussPointsDlg::GAUSS_POINTS_TAB" +msgstr "Gauss Points" + +msgid "VisuGUI_GaussPointsDlg::SCALAR_BAR_TAB" +msgstr "Scalar Bar" + +msgid "VisuGUI_GaussPointsDlg::PRIMITIVE_TITLE" +msgstr "Primitive" + +msgid "VisuGUI_GaussPointsDlg::SIZE_TITLE" +msgstr "Size" + +msgid "VisuGUI_GaussPointsDlg::POINT_SPRITE" +msgstr "Point Sprite" + +msgid "VisuGUI_GaussPointsDlg::OPENGL_POINT" +msgstr "OpenGL Point" + +msgid "VisuGUI_GaussPointsDlg::GEOMETRICAL_SPHERE" +msgstr "Geometrical Sphere" + +msgid "VisuGUI_GaussPointsDlg::MAXIMUM_SIZE" +msgstr "Maximum Size (Clamp) : " + +msgid "VisuGUI_GaussPointsDlg::ALPHA_CHANNEL_THRESHOLD" +msgstr "Alpha Channel Threshold : " + +msgid "VisuGUI_GaussPointsDlg::MAIN_TEXTURE" +msgstr "Main Texture (16x16) : " + +msgid "VisuGUI_GaussPointsDlg::ALPHA_CHANNEL_TEXTURE" +msgstr "Alpha Channel Texture (16x16) : " + +msgid "VisuGUI_GaussPointsDlg::MIN_SIZE" +msgstr "Range values for min size (%) : " + +msgid "VisuGUI_GaussPointsDlg::MAX_SIZE" +msgstr "max size (%) : " + +msgid "VisuGUI_GaussPointsDlg::MAGNIFICATION" +msgstr "Magnification (%) : " + +msgid "VisuGUI_GaussPointsDlg::INCREMENT" +msgstr "Increment : " + msgid "VVTK_ViewWindow::LBL_TOOLBAR_LABEL" -msgstr "GAUSS viewer tools" \ No newline at end of file +msgstr "GAUSS viewer tools" diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index e912e220..2729f7ef 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -34,11 +34,16 @@ #include "SalomeApp_Module.h" #include "SUIT_Desktop.h" +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" #include "QtxDblSpinBox.h" #include #include +#include +#include +#include using namespace std; @@ -54,12 +59,141 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool setCaption(SetPref ? tr("DLG_PREF_TITLE") : tr("DLG_PROP_TITLE")); setSizeGripEnabled(TRUE); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + QVBoxLayout* TopLayout = new QVBoxLayout(this); TopLayout->setSpacing(6); TopLayout->setMargin(11); + + QTabWidget* aTabBox = new QTabWidget (this); + + // Gauss points pane + QVBox* aBox = new QVBox (this); + aBox->setMargin(11); + aBox->setSpacing(6); + + // Primitive + QGroupBox* TopGroup = new QGroupBox ( tr( "PRIMITIVE_TITLE" ), aBox, "TopGroup" ); + TopGroup->setColumnLayout(0, Qt::Vertical ); + TopGroup->layout()->setSpacing( 0 ); + TopGroup->layout()->setMargin( 0 ); + + QGridLayout* TopGroupLayout = new QGridLayout (TopGroup->layout()); + TopGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + TopGroupLayout->setSpacing(6); + TopGroupLayout->setMargin(11); + + // Primitive Type + QButtonGroup* aPrimitiveTypeGroup = new QButtonGroup( 3, Qt::Horizontal, TopGroup, "PrimitiveTypeGroup" ); + aPrimitiveTypeGroup->setRadioButtonExclusive( true ); + aPrimitiveTypeGroup->setFrameStyle( QFrame::NoFrame ); + + QRadioButton* aPointSpriteButton = new QRadioButton( tr( "POINT_SPRITE" ), aPrimitiveTypeGroup ); + aPointSpriteButton->setChecked( true ); + + QRadioButton* anOpenGLPointButton = new QRadioButton( tr( "OPENGL_POINT" ), aPrimitiveTypeGroup ); + QRadioButton* aGeometricalSphereButton = new QRadioButton( tr( "GEOMETRICAL_SPHERE" ), aPrimitiveTypeGroup ); + + TopGroupLayout->addMultiCellWidget( aPrimitiveTypeGroup, 0, 0, 0, 2 ); + + // Maximum Size + QLabel* aMaximumSizeLabel = new QLabel( tr( "MAXIMUM_SIZE" ), TopGroup ); + QtxDblSpinBox* aMaximumSizeSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, TopGroup ); + aMaximumSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + aMaximumSizeSpinBox->setValue( 256.0 ); + + TopGroupLayout->addWidget( aMaximumSizeLabel, 1, 0 ); + TopGroupLayout->addMultiCellWidget( aMaximumSizeSpinBox, 1, 1, 1, 2 ); + + // Main Texture + QLabel* aMainTextureLabel = new QLabel( tr( "MAIN_TEXTURE" ), TopGroup ); + myMainTextureLineEdit = new QLineEdit( TopGroup ); + QPushButton* aMainTextureButton = new QPushButton( TopGroup ); + aMainTextureButton->setAutoDefault( false ); + aMainTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) ); + connect( aMainTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseMainTexture() ) ); + + TopGroupLayout->addWidget( aMainTextureLabel, 2, 0 ); + TopGroupLayout->addWidget( myMainTextureLineEdit, 2, 1 ); + TopGroupLayout->addWidget( aMainTextureButton, 2, 2 ); + + // Alpha Channel Texture + QLabel* aAlphaChannelTextureLabel = new QLabel( tr( "ALPHA_CHANNEL_TEXTURE" ), TopGroup ); + myAlphaChannelTextureLineEdit = new QLineEdit( TopGroup ); + QPushButton* aAlphaChannelTextureButton = new QPushButton( TopGroup ); + aAlphaChannelTextureButton->setAutoDefault( false ); + aAlphaChannelTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) ); + connect( aAlphaChannelTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseAlphaChannelTexture() ) ); + + TopGroupLayout->addWidget( aAlphaChannelTextureLabel, 3, 0 ); + TopGroupLayout->addWidget( myAlphaChannelTextureLineEdit, 3, 1 ); + TopGroupLayout->addWidget( aAlphaChannelTextureButton, 3, 2 ); + + // Alpha Channel Threshold + QLabel* aAlphaChannelThresholdLabel = new QLabel( tr( "ALPHA_CHANNEL_THRESHOLD" ), TopGroup ); + QtxDblSpinBox* aAlphaChannelThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, TopGroup ); + aAlphaChannelThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + aAlphaChannelThresholdSpinBox->setValue( 0.1 ); + + TopGroupLayout->addWidget( aAlphaChannelThresholdLabel, 4, 0 ); + TopGroupLayout->addMultiCellWidget( aAlphaChannelThresholdSpinBox, 4, 4, 1, 2 ); + + + // Size + QGroupBox* BottomGroup = new QGroupBox ( tr( "SIZE_TITLE" ), aBox, "BottomGroup" ); + BottomGroup->setColumnLayout(0, Qt::Vertical ); + BottomGroup->layout()->setSpacing( 0 ); + BottomGroup->layout()->setMargin( 0 ); + + QGridLayout* BottomGroupLayout = new QGridLayout (BottomGroup->layout()); + BottomGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + BottomGroupLayout->setSpacing(6); + BottomGroupLayout->setMargin(11); + + // Min Size + QLabel* aMinSizeLabel = new QLabel( tr( "MIN_SIZE" ), BottomGroup ); + QtxDblSpinBox* aMinSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, BottomGroup ); + aMinSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + aMinSizeSpinBox->setValue( 10 ); + + BottomGroupLayout->addWidget( aMinSizeLabel, 0, 0 ); + BottomGroupLayout->addWidget( aMinSizeSpinBox, 0, 1 ); + + // Max Size + QLabel* aMaxSizeLabel = new QLabel( tr( "MAX_SIZE" ), BottomGroup ); + QtxDblSpinBox* aMaxSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, BottomGroup ); + aMaxSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + aMaxSizeSpinBox->setValue( 33 ); + + BottomGroupLayout->addWidget( aMaxSizeLabel, 0, 2 ); + BottomGroupLayout->addWidget( aMaxSizeSpinBox, 0, 3 ); + + // Magnification + QLabel* aMagnificationLabel = new QLabel( tr( "MAGNIFICATION" ), BottomGroup ); + QtxDblSpinBox* aMagnificationSpinBox = new QtxDblSpinBox( 50, 200, 10, BottomGroup ); + aMagnificationSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + aMagnificationSpinBox->setValue( 100 ); + + BottomGroupLayout->addWidget( aMagnificationLabel, 1, 0 ); + BottomGroupLayout->addWidget( aMagnificationSpinBox, 1, 1 ); + + // Increment + QLabel* aIncrementLabel = new QLabel( tr( "INCREMENT" ), BottomGroup ); + QtxDblSpinBox* aIncrementSpinBox = new QtxDblSpinBox( 5, 50, 5, BottomGroup ); + aIncrementSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + aIncrementSpinBox->setValue( 10 ); + + BottomGroupLayout->addWidget( aIncrementLabel, 1, 2 ); + BottomGroupLayout->addWidget( aIncrementSpinBox, 1, 3 ); + + myScalarPane = new VisuGUI_ScalarBarPane(this, SetPref); - TopLayout->addWidget(myScalarPane); + myScalarPane->setMargin(5); + + + aTabBox->addTab(aBox, tr("GAUSS_POINTS_TAB")); + aTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB")); // Common buttons =========================================================== QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); @@ -81,6 +215,7 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool buttonCancel->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); + TopLayout->addWidget(aTabBox); TopLayout->addWidget( GroupButtons ); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); @@ -100,3 +235,19 @@ int VisuGUI_GaussPointsDlg::storeToPrsObject(VISU::GaussPoints_i* thePrs) void VisuGUI_GaussPointsDlg::accept() { if (myScalarPane->check()) QDialog::accept(); } + +void VisuGUI_GaussPointsDlg::onBrowseMainTexture() +{ + QString aFileName = QFileDialog::getOpenFileName( QString::null, "Bitmap (*.jpg *.gif *.png)", this ); + + if( !aFileName.isNull() ) + myMainTextureLineEdit->setText( aFileName ); +} + +void VisuGUI_GaussPointsDlg::onBrowseAlphaChannelTexture() +{ + QString aFileName = QFileDialog::getOpenFileName( QString::null, "Bitmap (*.jpg *.gif *.png)", this ); + + if( !aFileName.isNull() ) + myAlphaChannelTextureLineEdit->setText( aFileName ); +} diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h index 782e1b74..d044d028 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.h +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.h @@ -37,6 +37,7 @@ #include #include #include +#include class SalomeApp_Module; @@ -59,8 +60,14 @@ public: protected slots: void accept(); - private: - VisuGUI_ScalarBarPane* myScalarPane; + void onBrowseMainTexture(); + void onBrowseAlphaChannelTexture(); + +private: + VisuGUI_ScalarBarPane* myScalarPane; + + QLineEdit* myMainTextureLineEdit; + QLineEdit* myAlphaChannelTextureLineEdit; }; #endif // VISUGUI_GAUSSPOINTSDLS_H -- 2.39.2