]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
23307: [EDF 7315] Improvement of DISTENE meshing plugins
authoreap <eap@opencascade.com>
Tue, 9 Aug 2016 16:32:57 +0000 (19:32 +0300)
committereap <eap@opencascade.com>
Tue, 9 Aug 2016 16:32:57 +0000 (19:32 +0300)
CMakeLists.txt
SalomeSMESHConfig.cmake.in
src/PluginUtils/CMakeLists.txt
src/PluginUtils/GeomSelectionTools.h
src/PluginUtils/SMESH_AdvOptionsWdg.cxx [new file with mode: 0644]
src/PluginUtils/SMESH_AdvOptionsWdg.h [new file with mode: 0644]
src/PluginUtils/SMESH_PluginUtils.h [new file with mode: 0644]
src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx
src/SMESHGUI/SMESHGUI_ExtrusionDlg.h
src/SMESHGUI/SMESH_msg_en.ts

index cd8078e3d83a59706492a0d8dce8dc4ec6ac0db2..ebd1da1e4fc03c4b8149d6a357649285dd6f3c80 100755 (executable)
@@ -300,7 +300,7 @@ ENDIF(SALOME_SMESH_ENABLE_MEFISTO)
 
 IF(SALOME_BUILD_GUI)
   LIST(APPEND _${PROJECT_NAME}_exposed_targets
-      SMESHObject SMESHFiltersSelection SMESH GeomSelectionTools StdMeshersGUI
+      SMESHObject SMESHFiltersSelection SMESH PluginUtils StdMeshersGUI
   )
 ENDIF(SALOME_BUILD_GUI)
 
index 5b42334258a4eda7e8416740b812ce918933cf03..6fe86346c53f50c6ce095014790dfdd9fe25e44d 100644 (file)
@@ -145,7 +145,7 @@ IF(SALOME_SMESH_ENABLE_MEFISTO)
   SET(SMESH_MEFISTO2D MEFISTO2D)
 ENDIF(SALOME_SMESH_ENABLE_MEFISTO)
 SET(SMESH_SMESHObject SMESHObject)
-SET(SMESH_GeomSelectionTools GeomSelectionTools)
+SET(SMESH_PluginUtils PluginUtils)
 SET(SMESH_SMDS SMDS)
 SET(SMESH_SMESHimpl SMESHimpl)
 SET(SMESH_SMESHEngine SMESHEngine)
