mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-11 16:19:16 +05:00
23307: [EDF 7315] Improvement of DISTENE meshing plugins
This commit is contained in:
parent
9341b16ef3
commit
7646a7f54e
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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})
|
||||
|
@ -25,18 +25,10 @@
|
||||
#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 "SMESH_PluginUtils.h"
|
||||
|
||||
#include "SALOMEDSClient.hxx"
|
||||
#include "SALOME_InteractiveObject.hxx"
|
||||
#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_
|
||||
|
155
src/PluginUtils/SMESH_AdvOptionsWdg.cxx
Normal file
155
src/PluginUtils/SMESH_AdvOptionsWdg.cxx
Normal file
@ -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();
|
||||
}
|
66
src/PluginUtils/SMESH_AdvOptionsWdg.h
Normal file
66
src/PluginUtils/SMESH_AdvOptionsWdg.h
Normal file
@ -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
|
39
src/PluginUtils/SMESH_PluginUtils.h
Normal file
39
src/PluginUtils/SMESH_PluginUtils.h
Normal file
@ -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
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -4352,6 +4352,10 @@ It can'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>
|
||||
|
Loading…
Reference in New Issue
Block a user