From 0f15897432f8b638af08186c41d54e9b3d8cd968 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 29 Aug 2008 08:52:02 +0000 Subject: [PATCH] *** empty log message *** --- src/VISUGUI/Makefile.am | 6 +- src/VISUGUI/VISU_msg_en.ts | 23 +++++ src/VISUGUI/VisuGUI.cxx | 15 +++ src/VISUGUI/VisuGUI.h | 2 + src/VISUGUI/VisuGUI_ActionsDef.h | 2 +- src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx | 122 +++++++++++++++++++++++ src/VISUGUI/VisuGUI_FilterScalarsDlg.h | 63 ++++++++++++ 7 files changed, 230 insertions(+), 3 deletions(-) create mode 100644 src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx create mode 100644 src/VISUGUI/VisuGUI_FilterScalarsDlg.h diff --git a/src/VISUGUI/Makefile.am b/src/VISUGUI/Makefile.am index 9c20dd4d..0954550d 100644 --- a/src/VISUGUI/Makefile.am +++ b/src/VISUGUI/Makefile.am @@ -80,7 +80,8 @@ dist_libVISU_la_SOURCES= \ VisuGUI_InputPane.cxx \ VisuGUI_FieldFilter.cxx \ VisuGUI_ClippingPanel.cxx \ - VisuGUI_ClippingPlaneDlg.cxx + VisuGUI_ClippingPlaneDlg.cxx \ + VisuGUI_FilterScalarsDlg.cxx MOC_FILES= \ VisuGUI_moc.cxx \ @@ -119,7 +120,8 @@ MOC_FILES= \ VisuGUI_Sweep_moc.cxx \ VisuGUI_InputPane_moc.cxx \ VisuGUI_ClippingPanel_moc.cxx \ - VisuGUI_ClippingPlaneDlg_moc.cxx + VisuGUI_ClippingPlaneDlg_moc.cxx \ + VisuGUI_FilterScalarsDlg_moc.cxx nodist_libVISU_la_SOURCES=$(MOC_FILES) diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index a3afb3ec..e43466e1 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -1230,6 +1230,10 @@ Please, refer to the documentation. MEN_WIREFRAME Wireframe + + MEN_FILTER_SCALARS + Filter by scalars... + TOOL_IMPORTImport TOOL_REPRESENTATIONRepresentation TOOL_SELECTIONSelection @@ -3658,4 +3662,23 @@ Please, refer to the documentation. Rotation around %1 + + VisuGUI_FilterScalarsDlg + + TITLE + Filtering by scalars + + + BOXTITLE + Filter by scalar range + + + MINLBL + Min: + + + MAXLBL + Max: + + diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 51317a59..c6ec2d9d 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -114,6 +114,7 @@ #include "VisuGUI_BuildProgressDlg.h" #include "VisuGUI_TransparencyDlg.h" #include "VisuGUI_ClippingPanel.h" +#include "VisuGUI_FilterScalarsDlg.h" #include "VISU_ScalarMap_i.hh" #include "VisuGUI_ScalarBarDlg.h" @@ -2404,6 +2405,10 @@ VisuGUI createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap), tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false, this, SLOT(OnMultiprViewHide())); + + createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(), + tr("MEN_FILTER_SCALARS"), "", 0, aParent, false, + this, SLOT(OnFilterScalars())); } void @@ -2519,6 +2524,8 @@ VisuGUI mgr->insert( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ), -1, -1, -1 ); mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 ); + mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 ); + // rename mgr->insert( action( VISU_RENAME ), -1, -1, -1 ); @@ -2647,6 +2654,9 @@ VisuGUI mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule ); mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule ); + aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}"; + mgr->setRule( action( VISU_FILTERSCALARS ), aRule ); + // view parameters aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'"; mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule ); @@ -3799,3 +3809,8 @@ void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution) QApplication::restoreOverrideCursor(); } +void VisuGUI::OnFilterScalars() +{ + VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg(this); + aDlg->show(); +} diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index df9aec95..8aa5c5d5 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -183,6 +183,8 @@ protected slots: void OnManageCache(); + void OnFilterScalars(); + // MULTIPR void OnMultiprViewFullRes(); void OnMultiprViewMediumRes(); diff --git a/src/VISUGUI/VisuGUI_ActionsDef.h b/src/VISUGUI/VisuGUI_ActionsDef.h index 8c310db8..d7d22f85 100644 --- a/src/VISUGUI/VisuGUI_ActionsDef.h +++ b/src/VISUGUI/VisuGUI_ActionsDef.h @@ -135,6 +135,6 @@ #define VISU_SLIDER_PANEL 4200 #define VISU_SWEEP_PANEL 4300 -#define VISU_GLOBALCLIPPING 4301 +#define VISU_FILTERSCALARS 4301 #endif diff --git a/src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx b/src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx new file mode 100644 index 00000000..8482b7b3 --- /dev/null +++ b/src/VISUGUI/VisuGUI_FilterScalarsDlg.cxx @@ -0,0 +1,122 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "VisuGUI_FilterScalarsDlg.h" + +#include "VisuGUI.h" +#include "VisuGUI_Tools.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + +VisuGUI_FilterScalarsDlg::VisuGUI_FilterScalarsDlg(VisuGUI* theModule) + : QDialog(VISU::GetDesktop(theModule), Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), + myVisuGUI(theModule) +{ + setModal( false ); + setWindowTitle(tr("TITLE")); + setSizeGripEnabled(true); + setAttribute( Qt::WA_DeleteOnClose, true ); + + QVBoxLayout* aMainLayout = new QVBoxLayout(this); + + QGroupBox* aRangeBox = new QGroupBox(this); + aRangeBox->setTitle(tr("BOXTITLE")); + aRangeBox->setCheckable(true); + aMainLayout->addWidget(aRangeBox); + + QHBoxLayout* aBoxLayout = new QHBoxLayout(aRangeBox); + aBoxLayout->addWidget(new QLabel(tr("MINLBL"), aRangeBox)); + myMinEdit = new QLineEdit( aRangeBox ); + myMinEdit->setValidator( new QDoubleValidator(myMinEdit) ); + aBoxLayout->addWidget(myMinEdit); + + aBoxLayout->addWidget(new QLabel(tr("MAXLBL"), aRangeBox)); + myMaxEdit = new QLineEdit( aRangeBox ); + myMaxEdit->setValidator( new QDoubleValidator(myMaxEdit) ); + aBoxLayout->addWidget(myMaxEdit); + + QGroupBox* aGroupButtons = new QGroupBox(this); + QHBoxLayout* aButtonsLayout = new QHBoxLayout(aGroupButtons); + + QPushButton* aBtnOk = new QPushButton(tr("BUT_OK"), aGroupButtons); + aBtnOk->setAutoDefault(true); + aBtnOk->setDefault(true); + aButtonsLayout->addWidget(aBtnOk); + + QPushButton* aBtnCancel = new QPushButton(tr("BUT_CANCEL"), aGroupButtons); + aBtnCancel->setAutoDefault(true); + aButtonsLayout->addWidget(aBtnCancel); + + aButtonsLayout->addStretch(); + + QPushButton* aBtnHelp = new QPushButton(tr("BUT_HELP"), aGroupButtons); + aBtnHelp->setAutoDefault(true); + aButtonsLayout->addWidget(aBtnHelp); + + aMainLayout->addWidget(aGroupButtons); + + connect(aBtnOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(aBtnCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(aBtnHelp, SIGNAL(clicked()), this, SLOT(onHelp())); +} + + +void VisuGUI_FilterScalarsDlg::accept() +{ + QDialog::accept(); +} + +void VisuGUI_FilterScalarsDlg::reject() +{ + QDialog::reject(); +} + +void VisuGUI_FilterScalarsDlg::onHelp() +{ + QString aHelpFileName = "filterbyscalars_page.html"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(myVisuGUI ? app->moduleName(myVisuGUI->moduleName()) : QString(""), aHelpFileName); + else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + SUIT_MessageBox::warning(0, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), + tr("BUT_OK")); + } +} diff --git a/src/VISUGUI/VisuGUI_FilterScalarsDlg.h b/src/VISUGUI/VisuGUI_FilterScalarsDlg.h new file mode 100644 index 00000000..fa9e2e04 --- /dev/null +++ b/src/VISUGUI/VisuGUI_FilterScalarsDlg.h @@ -0,0 +1,63 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VisuGUI_FilterScalarsDlg.h +// Author : vsv +// Module : VISU + + +#ifndef VISUGUI_FILTERSCALARSDLG_H +#define VISUGUI_FILTERSCALARSDLG_H + +#include + +class QLineEdit; +class VisuGUI; + + +class VisuGUI_FilterScalarsDlg: public QDialog +{ + Q_OBJECT; + + public: + VisuGUI_FilterScalarsDlg(VisuGUI* theModule); + ~VisuGUI_FilterScalarsDlg() {}; + +protected slots: + + virtual void accept(); + virtual void reject(); + +private slots: + + void onHelp(); + +private: + VisuGUI* myVisuGUI; + + QLineEdit* myMinEdit; + QLineEdit* myMaxEdit; +}; + + +#endif -- 2.39.2