index 2c2613c90f229dd48eb2aa72f8454983e639d206..b72bb89aea9894656afa64e55098914a5cae45de 100644 (file)
@@ -35,6 +35,7 @@ INCLUDE_DIRECTORIES(
 
 # additional preprocessor / compiler flags
 ADD_DEFINITIONS(
+  ${QT_DEFINITIONS}
   ${CAS_DEFINITIONS}
   ${BOOST_DEFINITIONS}
   ${OMNIORB_DEFINITIONS}
@@ -47,6 +48,8 @@ SET(_link_LIBRARIES
   ${KERNEL_SalomeLifeCycleCORBA}
   ${CAS_TKBRep}
   ${CAS_TKV3d}
+  ${QT_LIBRARIES}
+  ${QT_MT_LIBS}
   ${GUI_SalomeObject}
   ${GUI_suit}
   ${GUI_LightApp}
@@ -58,21 +61,28 @@ SET(_link_LIBRARIES
 # --- headers ---
 
 # header files / to be processed by moc
-SET(GeomSelectionTools_HEADERS
+SET(PluginUtils_HEADERS
   GeomSelectionTools.h
+  SMESH_PluginUtils.h
+  SMESH_AdvOptionsWdg.h
 )
 
 # --- sources ---
 
+# sources / moc wrappings
+QT_WRAP_MOC(_moc_SOURCES SMESH_AdvOptionsWdg.h)
+
 # sources / static
-SET(GeomSelectionTools_SOURCES
+SET(PluginUtils_SOURCES
   GeomSelectionTools.cxx
+  SMESH_AdvOptionsWdg.cxx
+  ${_moc_SOURCES}
 )
 
 # --- rules ---
 
-ADD_LIBRARY(GeomSelectionTools ${GeomSelectionTools_SOURCES})
-TARGET_LINK_LIBRARIES(GeomSelectionTools ${_link_LIBRARIES} )
-INSTALL(TARGETS GeomSelectionTools EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+ADD_LIBRARY(PluginUtils ${PluginUtils_SOURCES})
+TARGET_LINK_LIBRARIES(PluginUtils ${_link_LIBRARIES} )
+INSTALL(TARGETS PluginUtils EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
-INSTALL(FILES ${GeomSelectionTools_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
+INSTALL(FILES ${PluginUtils_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
index 55337150cad856ecc0264dbc60904b6a0f141ff9..c4013ff99ea1be648e251a9a78ea043a81f92f09 100644 (file)
 #ifndef _GEOMSELECTIONTOOLS_H_
 #define _GEOMSELECTIONTOOLS_H_
 
-#ifdef WIN32
-#  ifdef GeomSelectionTools_EXPORTS
-#    define GEOMSELECTIONTOOLS_EXPORT __declspec( dllexport )
-#  else
-#    define GEOMSELECTIONTOOLS_EXPORT __declspec( dllimport )
-#  endif
-#else
-#  define GEOMSELECTIONTOOLS_EXPORT
-#endif
-
-#include "SALOMEDSClient.hxx"
-#include "SALOME_InteractiveObject.hxx"
+#include "SMESH_PluginUtils.h"
+
+#include <SALOMEDSClient.hxx>
+#include <SALOME_InteractiveObject.hxx>
 #include <SALOME_ListIO.hxx>
 #include <SalomeApp_Application.h>
 
@@ -54,7 +46,7 @@ class LightApp_SelectionMgr;
  *
  */
 
-class GEOMSELECTIONTOOLS_EXPORT GeomSelectionTools
+class PLUGINUTILS_EXPORT GeomSelectionTools
 {
 
 private:
@@ -84,7 +76,7 @@ public:
 
 namespace PluginUtils
 {
-  GEOMSELECTIONTOOLS_EXPORT QString PrintDoubleValue( double, int = 16 );
+  PLUGINUTILS_EXPORT QString PrintDoubleValue( double, int = 16 );
 };
 
 #endif // _GEOMSELECTIONTOOLS_H_
diff --git a/src/PluginUtils/SMESH_AdvOptionsWdg.cxx b/src/PluginUtils/SMESH_AdvOptionsWdg.cxx
new file mode 100644 (file)
index 0000000..5ae7c92
--- /dev/null
@@ -0,0 +1,155 @@
+// Copyright (C) 2007-2016  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
+//
+
+// File   : SMESH_AdvOptionsWdg.h
+// Author : Open CASCADE S.A.S.
+
+#include "SMESH_AdvOptionsWdg.h"
+
+#include <QTableWidget>
+#include <QPushButton>
+#include <QGridLayout>
+#include <QCheckBox>
+#include <QHeaderView>
+
+#define SPACING 6
+#define MARGIN  11
+
+namespace
+{
+  const int IS_CUSTOM = Qt::UserRole;
+}
+
+SMESH_AdvOptionsWdg::SMESH_AdvOptionsWdg( QWidget* parent )
+  : QWidget( parent )
+{
+  myTable = new QTableWidget( /*nbrows=*/0, /*nbcol=*/3, this );
+  QPushButton* addBtn = new QPushButton( tr("ADD_OPTION_BTN"), this );
+
+  myTable->setHorizontalHeaderLabels
+    ( QStringList() << tr("CHOICE") << tr("OPTION_NAME") << tr("OPTION_VALUE") );
+  QHeaderView * header = myTable->horizontalHeader();
+  header->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
+  header->setSectionResizeMode( 1, QHeaderView::Stretch );
+  header->setSectionResizeMode( 2, QHeaderView::ResizeToContents );
+
+  QGridLayout* lay = new QGridLayout( this );
+  lay->setMargin( MARGIN );
+  lay->setSpacing( SPACING );
+  lay->addWidget( myTable, 0,0, 1,3 );
+  lay->addWidget( addBtn,  1,0 );
+
+  connect( addBtn, SIGNAL( clicked() ), SLOT( onAdd() ));
+}
+
+SMESH_AdvOptionsWdg::~SMESH_AdvOptionsWdg()
+{
+}
+
+void SMESH_AdvOptionsWdg::AddOption( QString name, QString value, bool isDefault, bool isCustom )
+{
+  int row = myTable->rowCount();
+  myTable->insertRow( row );
+
+  QTableWidgetItem*  nameItem = new QTableWidgetItem( name );
+  QTableWidgetItem* valueItem = new QTableWidgetItem( value );
+  if ( !name.isEmpty() )
+    nameItem->setFlags( nameItem->flags() & ~Qt::ItemIsEditable );
+  myTable->setItem( row, 1, nameItem );
+  myTable->setItem( row, 2, valueItem );
+  nameItem->setData( IS_CUSTOM, isCustom );
+
+  QCheckBox* chkBox = new QCheckBox();
+  QWidget*      wdg = new QWidget();
+  QHBoxLayout*  lay = new QHBoxLayout( wdg );
+  lay->setContentsMargins(0,0,0,0);
+  lay->addStretch();
+  lay->addWidget(chkBox);
+  lay->addStretch();
+  myTable->setCellWidget( row, 0, wdg );
+  connect( chkBox, SIGNAL(toggled(bool)), this, SLOT(onToggle()));
+  myTable->setCurrentCell( row, 1, QItemSelectionModel::NoUpdate );
+  chkBox->setChecked( !isDefault );
+
+  if ( name.isEmpty() )
+    myTable->editItem( nameItem );
+}
+
+void SMESH_AdvOptionsWdg::SetCustomOptions( const QString& text )
+{
+  QStringList nameVals = text.split(" ");
+  for ( int i = 1; i < nameVals.count(); i += 2 )
+    AddOption( nameVals[i-1], nameVals[i], false, true );
+}
+
+void SMESH_AdvOptionsWdg::onAdd()
+{
+  AddOption( "", "", false, true );
+  
+}
+void SMESH_AdvOptionsWdg::onToggle()
+{
+  int row = myTable->currentRow();
+  QTableWidgetItem* valueItem = myTable->item( row, 2 );
+
+  bool isActive = isChecked( row );
+  int c = isActive ? 0 : 150;
+  valueItem->setForeground( QBrush( QColor( c, c, c )));
+  if ( isActive )
+    valueItem->setFlags( valueItem->flags() | Qt::ItemIsEditable );
+  else
+    valueItem->setFlags( valueItem->flags() & ~Qt::ItemIsEditable );
+}
+
+void SMESH_AdvOptionsWdg::GetOption( int      row,
+                                     QString& name,
+                                     QString& value,
+                                     bool&    isDefault,
+                                     bool &   isCustom)
+{
+  if ( row < myTable->rowCount() )
+  {
+    name      = myTable->item( row, 1 )->text();
+    value     = myTable->item( row, 2 )->text();
+    isDefault = !isChecked( row );
+    isCustom  = myTable->item( row, 1 )->data( IS_CUSTOM ).toInt();
+  }
+}
+
+QString SMESH_AdvOptionsWdg::GetCustomOptions()
+{
+  QString text, value, name;
+  bool isDefault, isCustom;
+  for ( int row = 0; row < myTable->rowCount(); ++row )
+  {
+    GetOption( row, name, value, isDefault, isCustom );
+    if ( !name.isEmpty() && !value.isEmpty() && isCustom && !isDefault )
+      text += name + " " + value + " ";
+  }
+  return text;
+}
+
+bool SMESH_AdvOptionsWdg::isChecked( int row )
+{
+  QCheckBox* cb = myTable->cellWidget( row, 0 )->findChild<QCheckBox *>();
+  return cb->isChecked();
+}
diff --git a/src/PluginUtils/SMESH_AdvOptionsWdg.h b/src/PluginUtils/SMESH_AdvOptionsWdg.h
new file mode 100644 (file)
index 0000000..3ba3e35
--- /dev/null
@@ -0,0 +1,66 @@
+// Copyright (C) 2007-2016  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
+//
+
+// File   : SMESH_AdvOptionsWdg.h
+// Author : Open CASCADE S.A.S.
+//
+#ifndef SMESH_ADVOPTIONSWDG_H
+#define SMESH_ADVOPTIONSWDG_H
+
+#include "SMESH_PluginUtils.h"
+
+// Qt includes
+#include <QWidget>
+
+class QTableWidget;
+
+/*!
+ *  \brief Widget for entering options as strings
+ */
+class PLUGINUTILS_EXPORT SMESH_AdvOptionsWdg : public QWidget
+{
+  Q_OBJECT
+
+public:
+  SMESH_AdvOptionsWdg( QWidget* parent = 0 );
+  ~SMESH_AdvOptionsWdg();
+
+  void AddOption( QString name, QString value, bool isDefault, bool isCustom );
+  void SetCustomOptions( const QString& text );
+
+  int  GetNbRows();
+  void GetOption( int row, QString& name, QString& value, bool& isDefault, bool &isCustom);
+  QString GetCustomOptions();
+
+private slots:
+
+  void onAdd();
+  void onToggle();
+
+private:
+
+  bool isChecked( int row );
+
+  QTableWidget* myTable;
+};
+
+#endif
diff --git a/src/PluginUtils/SMESH_PluginUtils.h b/src/PluginUtils/SMESH_PluginUtils.h
new file mode 100644 (file)
index 0000000..3f4484b
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright (C) 2007-2016  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
+//
+
+// File   : SMESH_StdMeshersGUI.hxx
+// Author : Alexander BORODIN, Open CASCADE S.A.S.
+//
+#ifndef SMESH_PLUGINUTILS_HXX
+#define SMESH_PLUGINUTILS_HXX
+
+#ifdef WIN32
+ #if defined PLUGINUTILS_EXPORTS || defined PluginUtils_EXPORTS
+  #define PLUGINUTILS_EXPORT __declspec( dllexport )
+ #else
+  #define PLUGINUTILS_EXPORT __declspec( dllimport )
+ #endif
+#else
+ #define PLUGINUTILS_EXPORT
+#endif
+
+#endif // SMESH_PLUGINUTILS_HXX
index 6f944e520fc656221fe7b7e7f6d469053df3e72b..205544cfa0993ba688f3dfd69a386640774a7525 100644 (file)
@@ -1072,6 +1072,10 @@ void SMESHGUI_ExtrusionDlg::ClickOnRadio()
     SelectorWdg->SetEnabled( false, SMESH::EDGE );
   }
 
+  BasePointGrp->setEnabled( !ExtrMethod_RBut2->isChecked() );
+  ScalesGrp   ->setEnabled( !ExtrMethod_RBut2->isChecked() );
+
+
   CheckIsEnable();
 
   onDisplaySimulation(true);
index b86138e082765cf7a305c6c67e431650d5271003..b539eee98b38d95dc562cb97229a5f97421e6cf5 100644 (file)
@@ -185,18 +185,19 @@ private:
   QCheckBox*                       UseInputElemsOnlyCheck;
   QCheckBox*                       MakeGroupsCheck;
 
-  QCheckBox*                       LinearScalesCheck;
-  QGroupBox*                       ScalesGrp;
-  QListWidget*                     ScalesList;
-  QToolButton*                     AddScaleButton;
-  QToolButton*                     RemoveScaleButton;
-  SMESHGUI_SpinBox*                ScaleSpin;
   QGroupBox*                       BasePointGrp;
   QPushButton*                     SelectBasePointButton;
   SMESHGUI_SpinBox*                BasePoint_XSpin;
   SMESHGUI_SpinBox*                BasePoint_YSpin;
   SMESHGUI_SpinBox*                BasePoint_ZSpin;
 
+  QGroupBox*                       ScalesGrp;
+  QListWidget*                     ScalesList;
+  QToolButton*                     AddScaleButton;
+  QToolButton*                     RemoveScaleButton;
+  SMESHGUI_SpinBox*                ScaleSpin;
+  QCheckBox*                       LinearScalesCheck;
+
   QGroupBox*                       GroupButtons;
   QPushButton*                     buttonOk;
   QPushButton*                     buttonCancel;
index 76a91b73bb8743b8677063f291b06dd0efd21f7a..f6ab2b98adcde01a533d11f578a4b11b85ee6ae4 100644 (file)
@@ -4352,6 +4352,10 @@ It can&apos;t be deleted </translation>
         <source>STB_SORT_CHILD_ITEMS</source>
         <translation>Sort child items</translation>
     </message>
+    <message>
+        <source>SMESH_ADVANCED</source>
+        <translation>Advanced</translation>
+    </message>
 </context>
 <context>
     <name>SMESHGUI_FieldSelectorWdg</name>
@@ -8074,4 +8078,23 @@ as they are of improper type:
         <translation>At least one entity type should be chosen!</translation>
     </message>
 </context>
+<context>
+    <name>SMESH_AdvOptionsWdg</name>
+    <message>
+        <source>ADD_OPTION_BTN</source>
+        <translation>Add option</translation>
+    </message>
+    <message>
+        <source>CHOICE</source>
+        <translation>Choice</translation>
+    </message>
+    <message>
+        <source>OPTION_NAME</source>
+        <translation>Option name</translation>
+    </message>
+    <message>
+        <source>OPTION_VALUE</source>
+        <translation>Option value</translation>
+    </message>
+</context>
 </TS>