From 4e4927c285492915cb84347f8ba28ff9b78e8c5d Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 22 Mar 2021 17:12:09 +0300 Subject: [PATCH] #24009 EDF 22760 - integration of dev in SMESH: minor problems Homogenize file name --- src/SMESHGUI/CMakeLists.txt | 4 +- src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.h | 2 +- ...G_ADAPTGUI.cxx => SMESHGUI_MgAdaptDlg.cxx} | 4 +- src/SMESHGUI/SMESHGUI_MgAdaptDlg.h | 284 ++++++++++++++++++ 4 files changed, 288 insertions(+), 6 deletions(-) rename src/SMESHGUI/{MG_ADAPTGUI.cxx => SMESHGUI_MgAdaptDlg.cxx} (99%) create mode 100644 src/SMESHGUI/SMESHGUI_MgAdaptDlg.h diff --git a/src/SMESHGUI/CMakeLists.txt b/src/SMESHGUI/CMakeLists.txt index f7746071b..3030b9c86 100644 --- a/src/SMESHGUI/CMakeLists.txt +++ b/src/SMESHGUI/CMakeLists.txt @@ -148,7 +148,7 @@ SET(_moc_HEADERS SMESHGUI_IdPreview.h SMESHGUI_PreVisualObj.h SMESHGUI_MG_ADAPTDRIVER.h - MG_ADAPTGUI.h + SMESHGUI_MgAdaptDlg.h ) # header files / no moc processing @@ -265,7 +265,7 @@ SET(_other_SOURCES SMESHGUI_PreVisualObj.cxx SMESHGUI_IdPreview.cxx SMESHGUI_MG_ADAPTDRIVER.cxx - MG_ADAPTGUI.cxx + SMESHGUI_MgAdaptDlg.cxx ) # sources / to compile diff --git a/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.h b/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.h index eb653df01..582865cc9 100644 --- a/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.h +++ b/src/SMESHGUI/SMESHGUI_MG_ADAPTDRIVER.h @@ -26,7 +26,7 @@ #include "SMESH_SMESHGUI.hxx" // model -#include "MG_ADAPTGUI.h" +#include "SMESHGUI_MgAdaptDlg.h" // IDL includes #include diff --git a/src/SMESHGUI/MG_ADAPTGUI.cxx b/src/SMESHGUI/SMESHGUI_MgAdaptDlg.cxx similarity index 99% rename from src/SMESHGUI/MG_ADAPTGUI.cxx rename to src/SMESHGUI/SMESHGUI_MgAdaptDlg.cxx index 599639b98..7a76ea883 100644 --- a/src/SMESHGUI/MG_ADAPTGUI.cxx +++ b/src/SMESHGUI/SMESHGUI_MgAdaptDlg.cxx @@ -21,7 +21,7 @@ // // file : MG_ADAPTGUI.cxx -#include "MG_ADAPTGUI.h" +#include "SMESHGUI_MgAdaptDlg.h" #include "MED_Factory.hxx" @@ -56,8 +56,6 @@ #include #include -//#include - const int SPACING = 6; // layout spacing const int MARGIN = 9; // layout margin diff --git a/src/SMESHGUI/SMESHGUI_MgAdaptDlg.h b/src/SMESHGUI/SMESHGUI_MgAdaptDlg.h new file mode 100644 index 000000000..89902e670 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_MgAdaptDlg.h @@ -0,0 +1,284 @@ +// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// SMESH SMESHGUI : GUI for the adaptation in the SMESH component +// File : MG_ADAPTGUI.hxx +// +#ifndef MG_ADAPTGUI_HXX +#define MG_ADAPTGUI_HXX + +// Qt includes +#include +#include +#include + +#include + +#include +#include CORBA_SERVER_HEADER(MG_ADAPT) +#include + +class SalomeApp_Module; + +class QButtonGroup; +class QLineEdit; +class QGroupBox; +class QRadioButton; +class QLabel; +class QCheckBox; +class QGridLayout; +class QTabWidget; +class QDoubleSpinBox; +class QSpacerItem; +class QSpinBox; +class QTreeWidgetItem; +class QHBoxLayout; +class QComboBox; + +class SMESHGUI_MgAdaptArguments; +class MgAdaptAdvWidgetTreeWidget; +class MgAdaptAdvWidget; + +enum ADAPTATION_MODE{ + SURFACE, + VOLUME, + BOTH +}; + +//================================================================================= +// class : SMESHGUI_MgAdaptDlg +// purpose : +//================================================================================= +class SMESHGUI_MgAdaptDlg : public QDialog +{ + Q_OBJECT +public: + //! Property type + enum Mode { Arguments, AdvancedOptions}; + SMESHGUI_MgAdaptDlg( SalomeApp_Module*, SMESH::MG_ADAPT_ptr, QWidget* parent= 0,bool isCreation = true ); + ~SMESHGUI_MgAdaptDlg(); + + void buildDlg(); + void reject(); + bool checkParams(QString& msg) ; + //~void setModel(MgAdapt*); + SMESH::MG_ADAPT_ptr getModel() const; + +public slots: + +protected slots: + virtual bool PushOnApply(); + +private slots: + virtual void PushOnHelp(); + virtual void PushOnOK(); + +protected : + + SMESHGUI_MgAdaptArguments* myArgs; + MgAdaptAdvWidget* myAdvOpt; + + bool readParamsFromHypo( ) const ; + bool readParamsFromWidgets( ) ; + bool storeParamsToHypo( const SMESH::MgAdaptHypothesisData & ) const; + +private: + + SalomeApp_Module* mySMESHGUI; + QTabWidget* myTabWidget; + + SMESH::MgAdaptHypothesisData_var myData; + SALOME::GenericObj_wrap< SMESH::MG_ADAPT > model; + +}; + +class SMESHGUI_MgAdaptArguments : public QWidget +{ + Q_OBJECT +public: + //! Property type + enum Mode { Mesh, Browser}; + enum SIZEMAP { Local, Background, Constant}; + SMESHGUI_MgAdaptArguments( QWidget* parent); + ~SMESHGUI_MgAdaptArguments(); + void setMode( const Mode, const SIZEMAP ); + + QString myFileInDir; + QString myFileOutDir; + QString myFileSizeMapDir; + QGroupBox* aMeshIn ; + QRadioButton* aMedfile; + QRadioButton* aBrowser ; + QLineEdit* aBrowserObject; + QPushButton* selectMedFilebutton ; + QSpacerItem* hspacer; + QLineEdit* selectMedFileLineEdit ; + QButtonGroup* meshInGroup ; + QGridLayout* meshIn ; + + QGroupBox* aMeshOut ; + QLabel* meshName; + QLineEdit* meshNameLineEdit; + QSpacerItem* secondHspacer; + QCheckBox* medFileCheckBox; + QPushButton* selectOutMedFilebutton; + QLineEdit* selectOutMedFileLineEdit; + QSpacerItem* thirdHspacer; + QCheckBox* publishOut; + QGridLayout* meshOut ; + + QGroupBox* sizeMapDefinition ; + QRadioButton* localButton; + QRadioButton* backgroundButton ; + QRadioButton* constantButton ; + QLabel* medFileBackground; + QPushButton* selectMedFileBackgroundbutton; + QLineEdit* selectMedFileBackgroundLineEdit; + QLabel* valueLabel; + QDoubleSpinBox* dvalue; + QButtonGroup* sizeMapDefGroup ; + QGridLayout* sizeMapDefGroupLayout; + + + QGroupBox* sizeMapField; + QLabel* fieldName; + QComboBox* fieldNameCmb; + QRadioButton* noTimeStep; + QRadioButton* lastTimeStep ; + QRadioButton* chosenTimeStep; + QLabel* timeStepLabel; + QSpinBox* timeStep; + QLabel* rankLabel; + QSpinBox* rankSpinBox; + QButtonGroup* timeStepGroup; + QGridLayout* sizeMapFieldGroupLayout; + +signals: + void updateSelection(); + void toExportMED(const char *); + void meshDimSignal(ADAPTATION_MODE aMode); +public slots: + +protected slots: + +private slots: + void modeChanged( int); + void sizeMapDefChanged(int); + void timeStepGroupChanged(int timeStepType, bool disableOther = false, int vmax = 0); + void onSelectMedFilebuttonClicked(); + void clear(); + void onMedFileCheckBox(int); + void onPublishOut(int); + void onSelectOutMedFilebutton(); + void onSelectMedFileBackgroundbutton(); + void onLocalSelected(QString); + void onNoTimeStep(bool disableOther = false); + void onLastTimeStep(bool disableOther = false); + void onChosenTimeStep(bool disableOther = false, int vmax = 0); + void visibleTimeStepRankLabel(bool visible); + void valueAdaptation (); + +private: + + QString getMedFileName(bool avertir); + int meshDim; + int meshDimBG; + std::map myFieldList; + +}; +enum { + OPTION_ID_COLUMN = 0, + OPTION_TYPE_COLUMN, + OPTION_NAME_COLUMN = 0, + OPTION_VALUE_COLUMN, + NB_COLUMNS, +}; + +////////////////////////////////////////// +// MgAdaptAdvWidget +////////////////////////////////////////// +class MgAdaptAdvWidget : public QWidget +{ + Q_OBJECT + +public: + MgAdaptAdvWidget( QWidget* = 0, std::vector * = nullptr, Qt::WindowFlags = 0 ); + ~MgAdaptAdvWidget(); + std::vector < std::string > *myOptions; + QGridLayout *gridLayout_4; + MgAdaptAdvWidgetTreeWidget *myOptionTable; + QPushButton *addBtn; + QSpacerItem *horizontalSpacer; + QGroupBox *logGroupBox; + QGridLayout *gridLayout_2; + QGridLayout *gridLayout; + QLabel *workingDirectoryLabel; + QLineEdit *workingDirectoryLineEdit; + QPushButton *workingDirectoryPushButton; + QLabel *verboseLevelLabel; + QSpinBox *verboseLevelSpin; + QHBoxLayout *horizontalLayout; + QCheckBox *logInFileCheck; + QCheckBox *removeLogOnSuccessCheck; + QCheckBox *keepWorkingFilesCheck; + + void AddOption( const char* name_value_type, bool isCustom = false ); + void GetOptionAndValue( QTreeWidgetItem * tblRow, QString& option, QString& value, bool& dflt ); + void setupWidget(); + +public slots: + void onAddOption(); + void itemChanged(QTreeWidgetItem * tblRow, int column); + void onMeshDimChanged(ADAPTATION_MODE aMode); +private slots: + void _onWorkingDirectoryPushButton(); +private: + void setOptionValue(QString& option, QString& value); + std::map optionTreeWidgetItem; + + QTreeWidgetItem* getNewQTreeWidgetItem(QTreeWidget* table, const char* option, QString& name, bool isCustom); + +}; + +enum { EDITABLE_ROLE = Qt::UserRole + 1, PARAM_NAME, + NAME_COL = 0, VALUE_COL + }; + +class ItemDelegate: public QItemDelegate +{ +public: + + ItemDelegate(QObject* parent=0): QItemDelegate(parent) {} + QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &o, const QModelIndex &index) const; +}; + +class MgAdaptAdvWidgetTreeWidget : public QTreeWidget +{ + Q_OBJECT +public: + MgAdaptAdvWidgetTreeWidget( QWidget* ); + +protected: + QModelIndex moveCursor( CursorAction, Qt::KeyboardModifiers ); + void keyPressEvent( QKeyEvent* ); +}; + +#endif // MG_ADAPTGUI_HXX -- 2.39.2