//
#include "BLSURFPluginGUI_HypothesisCreator.h"
#include "BLSURFPluginGUI_Dlg.h"
+#include "BLSURFPlugin_Hypothesis.hxx"
-#include "GeometryGUI.h"
+#include <GeometryGUI.h>
-#include <SMESHGUI_Utils.h>
-#include <SMESHGUI_HypothesesUtils.h>
#include <SMESHGUI_Dialog.h>
-#include "SMESHGUI_SpinBox.h"
-#include "SMESH_NumberFilter.hxx"
+#include <SMESHGUI_HypothesesUtils.h>
+#include <SMESHGUI_IdValidator.h>
+#include <SMESHGUI_SpinBox.h>
+#include <SMESHGUI_Utils.h>
+#include <SMESH_Gen_i.hxx>
+#include <SMESH_NumberFilter.hxx>
+#include <StdMeshersGUI_SubShapeSelectorWdg.h>
-#include <SUIT_Session.h>
+#include <LightApp_SelectionMgr.h>
+#include <SALOME_ListIO.hxx>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SalomeApp_Application.h>
#include <SalomeApp_Tools.h>
#include <QApplication>
#include <QCheckBox>
#include <QComboBox>
#include <QFrame>
-#include <QHBoxLayout>
-#include <QHeaderView>
#include <QGridLayout>
#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QHeaderView>
#include <QLabel>
#include <QLineEdit>
#include <QMenu>
+#include <QModelIndexList>
#include <QObject>
#include <QPushButton>
#include <QRadioButton>
#include <QSpinBox>
-#include <QTableWidget>
-#include <QTabWidget>
-#include <QVBoxLayout>
#include <QSplitter>
-
-#include <QStandardItemModel>
#include <QStandardItem>
+#include <QStandardItemModel>
+#include <QTabWidget>
+#include <QTableWidget>
#include <QTreeWidget>
#include <QTreeWidgetItem>
-#include <QModelIndexList>
-
-#include <LightApp_SelectionMgr.h>
-#include <SalomeApp_Application.h>
-#include <SALOME_ListIO.hxx>
-#include "SALOME_LifeCycleCORBA.hxx"
+#include <QVBoxLayout>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Iterator.hxx>
-#include <SMESH_Gen_i.hxx>
-#include <boost/shared_ptr.hpp>
-#include <boost/algorithm/string.hpp>
-#include <structmember.h>
-#include <stdexcept>
-#include <algorithm>
+
+#include <structmember.h> // Python
using namespace std;
SMP_TAB,
ENF_TAB,
PERIODICITY_TAB,
+ HYPERPATCH_TAB,
SMP_NAME_COLUMN =0,
SMP_SIZEMAP_COLUMN,
SMP_ENTRY_COLUMN,
// Enforced vertices inputs
enum {
ENF_VER_FACE = 0,
- ENF_VER_VERTEX,
+ ENF_VER_VERTEX = 0,
ENF_VER_X_COORD,
ENF_VER_Y_COORD,
ENF_VER_Z_COORD,
static PyTypeObject PyStdOut_Type = {
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
+ PyVarObject_HEAD_INIT(NULL, 0)
"PyOut", /*tp_name*/
sizeof(PyStdOut), /*tp_basicsize*/
0, /*tp_itemsize*/
BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator( const QString& theHypType )
: SMESHGUI_GenericHypothesisCreator( theHypType )
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator");
this->mySMPMap.clear();
GeomToolSelected = NULL;
bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::checkParams");
bool ok = true;
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
{
QString entry = mySizeMapTable->topLevelItem( row )->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
QString sizeMap = mySizeMapTable->topLevelItem( row )->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString();
- MESSAGE("entry ="<<entry.toStdString())
if ( !sizeMap.isEmpty() ) {
if (that->sizeMapValidationFromRow(row))
{
try {
- MESSAGE("entry ="<<entry.toStdString())
- MESSAGE("sizeMap ="<<sizeMap.toStdString())
-
e = entry.toStdString();
s = that->mySMPMap[entry].toStdString();
- MESSAGE("row = "<<row)
- MESSAGE("e = "<<e)
- MESSAGE("s = "<<s)
h->SetSizeMapEntry( e.c_str(), s.c_str() );
}
catch ( const SALOME::SALOME_Exception& ex )
QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::buildFrame");
-
QFrame* fr = new QFrame( 0 );
- // fr-> setMinimumSize(600,400);
QVBoxLayout* lay = new QVBoxLayout( fr );
- // lay->setSizeConstraint(QLayout::SetDefaultConstraint);
lay->setMargin( 5 );
lay->setSpacing( 0 );
if( isCreation() )
myName = new QLineEdit( myStdGroup );
myStdWidget = new BLSURFPluginGUI_StdWidget(myStdGroup);
+ if ( !hasGeom() ) {
+ myStdWidget->myPhysicalMesh->removeItem( PhysicalLocalSize );
+ }
int row = 0;
if( isCreation() ) {
}
aStdLayout->addWidget( myStdWidget, row++, 0, 1, 4 );
- //int maxrow = row;
row = 0;
if( isCreation() )
row = 1;
-// row = max(row,maxrow)+1;
aStdLayout->setRowStretch(row,1);
aStdLayout->setColumnStretch(1,1);
- //maxrow = row;
// advanced parameters
anAdvLayout->setSpacing( 6 );
anAdvLayout->setMargin( 11 );
myAdvWidget = new BLSURFPluginGUI_AdvWidget(myAdvGroup);
- //myAdvWidget->addBtn->setMenu( new QMenu() );
anAdvLayout->addWidget( myAdvWidget );
// Size Maps parameters
- mySmpGroup = new QWidget();
-// mySmpGroup->setMinimumWidth(500);
+ mySmpGroup = new QWidget( dlg() );
//Layout
QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
smpTab->setCurrentIndex( SMP_STD_TAB );
// Enforced vertices parameters
- myEnfGroup = new QWidget();
+ myEnfGroup = new QWidget( dlg() );
QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
-//
-// myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced(myEnfGroup);
-// anEnfLayout->addWidget(myEnforcedVertexWidget);
-// MESSAGE("Creating DlgBlSurfHyp_Enforced widget instance");
-// myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced();
myEnforcedTreeWidget = new QTreeWidget(myEnfGroup);
myEnforcedTreeWidget->setColumnCount( ENF_VER_NB_COLUMNS );
myEnforcedTreeWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
myEnforcedTreeWidget->setItemDelegate(new EnforcedTreeWidgetDelegate());
-// FACE AND VERTEX SELECTION
+ // FACE AND VERTEX SELECTION
TColStd_MapOfInteger shapeTypes1, shapeTypes2;
shapeTypes1.Add( TopAbs_FACE );
shapeTypes1.Add( TopAbs_COMPOUND );
shapeTypes2.Add( TopAbs_VERTEX );
shapeTypes2.Add( TopAbs_COMPOUND );
- SMESH_NumberFilter* faceFilter = new SMESH_NumberFilter("GEOM", TopAbs_FACE, 0, shapeTypes1);
- myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true);
- myEnfFaceWdg->SetDefaultText(tr("BLS_SEL_FACES"), "QLineEdit { color: grey }");
+ // SMESH_NumberFilter* faceFilter = new SMESH_NumberFilter("GEOM", TopAbs_FACE, 0, shapeTypes1);
+ // myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true);
+ // myEnfFaceWdg->SetDefaultText(tr("BLS_SEL_FACES"), "QLineEdit { color: grey }");
SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes2);
myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true);
myEnfVertexWdg->SetDefaultText(tr("BLS_SEL_VERTICES"), "QLineEdit { color: grey }");
- myEnfVertexWdg->AvoidSimultaneousSelection(myEnfFaceWdg);
+ //myEnfVertexWdg->AvoidSimultaneousSelection(myEnfFaceWdg);
QLabel* myXCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_X_LABEL" ), myEnfGroup );
myXCoord = new SMESHGUI_SpinBox(myEnfGroup);
QLabel* myInternalEnforcedVerticesAllFacesGroupLabel = new QLabel( tr( "BLSURF_ENF_VER_GROUP_LABEL" ), myEnfGroup );
myInternalEnforcedVerticesAllFacesGroup = new QLineEdit(myEnfGroup);
-// myGlobalGroupName = new QCheckBox(tr("BLSURF_ENF_VER_GROUPS"), myEnfGroup);
-// myGlobalGroupName->setChecked(false);
-
anEnfLayout->addWidget(myEnforcedTreeWidget, 0, 0, ENF_VER_NB_LINES, 1);
QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
// FACE AND VERTEX SELECTION
- anEnfLayout2->addWidget(myEnfFaceWdg, ENF_VER_FACE, 0, 1, 2);
+ //anEnfLayout2->addWidget(myEnfFaceWdg, ENF_VER_FACE, 0, 1, 2);
anEnfLayout2->addWidget(myEnfVertexWdg, ENF_VER_VERTEX, 0, 1, 2);
anEnfLayout2->addWidget(myXCoordLabel, ENF_VER_X_COORD, 0, 1, 1);
anEnfLayout2->addWidget(myXCoord, ENF_VER_X_COORD, 1, 1, 1);
anEnfLayout2->addWidget(myZCoord, ENF_VER_Z_COORD, 1, 1, 1);
anEnfLayout2->addWidget(myGroupNameLabel, ENF_VER_GROUP, 0, 1, 1);
anEnfLayout2->addWidget(myGroupName, ENF_VER_GROUP, 1, 1, 1);
-// anEnfLayout2->addWidget(myGlobalGroupName, ENF_VER_GROUP_CHECK, 0, 1, 2);
-// anEnfLayout2->setRowStretch( ENF_VER_SPACE, 1);
anEnfLayout2->addWidget(addVertexButton, ENF_VER_BTN, 0, 1, 1);
anEnfLayout2->addWidget(removeVertexButton, ENF_VER_BTN, 1, 1, 1);
anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFaces, ENF_VER_INTERNAL_ALL_FACES, 0, 1, 2);
anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFacesGroupLabel, ENF_VER_INTERNAL_ALL_FACES_GROUP, 0, 1, 1);
anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFacesGroup, ENF_VER_INTERNAL_ALL_FACES_GROUP, 1, 1, 1);
anEnfLayout2->setRowStretch(ENF_VER_NB_LINES+1, 1);
-// anEnfLayout2->addWidget(makeGroupsCheck, ENF_VER_GROUP_CHECK, 0, 1, 2);
anEnfLayout->addLayout(anEnfLayout2, 0,1,ENF_VER_NB_LINES+1,2);
-// anEnfLayout->setRowStretch(1, 1);
// ---
// Periodicity parameters
- myPeriodicityGroup = new QWidget();
+ myPeriodicityGroup = new QWidget( dlg() );
aPeriodicityLayout1 = new QGridLayout(myPeriodicityGroup);
myPeriodicitySplitter = new QSplitter(myPeriodicityGroup);
myPeriodicitySelectionWidgets.append(myPeriodicityP3TargetWdg);
avoidSimultaneousSelection(myPeriodicitySelectionWidgets);
+ // HyperPatch parameters
+
+ QWidget* hpGroup = new QWidget();
+ QGridLayout* hpLayout = new QGridLayout(hpGroup);
+
+ myHyPatchTable = new QTableWidget( hpGroup );
+ myHyPatchTable->setColumnCount(1);
+ myHyPatchTable->setHorizontalHeaderLabels( QStringList() << tr("BLSURF_HYPATCH_TBL_HEADER") );
+ myHyPatchTable->setAlternatingRowColors(true);
+ myHyPatchTable->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
+
+
+ QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ myHyPatchFaceSelBtn = new QPushButton( iconSelect, tr("BLSURF_HYPATCH_SEL_FACE"), hpGroup );
+ myHyPatchGroupSelBtn = new QPushButton( iconSelect, tr("BLSURF_HYPATCH_SEL_GROUP"), hpGroup );
+ myHyPatchFaceSelBtn->setCheckable( true );
+ myHyPatchGroupSelBtn->setCheckable( true );
+
+ myHyPatchFaceSelector = new StdMeshersGUI_SubShapeSelectorWdg( hpGroup, TopAbs_FACE, /*toShowList=*/false );
+
+ QLabel* hpTagsLbl = new QLabel( tr("BLSURF_TAGS"), hpGroup );
+ myHyPatchTagsLE = new QLineEdit( hpGroup );
+ myHyPatchTagsLE->setValidator( new SMESHGUI_IdValidator( hpGroup ));
+
+ QPushButton* hpAddBtn = new QPushButton( tr("BLSURF_SM_ADD"), hpGroup );
+ QPushButton* hpRemBtn = new QPushButton( tr("BLSURF_SM_REMOVE"), hpGroup );
+
+ hpLayout->addWidget( myHyPatchTable, 0, 0, 5, 1 );
+ hpLayout->addWidget( myHyPatchFaceSelBtn, 0, 1, 1, 2 );
+ hpLayout->addWidget( myHyPatchGroupSelBtn, 0, 3, 1, 2 );
+ hpLayout->addWidget( hpTagsLbl, 1, 1, 1, 1 );
+ hpLayout->addWidget( myHyPatchTagsLE, 1, 2, 1, 3 );
+ hpLayout->addWidget( hpAddBtn, 2, 1, 1, 2 );
+ hpLayout->addWidget( hpRemBtn, 2, 3, 1, 2 );
+ hpLayout->addWidget( myHyPatchFaceSelector, 3, 1, 1, 4 );
+
+
+
// ---
myTabWidget->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
myTabWidget->insertTab( ADV_TAB, myAdvGroup, tr( "BLSURF_ADV_ARGS" ) );
- myTabWidget->insertTab( SMP_TAB, mySmpGroup, tr( "LOCAL_SIZE" ) );
- myTabWidget->insertTab( ENF_TAB, myEnfGroup, tr( "BLSURF_ENF_VER" ) );
- myTabWidget->insertTab( PERIODICITY_TAB, myPeriodicityGroup, tr( "BLSURF_PERIODICITY" ) );
-
+ if ( hasGeom() ) {
+ myTabWidget->insertTab( SMP_TAB, mySmpGroup, tr( "LOCAL_SIZE" ) );
+ myTabWidget->insertTab( ENF_TAB, myEnfGroup, tr( "BLSURF_ENF_VER" ) );
+ myTabWidget->insertTab( PERIODICITY_TAB, myPeriodicityGroup, tr( "BLSURF_PERIODICITY" ) );
+ myTabWidget->insertTab( HYPERPATCH_TAB, hpGroup, tr( "BLSURF_HYPERPATCH_TAB" ));
+ }
+ else
+ {
+ mySmpGroup->hide();
+ myEnfGroup->hide();
+ myPeriodicityGroup->hide();
+ hpGroup->hide();
+ }
myTabWidget->setCurrentIndex( STD_TAB );
connect( myAdvWidget->addBtn, SIGNAL( clicked() ), this, SLOT( onAddOption() ) );
- connect( myStdWidget->myAllowQuadrangles, SIGNAL( stateChanged( int ) ), this, SLOT( onStateChange() ));
// Size Maps
connect( addMapButton, SIGNAL( clicked()), this, SLOT( onAddMap() ) );
connect( removeMapButton, SIGNAL( clicked()), this, SLOT( onRemoveMap() ) );
connect( modifyMapButton, SIGNAL( clicked()), this, SLOT( onModifyMap() ) );
-// connect( mySizeMapTable, SIGNAL( cellChanged ( int, int )), this, SLOT( onSetSizeMap(int,int ) ) );
connect( mySizeMapTable, SIGNAL( itemClicked (QTreeWidgetItem *, int)),this, SLOT( onSmpItemClicked(QTreeWidgetItem *, int) ) );
connect( myGeomSelWdg2, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
connect( myGeomSelWdg1, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
connect( myAttSelWdg, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
-// connect( myAttractorGroup, SIGNAL( clicked(bool) ), this, SLOT( onAttractorGroupClicked(bool) ) );
connect( mySizeMapTable, SIGNAL( itemChanged (QTreeWidgetItem *, int)),this, SLOT( onSetSizeMap(QTreeWidgetItem *, int) ) );
connect( myAttractorCheck, SIGNAL( stateChanged ( int )), this, SLOT( onAttractorClicked( int ) ) );
connect( myConstSizeCheck, SIGNAL( stateChanged ( int )), this, SLOT( onConstSizeClicked( int ) ) );
// Enforced vertices
connect( myEnforcedTreeWidget,SIGNAL( itemClicked(QTreeWidgetItem *, int)), this, SLOT( synchronizeCoords() ) );
connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this, SLOT( updateEnforcedVertexValues(QTreeWidgetItem *, int) ) );
-// connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this, SLOT( update(QTreeWidgetItem *, int) ) );
connect( myEnforcedTreeWidget,SIGNAL( itemSelectionChanged() ), this, SLOT( synchronizeCoords() ) );
connect( addVertexButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedVertices() ) );
connect( removeVertexButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedVertex() ) );
connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
connect( myInternalEnforcedVerticesAllFaces, SIGNAL( stateChanged ( int )), this, SLOT( onInternalVerticesClicked( int ) ) );
-// connect( myEnfVertexWdg, SIGNAL( selectionActivated()), this, SLOT( onVertexSelectionActivated() ) );
-// connect( myEnfFaceWdg, SIGNAL( selectionActivated()), this, SLOT( onFaceSelectionActivated() ) );
// Periodicity
connect( myPeriodicityAddButton, SIGNAL( clicked()), this, SLOT( onAddPeriodicity() ) );
ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++)
- {
- StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
- connect( w1, SIGNAL(contentModified ()), this, SLOT(onPeriodicityContentModified()));
+ {
+ StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
+ connect( w1, SIGNAL(contentModified ()), this, SLOT(onPeriodicityContentModified()));
+
+ }
+
+ // HyperPatch
+ connect( myHyPatchFaceSelBtn, SIGNAL( toggled(bool) ), SLOT( onHyPatchFaceSelection(bool) ));
+ connect( myHyPatchGroupSelBtn, SIGNAL( toggled(bool) ), SLOT( onHyPatchGroupSelection(bool) ));
+ connect( myHyPatchFaceSelector, SIGNAL( shapeSelected() ), SLOT( onHyPatchSelectionChanged()));
+ connect( hpAddBtn, SIGNAL( clicked() ), SLOT( onHyPatchAdd()));
+ connect( hpRemBtn, SIGNAL( clicked() ), SLOT( onHyPatchRemove()));
- }
-// connect( myPeriodicitySourceFaceWdg, SIGNAL(contentModified()), this, SLOT(onPeriodicityContentModified()));
return fr;
}
/** BLSURFPluginGUI_HypothesisCreator::deactivateSelection(QWidget*, QWidget*)
-This method stop the selection of the widgets StdMeshersGUI_ObjectReferenceParamWdg
+ This method stop the selection of the widgets StdMeshersGUI_ObjectReferenceParamWdg
*/
// void BLSURFPluginGUI_HypothesisCreator::deactivateSelection(QWidget* old, QWidget* now)
// {
myXCoord->setText("");
myYCoord->setText("");
myZCoord->setText("");
-// myGroupName->setText("");
+ // myGroupName->setText("");
}
/** BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues(item, column)
-This method updates the tooltip of a modified item. The QLineEdit widgets content
-is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
+ This method updates the tooltip of a modified item. The QLineEdit widgets content
+ is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
*/
void BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTreeWidgetItem* item, int column) {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues");
QVariant vertexName = item->data(ENF_VER_NAME_COLUMN, Qt::EditRole);
QVariant x = item->data(ENF_VER_X_COLUMN, Qt::EditRole);
QVariant y = item->data(ENF_VER_Y_COLUMN, Qt::EditRole);
}
/** BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(entry, shapeName, x, y, z)
-This method adds an enforced vertex (x,y,z) to shapeName in the tree widget.
+ This method adds an enforced vertex (x,y,z) to shapeName in the tree widget.
*/
-void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(QTreeWidgetItem* theItem, double x, double y, double z,
- std::string vertexName, std::string geomEntry, std::string groupName) {
-
- std::string theFaceName = theItem->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString();
-// MESSAGE("theItemName is " << theItem->text(ENF_VER_NAME_COLUMN).toStdString());
+void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z,
+ std::string vertexName,
+ std::string geomEntry,
+ std::string groupName)
+{
bool okToCreate = true;
- const int nbVert = theItem->childCount();
-// MESSAGE("Number of child rows: " << nbVert);
- if (nbVert >0) {
- double childValueX,childValueY,childValueZ;
- QString childEntry, childGroupName;
- QTreeWidgetItem* child;
- for (int row = 0;row<nbVert;row++) {
- child = theItem->child(row);
- childGroupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString();
- childEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString();
- childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
- childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
- childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
- if (((childValueX == x) && (childValueY == y) && (childValueZ == z)) || ( (childEntry.toStdString() != "") && (childEntry.toStdString() == geomEntry))) {
- // update group name
- if (childGroupName.toStdString() != groupName) {
- MESSAGE("Group is updated from \"" << childGroupName.toStdString() << "\" to \"" << groupName << "\"");
- child->setData(ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
- }
- okToCreate = false;
- break;
- } // if
- } // for
- } // if
+ const int nbVert = myEnforcedTreeWidget->topLevelItemCount();
+ for (int row = 0; row < nbVert; row++ )
+ {
+ QTreeWidgetItem* child = myEnforcedTreeWidget->topLevelItem( row );
+ QString childGroupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString();
+ QString childEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString();
+ double childX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
+ double childY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
+ double childZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
+ if (((childEntry.isEmpty()) && (childX == x) && (childY == y) && (childZ == z)) ||
+ ( !childEntry.isEmpty() && childEntry == geomEntry.c_str() ))
+ {
+ // update group name
+ if ( childGroupName != groupName.c_str() ) {
+ child->setData(ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
+ }
+ okToCreate = false;
+ break;
+ } // if
+ } // for
if (!okToCreate) {
- if (geomEntry.empty()) {
- MESSAGE("In " << theFaceName << " vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
- }
- else {
- MESSAGE("In " << theFaceName << " vertex with entry " << geomEntry << " already exist: dont create again");
- }
return;
}
-
- if (geomEntry.empty()) {
- MESSAGE("In " << theFaceName << " vertex with coords " << x << ", " << y << ", " << z<< " is created");
- }
- else {
- MESSAGE("In " << theFaceName << " vertex with geom entry " << geomEntry << " is created");
- }
- QTreeWidgetItem *vertexItem = new QTreeWidgetItem( theItem);
+ QTreeWidgetItem *vertexItem = new QTreeWidgetItem( myEnforcedTreeWidget );
vertexItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
QSize iconSize = iconSelect.size()*0.7;
-
- int vertexIndex=myEnforcedTreeWidget->indexOfTopLevelItem(theItem);
+
+ int vertexIndex=nbVert;
QString myVertexName;
int indexRef = -1;
while(indexRef != vertexIndex) {
myVertexName = QString(vertexName.c_str());
for (int row = 0;row<nbVert;row++) {
- QString name = theItem->child(row)->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString();
+ QString name = myEnforcedTreeWidget->topLevelItem(row)->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString();
if (myVertexName == name) {
vertexIndex++;
break;
if (groupName != "")
vertexItem->setData( ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
- QString toolTip = QString(theFaceName.c_str())+QString(": ")+myVertexName;
+ QString toolTip = myVertexName;
if (geomEntry.empty()) {
- toolTip += QString(" (%1, ").arg(x);
- toolTip += QString("%1, ").arg(y);
- toolTip += QString("%1)").arg(z);
+ toolTip += QString(" (%1, %2, %3").arg(x).arg(y).arg(z);
}
if (groupName != "")
toolTip += QString(" [%1]").arg(groupName.c_str());
vertexItem->setToolTip(ENF_VER_NAME_COLUMN,toolTip);
- theItem->setExpanded(true);
myEnforcedTreeWidget->setCurrentItem(vertexItem,ENF_VER_NAME_COLUMN);
}
/** BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
This method is called when a item is added into the enforced vertices tree widget
*/
-void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices() {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices");
-
+void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
+{
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
getGeomSelectionTool()->selectionMgr()->clearFilters();
- myEnfFaceWdg->deactivateSelection();
myEnfVertexWdg->deactivateSelection();
for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
myEnforcedTreeWidget->resizeColumnToContents(column);
// Vertex selection
- int selEnfFace = myEnfFaceWdg->NbObjects();
int selEnfVertex = myEnfVertexWdg->NbObjects();
bool coordsEmpty = (myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty());
- if (selEnfFace == 0)
- return;
-
if ((selEnfVertex == 0) && coordsEmpty)
return;
string entry, shapeName;
-
- for (int i = 0 ; i < selEnfFace ; i++) {
- myEnfFace = myEnfFaceWdg->GetObject< GEOM::GEOM_Object >(i);
- entry = myEnfFace->GetStudyEntry();
- shapeName = myEnfFace->GetName();
-
- QTreeWidgetItem * faceItem = addEnforcedFace(entry, shapeName);
-
- std::string groupName = myGroupName->text().toStdString();
-
- if (boost::trim_copy(groupName).empty())
- groupName = "";
+ {
+ std::string groupName = myGroupName->text().simplified().toStdString();
if (selEnfVertex <= 1)
{
z = myZCoord->GetValue();
if (selEnfVertex == 1) {
myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
- addEnforcedVertex(faceItem, x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ addEnforcedVertex(x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
}
else
- addEnforcedVertex(faceItem, x, y, z, "", "", groupName);
+ addEnforcedVertex(x, y, z, "", "", groupName);
}
else
{
if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
measureOp->PointCoordinates (myEnfVertex, x, y, z);
if ( measureOp->IsDone() )
- addEnforcedVertex(faceItem, x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ addEnforcedVertex(x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
} else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) {
- addEnforcedVertex(faceItem, 0, 0, 0, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ addEnforcedVertex(0, 0, 0, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
}
}
}
}
- myEnfFaceWdg->SetObject(GEOM::GEOM_Object::_nil());
myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
This method is called when a item is removed from the enforced vertices tree widget
*/
void BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex() {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex");
QList<QTreeWidgetItem *> selectedItems = myEnforcedTreeWidget->selectedItems();
QList<QTreeWidgetItem *> selectedVertices;
QSet<QTreeWidgetItem *> selectedEntries;
foreach(item,selectedVertices) {
QTreeWidgetItem* parent = item->parent();
-// MESSAGE("From geometry "<< parent->text(ENF_VER_NAME_COLUMN).toStdString()<<" remove " << item->text(ENF_VER_NAME_COLUMN).toStdString());
- parent->removeChild(item);
+ if ( parent )
+ parent->removeChild(item);
delete item;
- if (parent->childCount() == 0) {
+ if ( parent && parent->childCount() == 0) {
if (selectedEntries.contains(parent))
selectedEntries.remove(parent);
delete parent;
}
foreach(item,selectedEntries) {
-// MESSAGE("Remove " << item->text(ENF_VER_NAME_COLUMN).toStdString());
delete item;
}
This method is called when a item is added into the periodicity table widget
*/
void BLSURFPluginGUI_HypothesisCreator::onAddPeriodicity() {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices");
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
This method is called when a item is removed from the periodicity tree widget
*/
void BLSURFPluginGUI_HypothesisCreator::onRemovePeriodicity() {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex");
QList<QTreeWidgetItem *> selectedItems = myPeriodicityTreeWidget->selectedItems();
QTreeWidgetItem* item;
foreach(item,selectedItems) {
- MESSAGE("Remove " << item->text(0).toStdString());
delete item;
}
//{
// if (myPeriodicityOnFaceRadioButton->isChecked())
// {
-// MESSAGE("Show Face");
// myPeriodicitySourceEdgeWdg->hide();
// myPeriodicityTargetEdgeWdg->hide();
// myPeriodicitySourceFaceWdg->show();
// }
// else
// {
-// MESSAGE("Show Edge");
// myPeriodicitySourceFaceWdg->hide();
// myPeriodicityTargetFaceWdg->hide();
// myPeriodicitySourceEdgeWdg->show();
*/
void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::retrieveParams");
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
BlsurfHypothesisData data;
myStdWidget->myVolumeGradation->setText("");
else
myStdWidget->myVolumeGradation->SetValue( data.myVolumeGradation );
- myStdWidget->myAllowQuadrangles->setChecked( data.myAllowQuadrangles );
+ foreach (QAbstractButton* button, myStdWidget->myButtonGroupElementType->buttons()) {
+ if (myStdWidget->myButtonGroupElementType->id(button) == data.myElementType) {
+ button->setChecked(true);
+ break;
+ }
+ }
+
if (data.myAngleMesh < 0)
myStdWidget->myAngleMesh->setText("");
else
// myGMFFileMode->setChecked(data.myGMFFileMode);
// Sizemaps
- MESSAGE("retrieveParams():that->mySMPMap.size() = " << that->mySMPMap.size());
QMapIterator<QString, QString> i(that->mySMPMap);
GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
while (i.hasNext()) {
else
{
item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant( sizeMap ) );
- }
+ }
}
mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
// Enforced vertices
- MESSAGE("retrieveParams(): data.entryCoordsListMap.size() = " << data.faceEntryEnfVertexListMap.size());
TFaceEntryEnfVertexListMap::const_iterator evmIt = data.faceEntryEnfVertexListMap.begin();
for ( ; evmIt != data.faceEntryEnfVertexListMap.end() ; ++evmIt) {
TEntry entry = (*evmIt).first;
std::string shapeName = myGeomToolSelected->getNameFromEntry(entry);
- MESSAGE("Face entry: " << entry);
- MESSAGE("Face name: " << shapeName);
-
- QTreeWidgetItem* faceItem = that->addEnforcedFace(entry, shapeName);
+
+ //QTreeWidgetItem* faceItem = that->addEnforcedFace(entry, shapeName);
TEnfVertexList evs = (*evmIt).second;
TEnfVertex *enfVertex;
for ( ; evsIt != evs.end() ; ++evsIt) {
enfVertex = (*evsIt);
- MESSAGE("Name: " << enfVertex->name);
double x = 0, y = 0, z = 0;
if (enfVertex->coords.size()) {
x = enfVertex->coords[0];
y = enfVertex->coords[1];
z = enfVertex->coords[2];
}
- that->addEnforcedVertex(faceItem, x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName);
+ that->addEnforcedVertex(x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName);
}
}
-
+
for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
myEnforcedTreeWidget->resizeColumnToContents(column);
myInternalEnforcedVerticesAllFacesGroup->setEnabled(data.myInternalEnforcedVerticesAllFaces);
// Periodicity
- MESSAGE("retrieveParams(): periodicity ");
-
// Add an item in the tree widget for each association
for (size_t i=0 ; i<data.preCadPeriodicityVector.size() ; i++)
+ {
+ QTreeWidgetItem* item = new QTreeWidgetItem();
+ myPeriodicityTreeWidget->addTopLevelItem(item);
+ item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
+ TPreCadPeriodicity periodicity_i = data.preCadPeriodicityVector[i];
+ for (size_t k=0; k<periodicity_i.size(); k++)
{
- QTreeWidgetItem* item = new QTreeWidgetItem();
- myPeriodicityTreeWidget->addTopLevelItem(item);
- item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
- TPreCadPeriodicity periodicity_i = data.preCadPeriodicityVector[i];
- for (size_t k=0; k<periodicity_i.size(); k++)
- {
- string shapeEntry = periodicity_i[k];
- string shapeName = myGeomToolSelected->getNameFromEntry(shapeEntry);
- item->setData(k, Qt::EditRole, shapeName.c_str() );
- item->setData(k, Qt::UserRole, shapeEntry.c_str() );
- }
+ string shapeEntry = periodicity_i[k];
+ string shapeName = myGeomToolSelected->getNameFromEntry(shapeEntry);
+ item->setData(k, Qt::EditRole, shapeName.c_str() );
+ item->setData(k, Qt::UserRole, shapeEntry.c_str() );
}
+ }
+
+ // Hyper patches
+ for ( int i = 0; i < data.hyperpatches.size(); ++i )
+ that->addHyPatchToTable( data.hyperpatches[i] );
// update widgets
that->myStdWidget->onPhysicalMeshChanged();
*/
QString BLSURFPluginGUI_HypothesisCreator::storeParams() const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParams");
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
BlsurfHypothesisData data;
*/
bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData& h_data ) const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo");
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis() );
h_data.myGradation = h->GetGradation();
h_data.myUseVolumeGradation = h->GetUseVolumeGradation();
h_data.myVolumeGradation = h->GetVolumeGradation();
- h_data.myAllowQuadrangles = h->GetQuadAllowed();
+ h_data.myElementType = h->GetElementType();
double angle = h->GetAngleMesh();
h_data.myAngleMesh = angle > 0 ? angle : -1.0;
double chordalError = h->GetChordalError();
// classic size maps
BLSURFPlugin::string_array_var mySizeMaps = h->GetSizeMapEntries();
-// MESSAGE("mySizeMaps->length() = " << mySizeMaps->length());
QString fullSizeMaps;
QStringList fullSizeMapList;
GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
for ( CORBA::ULong i = 0;i<mySizeMaps->length(); ++i ) {
fullSizeMaps = mySizeMaps[i].in();
-// MESSAGE("fullSizeMaps: " << fullSizeMaps.toStdString());
fullSizeMapList = fullSizeMaps.split( "|", QString::KeepEmptyParts );
if ( fullSizeMapList.count() > 1 ) {
string fullSizeMap = fullSizeMapList[1].toStdString();
int pos = fullSizeMap.find("return")+7;
-// MESSAGE("pos:" << pos);
QString sizeMap;
try {
sizeMap = QString::fromStdString(fullSizeMap.substr(pos, fullSizeMap.size()-pos));
continue;
}
that->mySMPMap[fullSizeMapList[0]] = sizeMap;
-// MESSAGE("mySMPMap[" << fullSizeMapList[0].toStdString() << "] = " << sizeMap.toStdString());
that->mySMPShapeTypeMap[fullSizeMapList[0]] = myGeomToolSelected->entryToShapeType(fullSizeMapList[0].toStdString());
-// MESSAGE("mySMPShapeTypeMap[" << fullSizeMapList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[fullSizeMapList[0]]);
}
}
// custom size maps
/*
BLSURFPlugin::string_array_var myCustomSizeMaps = h->GetCustomSizeMapEntries();
- MESSAGE("myCustomSizeMaps->length() = " << myCustomSizeMaps->length());
for ( int i = 0;i<myCustomSizeMaps->length(); ++i ) {
QString fullCustomSizeMaps = myCustomSizeMaps[i].in();
if ( fullCustomSizeMapList.count() > 1 ) {
that->mySMPMap[fullCustomSizeMapList[0]] = fullCustomSizeMapList[1];
that->mySMPShapeTypeMap[fullCustomSizeMapList[0]] = GeomToolSelected->entryToShapeType(fullCustomSizeMapList[0].toStdString());
- MESSAGE("mySMPMap[" << fullCustomSizeMapList[0].toStdString() << "] = " << fullCustomSizeMapList[1].toStdString());
- MESSAGE("mySMPShapeTypeMap[" << fullCustomSizeMapList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[fullCustomSizeMapList[0]]);
}
}
*/
// attractor
BLSURFPlugin::string_array_var allMyAttractors = h->GetAttractorEntries();
-// MESSAGE("myAttractors->length() = " << allMyAttractors->length());
for ( CORBA::ULong i = 0;i<allMyAttractors->length(); ++i ) {
QString myAttractors = allMyAttractors[i].in();
if ( myAttractorList.count() > 1 ) {
that->mySMPMap[myAttractorList[0]] = myAttractorList[1];
that->mySMPShapeTypeMap[myAttractorList[0]] = myGeomToolSelected->entryToShapeType(myAttractorList[0].toStdString());
-// MESSAGE("mySMPMap[" << myAttractorList[0].toStdString() << "] = " << myAttractorList[1].toStdString());
-// MESSAGE("mySMPShapeTypeMap[" << myAttractorList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[myAttractorList[0]]);
}
}
// attractor new version
- MESSAGE("readParamsFromHypo, Attractors")
BLSURFPlugin::TAttParamsMap_var allMyAttractorParams = h->GetAttractorParams();
for ( CORBA::ULong i = 0;i<allMyAttractorParams->length(); ++i ) {
BLSURFPlugin::TAttractorParams myAttractorParams = allMyAttractorParams[i];
QString faceEntry = myAttractorParams.faceEntry.in();
QString attEntry = myAttractorParams.attEntry.in();
- MESSAGE("attEntry = "<<attEntry.toStdString())
that->mySMPMap[faceEntry] = QString::number( myAttractorParams.startSize, 'g', 6 ); // TODO utiliser les préférences ici (cf. sketcher)
that->mySMPShapeTypeMap[faceEntry] = myGeomToolSelected->entryToShapeType(faceEntry.toStdString());
that->myATTMap[faceEntry].push_back( TAttractor( myAttractorParams.attEntry.in(),
*/
BLSURFPlugin::TFaceEntryEnfVertexListMap_var faceEntryEnfVertexListMap = h->GetAllEnforcedVerticesByFace();
- MESSAGE("faceEntryEnfVertexListMap->length() = " << faceEntryEnfVertexListMap->length());
- for ( CORBA::ULong i = 0;i<faceEntryEnfVertexListMap->length(); ++i ) {
- std::string entry = faceEntryEnfVertexListMap[i].faceEntry.in();
-// BLSURFPlugin::TEnfVertexList vertexList = faceEntryEnfVertexListMap[i].enfVertexList.in();
+ for ( CORBA::ULong i = 0;i<faceEntryEnfVertexListMap->length(); ++i )
+ {
+ std::string entry = faceEntryEnfVertexListMap[i].faceEntry.in();
BLSURFPlugin::TEnfVertexList vertexList = faceEntryEnfVertexListMap[i].enfVertexList;
-// BLSURFPlugin::TEnfVertexList_var vertexList = h->GetEnforcedVerticesEntry(entry.c_str());
-
-// TEnfVertexList& enfVertexList = h_data.faceEntryEnfVertexListMap[entry];
- for (CORBA::ULong j=0 ; j<vertexList.length(); ++j) {
+ for (CORBA::ULong j=0 ; j<vertexList.length(); ++j)
+ {
TEnfVertex *enfVertex = new TEnfVertex();
-
- enfVertex->name = CORBA::string_dup(vertexList[j].name.in());
- enfVertex->geomEntry = CORBA::string_dup(vertexList[j].geomEntry.in());
- enfVertex->grpName = CORBA::string_dup(vertexList[j].grpName.in());
+ enfVertex->name = vertexList[j].name.in();
+ enfVertex->geomEntry = vertexList[j].geomEntry.in();
+ enfVertex->grpName = vertexList[j].grpName.in();
for (CORBA::ULong k=0 ; k< vertexList[j].coords.length();k++)
enfVertex->coords.push_back(vertexList[j].coords[k]);
h_data.myInternalEnforcedVerticesAllFacesGroup = h->GetInternalEnforcedVertexAllFacesGroup();
// Periodicity
- MESSAGE("readParamsFromHypo, Periodicity")
h_data.preCadPeriodicityVector.clear();
BLSURFPlugin::TPeriodicityList_var preCadEdgePeriodicityVector = h->GetPreCadEdgesPeriodicityVector();
AddPreCadSequenceToVector(h_data, preCadEdgePeriodicityVector, false);
+
+ // Hyper Patches
+
+ h_data.hyperpatches.clear();
+ BLSURFPlugin::THyperPatchList_var patchList = h->GetHyperPatches();
+ for ( CORBA::ULong i = 0; i < patchList->length(); ++i )
+ {
+ QString tags;
+ BLSURFPlugin::THyperPatch& patch = patchList[i];
+ for ( CORBA::ULong j = 0; j < patch.length(); ++j )
+ tags += QString::number( patch[j] ) + " ";
+ if ( !tags.isEmpty() )
+ h_data.hyperpatches.append( tags );
+ }
+
return true;
}
*/
bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesisData& h_data ) const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo");
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() );
if ( h->GetVolumeGradation() != h_data.myVolumeGradation )
h->SetVolumeGradation( h_data.myVolumeGradation <= 0 ? -1 : h_data.myVolumeGradation );
- if ( h->GetQuadAllowed() != h_data.myAllowQuadrangles )
- h->SetQuadAllowed( h_data.myAllowQuadrangles );
+ if ( h->GetElementType() != h_data.myElementType )
+ h->SetElementType( h_data.myElementType );
if ( (int) h_data.myGeometricMesh != DefaultGeom ) {
if ( h->GetAngleMesh() != h_data.myAngleMesh )
h->SetOptimizeMesh( h_data.myOptimizeMesh );
if ( h->GetQuadraticMesh() != h_data.myQuadraticMesh )
- h->SetQuadraticMesh( h_data.myQuadraticMesh );
+ h->SetQuadraticMesh( h_data.myQuadraticMesh );
if ( h->GetVerbosity() != h_data.myVerbosity )
h->SetVerbosity( h_data.myVerbosity );
// options are set in checkParams()
//h->SetOptionValues( myOptions ); // is set in readParamsFromWidgets()
//h->SetPreCADOptionValues( myPreCADOptions ); // is set in readParamsFromWidgets()
-
+
if ( h->GetGMFFile() != h_data.myGMFFileName )
-// || ( h->GetGMFFileMode() != h_data.myGMFFileMode ) )
-// h->SetGMFFile( h_data.myGMFFileName.c_str(), h_data.myGMFFileMode );
+ // || ( h->GetGMFFileMode() != h_data.myGMFFileMode ) )
+ // h->SetGMFFile( h_data.myGMFFileName.c_str(), h_data.myGMFFileMode );
h->SetGMFFile( h_data.myGMFFileName.c_str());
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
const QString sizeMap = i.value();
if (sizeMap == "__TO_DELETE__") {
- MESSAGE("Delete entry " << entry.toStdString() << " from engine");
h->UnsetEntry(entry.toLatin1().constData());
}
else if (sizeMap.startsWith("ATTRACTOR")) {
-// MESSAGE("SetAttractorEntry(" << entry.toStdString() << ")= " << sizeMap.toStdString());
h->SetAttractorEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData());
}
else if (sizeMap.startsWith("def")) {
-// MESSAGE("SetCustomSizeMapEntry(" << entry.toStdString() << ")= " << sizeMap.toStdString());
-// h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
+ // h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
}
else {
if (!myATTMap[entry].empty()){
fullSizeMap = QString("def f(t): return ") + sizeMap;
else if (that->mySMPShapeTypeMap[entry] == TopAbs_VERTEX)
fullSizeMap = QString("def f(): return ") + sizeMap;
- MESSAGE("SetSizeMapEntry("<<entry.toStdString()<<") = " <<fullSizeMap.toStdString());
h->SetSizeMapEntry( entry.toLatin1().constData(), fullSizeMap.toLatin1().constData() );
}
}
double x, y, z = 0;
std::string enfName;
/* TODO GROUPS
- std::string groupName = "";
+ std::string groupName = "";
*/
TFaceEntryEnfVertexListMap::const_iterator evmIt = h_data.faceEntryEnfVertexListMap.begin();
// 1. Clear all enforced vertices in hypothesis
// 2. Add new enforced vertex according to h_data
-
+
if ( h->GetAllEnforcedVertices()->length() > 0 )
h->ClearAllEnforcedVertices();
TEnfName faceEntry;
{
faceEntry = evmIt->first;
evs = evmIt->second;
- MESSAGE("Number of enforced vertices for face entry " << faceEntry << ": " << evs.size());
evsIt = evs.begin();
for ( ; evsIt != evs.end() ; ++evsIt)
{
// Periodicity
if ( h->GetPreCadFacesPeriodicityVector()->length() > 0 || h->GetPreCadEdgesPeriodicityVector()->length() > 0 )
- h->ClearPreCadPeriodicityVectors();
+ h->ClearPreCadPeriodicityVectors();
- MESSAGE("h_data.preCadPeriodicityVector.size(): " << h_data.preCadPeriodicityVector.size());
TPreCadPeriodicityVector::const_iterator pIt = h_data.preCadPeriodicityVector.begin();
for ( ; pIt != h_data.preCadPeriodicityVector.end() ; ++pIt)
+ {
+ TPreCadPeriodicity periodicity_i = *pIt;
+ TEntry source = periodicity_i[PERIODICITY_OBJ_SOURCE_COLUMN];
+ TEntry target = periodicity_i[PERIODICITY_OBJ_TARGET_COLUMN];
+ TEntry p1Source = periodicity_i[PERIODICITY_P1_SOURCE_COLUMN];
+ TEntry p2Source = periodicity_i[PERIODICITY_P2_SOURCE_COLUMN];
+ TEntry p3Source = periodicity_i[PERIODICITY_P3_SOURCE_COLUMN];
+ TEntry p1Target = periodicity_i[PERIODICITY_P1_TARGET_COLUMN];
+ TEntry p2Target = periodicity_i[PERIODICITY_P2_TARGET_COLUMN];
+ TEntry p3Target = periodicity_i[PERIODICITY_P3_TARGET_COLUMN];
+ bool onFace = (periodicity_i[PERIODICITY_SHAPE_TYPE]=="1") ? true : false;
+
+ BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
+ if (! p1Source.empty())
{
- TPreCadPeriodicity periodicity_i = *pIt;
- TEntry source = periodicity_i[PERIODICITY_OBJ_SOURCE_COLUMN];
- TEntry target = periodicity_i[PERIODICITY_OBJ_TARGET_COLUMN];
- TEntry p1Source = periodicity_i[PERIODICITY_P1_SOURCE_COLUMN];
- TEntry p2Source = periodicity_i[PERIODICITY_P2_SOURCE_COLUMN];
- TEntry p3Source = periodicity_i[PERIODICITY_P3_SOURCE_COLUMN];
- TEntry p1Target = periodicity_i[PERIODICITY_P1_TARGET_COLUMN];
- TEntry p2Target = periodicity_i[PERIODICITY_P2_TARGET_COLUMN];
- TEntry p3Target = periodicity_i[PERIODICITY_P3_TARGET_COLUMN];
- bool onFace = (periodicity_i[PERIODICITY_SHAPE_TYPE]=="1") ? true : false;
-
- BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
- if (! p1Source.empty())
- {
- sourceVertices->length(3);
- sourceVertices[0]=CORBA::string_dup(p1Source.c_str());
- sourceVertices[1]=CORBA::string_dup(p2Source.c_str());
- sourceVertices[2]=CORBA::string_dup(p3Source.c_str());
- }
-
+ sourceVertices->length(3);
+ sourceVertices[0]=CORBA::string_dup(p1Source.c_str());
+ sourceVertices[1]=CORBA::string_dup(p2Source.c_str());
+ sourceVertices[2]=CORBA::string_dup(p3Source.c_str());
+ }
- BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
- if (! p1Target.empty())
- {
- targetVertices->length(3);
- targetVertices[0]=CORBA::string_dup(p1Target.c_str());
- targetVertices[1]=CORBA::string_dup(p2Target.c_str());
- targetVertices[2]=CORBA::string_dup(p3Target.c_str());
- }
- if (onFace)
- h->AddPreCadFacesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
- else
- h->AddPreCadEdgesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
+ BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
+ if (! p1Target.empty())
+ {
+ targetVertices->length(3);
+ targetVertices[0]=CORBA::string_dup(p1Target.c_str());
+ targetVertices[1]=CORBA::string_dup(p2Target.c_str());
+ targetVertices[2]=CORBA::string_dup(p3Target.c_str());
}
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo end periodicity");
+ if (onFace)
+ h->AddPreCadFacesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
+ else
+ h->AddPreCadEdgesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
+ }
+
+ // Hyper-patches
+ BLSURFPlugin::THyperPatchList_var hpl = new BLSURFPlugin::THyperPatchList();
+ hpl->length( h_data.hyperpatches.size() );
+
+ for ( int i = 0; i < h_data.hyperpatches.size(); ++i )
+ {
+ QStringList tags = h_data.hyperpatches[i].split(" ", QString::SkipEmptyParts);
+ BLSURFPlugin::THyperPatch& patch = hpl[ i ];
+ patch.length( tags.size() );
+
+ for ( int j = 0; j < tags.size(); ++j )
+ patch[ j ] = tags[ j ].toDouble();
+ }
+ h->SetHyperPatches( hpl );
} // try
- catch(const std::exception& ex) {
- std::cout << "Exception: " << ex.what() << std::endl;
- throw ex;
- }
-// catch(const SALOME::SALOME_Exception& ex)
-// {
-// throw ex;
-// // SalomeApp_Tools::QtCatchCorbaException(ex);
-// // ok = false;
-// }
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo end");
+ catch(...) {
+ ok = false;
+ }
+
return ok;
}
/** BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets(h_data)
-Stores the widgets content to the hypothesis data.
+ Stores the widgets content to the hypothesis data.
*/
QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothesisData& h_data ) const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets");
h_data.myName = myName ? myName->text() : "";
h_data.myPhysicalMesh = myStdWidget->myPhysicalMesh->currentIndex();
h_data.myGeometricMesh = myStdWidget->myGeometricMesh->currentIndex();
h_data.myGradation = h_data.myUseGradation ? myStdWidget->myGradation->GetValue() : -1.0;
h_data.myUseVolumeGradation = myStdWidget->myUseVolumeGradation->isChecked() && !myStdWidget->myVolumeGradation->text().isEmpty();
h_data.myVolumeGradation = h_data.myUseVolumeGradation ? myStdWidget->myVolumeGradation->GetValue() : -1. ;
- h_data.myAllowQuadrangles = myStdWidget->myAllowQuadrangles->isChecked();
+ h_data.myElementType = myStdWidget->myButtonGroupElementType->checkedId();
h_data.myAngleMesh = myStdWidget->myAngleMesh->text().isEmpty() ? -1.0 : myStdWidget->myAngleMesh->GetValue();
h_data.myChordalError = myStdWidget->myChordalError->text().isEmpty() ? -1.0 : myStdWidget->myChordalError->GetValue();
h_data.myAnisotropic = myStdWidget->myAnisotropic->isChecked();
guiHyp += tr("BLSURF_MAXSIZE") + " = "+ QString::number( h_data.myMaxSize ) + "; ";
guiHyp += tr("BLSURF_MAXSIZE") + " " + tr("BLSURF_SIZE_REL") + " = " + QString(h_data.myMaxSizeRel ? "yes" : "no") + "; ";
guiHyp += tr("BLSURF_GRADATION") + " = " + QString::number( h_data.myGradation ) + "; ";
- guiHyp += tr("BLSURF_ALLOW_QUADRANGLES") + " = " + QString(h_data.myAllowQuadrangles ? "yes" : "no") + "; ";
+ guiHyp += tr("BLSURF_ELEMENT_TYPE") + " = " + QString::number(h_data.myElementType) + "; ";
guiHyp += tr("BLSURF_ANGLE_MESH") + " = " + QString::number( h_data.myAngleMesh ) + "; ";
guiHyp += tr("BLSURF_CHORDAL_ERROR") + " = " + QString::number( h_data.myChordalError ) + "; ";
guiHyp += tr("BLSURF_ANISOTROPIC") + " = " + QString(h_data.myAnisotropic ? "yes" : "no") + "; ";
int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
for ( ; row < nbRows; ++row )
{
- QString entry = mySizeMapTable->topLevelItem(row)->data(SMP_ENTRY_COLUMN ,Qt::EditRole).toString();
- if ( that->mySMPMap.contains(entry) )
- guiHyp += "SetSizeMapEntry(" + entry + ", " + that->mySMPMap[entry] + "); ";
+ QString entry = mySizeMapTable->topLevelItem(row)->data(SMP_ENTRY_COLUMN ,Qt::EditRole).toString();
+ if ( that->mySMPMap.contains(entry) )
+ guiHyp += "SetSizeMapEntry(" + entry + ", " + that->mySMPMap[entry] + "); ";
}
// Enforced vertices
h_data.faceEntryEnfVertexListMap.clear();
int nbEnforcedShapes = myEnforcedTreeWidget->topLevelItemCount();
- int nbEnforcedVertices = 0;
- std::string groupName = "";
-// MESSAGE("Nb of enforced shapes: " << nbEnforcedShapes);
- for (int i=0 ; i<nbEnforcedShapes ; i++) {
- QTreeWidgetItem* shapeItem = myEnforcedTreeWidget->topLevelItem(i);
- if (shapeItem) {
- std::string faceEntry = shapeItem->data(ENF_VER_FACE_ENTRY_COLUMN,Qt::EditRole).toString().toStdString();
- nbEnforcedVertices = shapeItem->childCount();
- if (nbEnforcedVertices >0) {
- double childValueX,childValueY,childValueZ;
- std::string childName, vertexEntry;
- QTreeWidgetItem* child;
- TEnfVertexList evs;
- evs.clear();
- for (row = 0;row<nbEnforcedVertices;row++) {
- child = shapeItem->child(row);
- childName = child->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString();
- childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
- childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
- childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
- vertexEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString().toStdString();
-// if (myGlobalGroupName->isChecked())
-// groupName = myGlobalGroupName->text().toStdString();
-// else
- groupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString().toStdString();
-
- TEnfVertex *enfVertex = new TEnfVertex();
- enfVertex->name = childName;
- if (vertexEntry.empty()) {
- enfVertex->coords.push_back(childValueX);
- enfVertex->coords.push_back(childValueY);
- enfVertex->coords.push_back(childValueZ);
- }
- else
- enfVertex->geomEntry = vertexEntry;
- enfVertex->grpName = groupName;
-// TEnfVertexList::iterator it = h_data.enfVertexList.find(enfVertex);
-// if (it == h_data.enfVertexList.end())
- h_data.enfVertexList.insert(enfVertex);
- evs.insert(enfVertex);
- /* TODO GROUPS
- if (groupName != "")
- h_data.groupNameEnfVertexListMap[groupName].insert(vertex);
- */
- }
- h_data.faceEntryEnfVertexListMap[faceEntry] = evs;
- }
+ std::string groupName = "", faceEntry = "";
+ for (int i=0 ; i<nbEnforcedShapes ; i++)
+ {
+ double childValueX,childValueY,childValueZ;
+ std::string childName, vertexEntry;
+ QTreeWidgetItem* child;
+
+ child = myEnforcedTreeWidget->topLevelItem(i);
+ childName = child->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString();
+ childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
+ childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
+ childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
+ vertexEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString().toStdString();
+ // if (myGlobalGroupName->isChecked())
+ // groupName = myGlobalGroupName->text().toStdString();
+ // else
+ groupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString().toStdString();
+
+ TEnfVertex *enfVertex = new TEnfVertex();
+ enfVertex->name = childName;
+ if (vertexEntry.empty()) {
+ enfVertex->coords.push_back(childValueX);
+ enfVertex->coords.push_back(childValueY);
+ enfVertex->coords.push_back(childValueZ);
}
+ else
+ enfVertex->geomEntry = vertexEntry;
+ enfVertex->grpName = groupName;
+ // TEnfVertexList::iterator it = h_data.enfVertexList.find(enfVertex);
+ // if (it == h_data.enfVertexList.end())
+ h_data.enfVertexList.insert(enfVertex);
+ /* TODO GROUPS
+ if (groupName != "")
+ h_data.groupNameEnfVertexListMap[groupName].insert(vertex);
+ */
+ h_data.faceEntryEnfVertexListMap[faceEntry].insert( enfVertex );
}
h_data.myInternalEnforcedVerticesAllFaces = myInternalEnforcedVerticesAllFaces->isChecked();
if (item) {
for (int k=0; k<myPeriodicityTreeWidget->columnCount(); ++k)
{
- MESSAGE(k);
std::string entry = item->data(k, Qt::UserRole).toString().toStdString();
- MESSAGE(entry);
periodicity_i.push_back(entry);
}
h_data.preCadPeriodicityVector.push_back(periodicity_i);
guiHyp += "PERIODICITY = yes; ";
}
- MESSAGE("guiHyp : " << guiHyp.toLatin1().data());
+ // Hyper-patches
+ h_data.hyperpatches.clear();
+ for ( int row = 0; row < myHyPatchTable->rowCount(); ++row )
+ h_data.hyperpatches.append( myHyPatchTable->item( row, 0 )->text() );
+
return guiHyp;
}
void BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked(QTreeWidgetItem * item, int col)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked("<<col<<")")
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
if (col == SMP_SIZEMAP_COLUMN) {
QString entry = item->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
myGeomSelWdg1 ->deactivateSelection();
myGeomSelWdg2 ->deactivateSelection();
myAttSelWdg ->deactivateSelection();
- myEnfFaceWdg ->deactivateSelection();
myEnfVertexWdg ->deactivateSelection();
myPeriodicitySourceFaceWdg->deactivateSelection();
myPeriodicityTargetFaceWdg->deactivateSelection();
myPeriodicityP1TargetWdg ->deactivateSelection();
myPeriodicityP2TargetWdg ->deactivateSelection();
myPeriodicityP3TargetWdg ->deactivateSelection();
+ if ( myHyPatchFaceSelBtn->isChecked() )
+ myHyPatchFaceSelBtn->toggle();
+ if ( myHyPatchGroupSelBtn->isChecked() )
+ myHyPatchGroupSelBtn->toggle();
return;
}
else if ( sender() == smpTab )
void BLSURFPluginGUI_HypothesisCreator::onRemoveMap()
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveMap()");
QList<int> selectedRows;
QList<QTreeWidgetItem*> selected = mySizeMapTable->selectedItems();
QTreeWidgetItem* item;
void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(QTreeWidgetItem* item, int col)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSetSizeMap("<< col << ")");
- MESSAGE("mySMPMap.size() = "<<mySMPMap.size());
if (col == SMP_SIZEMAP_COLUMN) {
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
QString entry = item->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
QString sizeMap = item->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString();
- MESSAGE("entry: " << entry.toStdString() << ", sizeMap: " << sizeMap.toStdString());
if (! that->mySMPShapeTypeMap.contains(entry))
- MESSAGE("no such entry in mySMPShapeTypeMap")
return;
if (that->mySMPMap.contains(entry))
if (that->mySMPMap[entry] == sizeMap
sizeMapValidationFromEntry(entry);
}
else {
- MESSAGE("Size map empty: reverse to precedent value" );
item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(that->mySMPMap[entry]) );
}
mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
void BLSURFPluginGUI_HypothesisCreator::onModifyMap()
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onModifyMap()");
bool res = false;
if ( smpTab->currentIndex() == ATT_TAB ){
if ( myGeomSelWdg2->IsObjectSelected() && myAttSelWdg->IsObjectSelected() ){
bool BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anObject, bool modify)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertElement()");
// BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
// BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
TopAbs_ShapeEnum shapeType;
string entry, shapeName;
entry = (string) anObject->GetStudyEntry();
- MESSAGE("entry = "<<entry);
shapeName = anObject->GetName();
shapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( anObject ).ShapeType();
// Group management : the type of entities in the group is stored in the SMPShapeTypeMap
else{
if (that->mySMPMap.contains(shapeEntry)) {
if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
- // MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")");
return false;
}
}
bool BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor, bool modify)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertAttractor()");
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
else{
// if (that->mySMPMap.contains(shapeEntry)) {
// if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
- // // MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")");
// return false;
// }
// }
myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize );
myStdWidget->onPhysicalMeshChanged();
}
- MESSAGE("mySMPMap.size() = "<<mySMPMap.size());
return true;
}
bool BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()");
int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
for ( ; row < nbRows; ++row )
if (! sizeMapValidationFromRow(row))
bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(int myRow, bool displayError)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(), row = "<<myRow);
QString myEntry = mySizeMapTable->topLevelItem( myRow )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
bool res = sizeMapValidationFromEntry(myEntry,displayError);
mySizeMapTable->setFocus();
bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEntry, bool displayError)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry()");
- MESSAGE("myEntry = "<<myEntry.toStdString())
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
if (! that->mySMPMap.contains(myEntry)) {
-// MESSAGE("Geometry with entry "<<myEntry.toStdString()<<" was not found.");
return false;
}
if (! that->mySMPShapeTypeMap.contains(myEntry)) {
-// MESSAGE("Shape type with entry "<<myEntry.toStdString()<<" was not found.");
return false;
}
string expr;
if (that->mySMPMap[myEntry].startsWith("def")) {
-// MESSAGE("custom function" );
expr = that->mySMPMap[myEntry].toStdString();
}
else if (that->mySMPMap[myEntry].startsWith("ATTRACTOR")) {
-// MESSAGE("Attractor" );
if ((that->mySMPMap[myEntry].count(QRegExp("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$")) != 1)) {
if (displayError)
PyGILState_Release(gstate);
-// MESSAGE("SizeMap expression "<<expr<<" is valid");
return true;
}
+//================================================================================
+/*!
+ * \brief SLOT: Activate selection of faces in the Viewer
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchFaceSelection(bool on)
+{
+ if ( on && myHyPatchFaceSelector->GetMainShape().IsNull() )
+ {
+ QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+ QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+ myHyPatchFaceSelector->SetGeomShapeEntry( aSubEntry, aMainEntry );
+ }
+ myHyPatchFaceSelector->setVisible( on ); // show its buttons
+ myHyPatchFaceSelector->ShowPreview( on ); // show faces in the Viewer
+ // treat selection or not
+ myHyPatchFaceSelector->ActivateSelection( on || myHyPatchGroupSelBtn->isChecked() );
+
+ if ( on )
+ myHyPatchGroupSelBtn->setChecked( false );
+}
+
+//================================================================================
+/*!
+ * \brief SLOT: Deactivate selection of faces in the Viewer
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchGroupSelection(bool on)
+{
+ if ( on && myHyPatchFaceSelector->GetMainShape().IsNull() )
+ {
+ QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+ QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+ myHyPatchFaceSelector->SetGeomShapeEntry( aSubEntry, aMainEntry );
+ }
+ if ( !myHyPatchFaceSelBtn->isChecked() )
+ {
+ myHyPatchFaceSelector->setVisible( false ); // show its buttons
+ myHyPatchFaceSelector->ShowPreview( false ); // show faces in the Viewer
+ }
+ // treat selection or not
+ myHyPatchFaceSelector->ActivateSelection( on || myHyPatchFaceSelBtn->isChecked() );
+
+ if ( on )
+ myHyPatchFaceSelBtn->setChecked( false );
+}
+
+//================================================================================
+/*!
+ * \brief SLOT: show IDs of selected faces in Tags LineEdit
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchSelectionChanged()
+{
+ QString tagString;
+ const QList<int>& tags = myHyPatchFaceSelector->GetSelectedIDs();
+ for ( int i = 0; i < tags.size(); ++i )
+ tagString += QString::number( tags[i] ) + " ";
+
+ myHyPatchTagsLE->setText( tagString );
+}
+
+//================================================================================
+/*!
+ * \brief SLOT: Add the Tags to the HyperPatch table
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchAdd()
+{
+ QStringList tagList = myHyPatchTagsLE->text().split(" ", QString::SkipEmptyParts);
+ if ( tagList.size() > 1 )
+ {
+ addHyPatchToTable( myHyPatchTagsLE->text() );
+ myHyPatchTagsLE->setText("");
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Add a row to myHyPatchTable
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::addHyPatchToTable(const QString& tags)
+{
+ if ( tags.isEmpty() ) return;
+
+ QTableWidgetItem* cell = new QTableWidgetItem( tags );
+ cell->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
+
+ int row = myHyPatchTable->rowCount();
+ myHyPatchTable->insertRow( row );
+ myHyPatchTable->setItem( row, 0, cell );
+}
+
+//================================================================================
+/*!
+ * \brief SLOT: remove selected rows from the HyperPatch table
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchRemove()
+{
+ QList<QTableWidgetItem *> items = myHyPatchTable->selectedItems();
+ while ( !items.isEmpty() )
+ {
+ myHyPatchTable->removeRow( items[0]->row() );
+ items = myHyPatchTable->selectedItems();
+ }
+}
+
+bool BLSURFPluginGUI_HypothesisCreator::hasGeom() const
+{
+ return hypType() == BLSURFPlugin_Hypothesis::GetHypType(true);
+}
+
QString BLSURFPluginGUI_HypothesisCreator::caption() const
{
return tr( "BLSURF_TITLE" );
if (entry == entryForChecking )
break;
}
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::findRowFromEntry; row = "<<row<<" , endRow ="<<endRow)
return row;
}