return GetPreCADOptionValue("tags", GET_DEFAULT());
}
//=============================================================================
+void BLSURFPlugin_Hypothesis::SetHyperPatches(const THyperPatchList& hpl)
+{
+ if ( hpl != _hyperPatchList )
+ {
+ // join patches sharing tags
+ _hyperPatchList.clear();
+ for ( size_t i = 0; i < hpl.size(); ++i )
+ {
+ const THyperPatchTags& tags = hpl[i];
+ if ( tags.size() < 2 ) continue;
+
+ std::set<int> iPatches;
+ if ( !_hyperPatchList.empty() )
+ {
+ THyperPatchTags::iterator t = tags.begin();
+ for ( ; t != tags.end(); ++t )
+ {
+ int iPatch = -1;
+ GetHyperPatchTag( *t, this, &iPatch );
+ if ( iPatch >= 0 )
+ iPatches.insert( iPatch );
+ }
+ }
+
+ if ( iPatches.empty() )
+ {
+ _hyperPatchList.push_back( tags );
+ }
+ else
+ {
+ std::set<int>::iterator iPatch = iPatches.begin();
+ THyperPatchTags& mainPatch = _hyperPatchList[ *iPatch ];
+ mainPatch.insert( tags.begin(), tags.end() );
+
+ for ( ++iPatch; iPatch != iPatches.end(); ++iPatch )
+ {
+ mainPatch.insert( _hyperPatchList[ *iPatch ].begin(), _hyperPatchList[ *iPatch ].end() );
+ _hyperPatchList[ *iPatch ].clear();
+ }
+ if ( iPatches.size() > 1 )
+ for ( int j = _hyperPatchList.size()-1; j > 0; --j )
+ if ( _hyperPatchList[j].empty() )
+ _hyperPatchList.erase( _hyperPatchList.begin() + j );
+ }
+ }
+ NotifySubMeshesHypothesisModification();
+ }
+}
+//=============================================================================
+/*!
+ * \brief Return a tag of a face taking into account the hyper-patches. Optionally
+ * return an index of a patch including the face
+ */
+//================================================================================
+
+int BLSURFPlugin_Hypothesis::GetHyperPatchTag( const int faceTag,
+ const BLSURFPlugin_Hypothesis* hyp,
+ int* iPatch)
+{
+ if ( hyp )
+ {
+ const THyperPatchList& hpl = hyp->_hyperPatchList;
+ for ( size_t i = 0; i < hpl.size(); ++i )
+ if ( hpl[i].count( faceTag ))
+ {
+ if ( iPatch ) *iPatch = i;
+ return *( hpl[i].begin() );
+ }
+ }
+ return faceTag;
+}
+//=============================================================================
void BLSURFPlugin_Hypothesis::SetPreCADMergeEdges(bool theVal)
{
if (theVal != ToBool( GetPreCADOptionValue("merge_edges", GET_DEFAULT()))) {
!hyp->_facesPeriodicityVector.empty() ||
!hyp->_edgesPeriodicityVector.empty() ||
!hyp->_verticesPeriodicityVector.empty() ||
+ !hyp->GetHyperPatches().empty() ||
hyp->GetTopology() != FromCAD );
}
//function : AddPreCadFacesPeriodicity
//=======================================================================
void BLSURFPlugin_Hypothesis::AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
- std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries) {
+ std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries) {
TPreCadPeriodicity preCadFacesPeriodicity;
preCadFacesPeriodicity.shape1Entry = theFace1Entry;
}
//=============================================================================
-std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
- // We must keep at least the same number of arguments when increasing the SALOME version
- // When MG-CADSurf becomes CADMESH, some parameters were fused into a single one. Thus the same
- // parameter can be written several times to keep the old global number of parameters.
+std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save)
+{
+ // We must keep at least the same number of arguments when increasing the SALOME version
+ // When MG-CADSurf becomes CADMESH, some parameters were fused into a single one. Thus the same
+ // parameter can be written several times to keep the old global number of parameters.
+
+ // Treat old options which are now in the advanced options
+ TOptionValues::iterator op_val;
+ int _decimesh = -1;
+ int _preCADRemoveNanoEdges = -1;
+ double _preCADEpsNano = -1.0;
+ op_val = _option2value.find("respect_geometry");
+ if (op_val != _option2value.end()) {
+ std::string value = op_val->second;
+ if (!value.empty())
+ _decimesh = value.compare("1") == 0 ? 1 : 0;
+ }
+ op_val = _preCADoption2value.find("remove_tiny_edges");
+ if (op_val != _preCADoption2value.end()) {
+ std::string value = op_val->second;
+ if (!value.empty())
+ _preCADRemoveNanoEdges = value.compare("1") == 0 ? 1 : 0;
+ }
+ op_val = _preCADoption2value.find("tiny_edge_length");
+ if (op_val != _preCADoption2value.end()) {
+ std::string value = op_val->second;
+ if (!value.empty())
+ _preCADEpsNano = strtod(value.c_str(), NULL);
+ }
- // Treat old options which are now in the advanced options
- TOptionValues::iterator op_val;
- int _decimesh = -1;
- int _preCADRemoveNanoEdges = -1;
- double _preCADEpsNano = -1.0;
- op_val = _option2value.find("respect_geometry");
- if (op_val != _option2value.end()) {
- std::string value = op_val->second;
- if (!value.empty())
- _decimesh = value.compare("1") == 0 ? 1 : 0;
- }
- op_val = _preCADoption2value.find("remove_tiny_edges");
- if (op_val != _preCADoption2value.end()) {
- std::string value = op_val->second;
- if (!value.empty())
- _preCADRemoveNanoEdges = value.compare("1") == 0 ? 1 : 0;
- }
- op_val = _preCADoption2value.find("tiny_edge_length");
- if (op_val != _preCADoption2value.end()) {
- std::string value = op_val->second;
- if (!value.empty())
- _preCADEpsNano = strtod(value.c_str(), NULL);
- }
-
save << " " << (int) _topology << " " << (int) _physicalMesh << " " << (int) _geometricMesh << " " << _phySize << " "
- << _angleMesh << " " << _gradation << " " << (int) _quadAllowed << " " << _decimesh;
+ << _angleMesh << " " << _gradation << " " << (int) _quadAllowed << " " << _decimesh;
save << " " << _minSize << " " << _maxSize << " " << _angleMesh << " " << _minSize << " " << _maxSize << " " << _verb;
save << " " << (int) _preCADMergeEdges << " " << _preCADRemoveNanoEdges << " " << (int) _preCADDiscardInput << " " << _preCADEpsNano ;
save << " " << (int) _enforcedInternalVerticesAllFaces;
SaveEdgesPeriodicity(save);
SaveVerticesPeriodicity(save);
+ // HYPER-PATCHES
+ save << " " << _hyperPatchList.size() << " ";
+ for ( size_t i = 0; i < _hyperPatchList.size(); ++i )
+ {
+ THyperPatchTags& patch = _hyperPatchList[i];
+ save << patch.size() << " ";
+ THyperPatchTags::iterator tag = patch.begin();
+ for ( ; tag != patch.end(); ++tag )
+ save << *tag << " ";
+ }
+
return save;
}
}
//=============================================================================
-std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
+std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load)
+{
bool isOK = true;
int i;
double val;
// __ENFORCED_VERTICES_BEGIN__
// __BEGIN_VERTEX__ => no name, no entry
// __BEGIN_GROUP__ mon groupe __END_GROUP__
-// __BEGIN_COORDS__ 10 10 10 __END_COORDS__
-// __BEGIN_FACELIST__ 0:1:1:1:1 __END_FACELIST__
-// __END_VERTEX__
+// __BEGIN_COORDS__ 10 10 10 __END_COORDS__
+// __BEGIN_FACELIST__ 0:1:1:1:1 __END_FACELIST__
+// __END_VERTEX__
// __BEGIN_VERTEX__ => no coords
-// __BEGIN_NAME__ mes points __END_NAME__
+// __BEGIN_NAME__ mes points __END_NAME__
// __BEGIN_ENTRY__ 0:1:1:4 __END_ENTRY__
// __BEGIN_GROUP__ mon groupe __END_GROUP__
// __BEGIN_FACELIST__ 0:1:1:1:3 __END_FACELIST__
-// __END_VERTEX__
+// __END_VERTEX__
// __ENFORCED_VERTICES_END__
-//
+//
std::string enfSeparator;
std::string enfName;
TEntryList enfFaceEntryList;
double enfCoords[3];
bool hasCoords = false;
-
+
_faceEntryEnfVertexListMap.clear();
_enfVertexList.clear();
_faceEntryCoordsListMap.clear();
_coordsEnfVertexMap.clear();
_faceEntryEnfVertexEntryListMap.clear();
_enfVertexEntryEnfVertexMap.clear();
-
-
- while (isOK && hasEnforcedVertex) {
+
+
+ while (isOK && hasEnforcedVertex)
+ {
isOK = static_cast<bool>(load >> enfSeparator); // __BEGIN_VERTEX__
TEnfVertex *enfVertex = new TEnfVertex();
if (enfSeparator == "__ENFORCED_VERTICES_END__")
break; // __ENFORCED_VERTICES_END__
if (enfSeparator != "__BEGIN_VERTEX__")
throw std::exception();
-
+
while (isOK) {
isOK = static_cast<bool>(load >> enfSeparator);
if (enfSeparator == "__END_VERTEX__") {
-
+
enfVertex->name = enfName;
enfVertex->geomEntry = enfGeomEntry;
enfVertex->grpName = enfGroup;
if (hasCoords)
enfVertex->coords.assign(enfCoords,enfCoords+3);
enfVertex->faceEntries = enfFaceEntryList;
-
+
_enfVertexList.insert(enfVertex);
-
+
if (enfVertex->coords.size()) {
_coordsEnfVertexMap[enfVertex->coords] = enfVertex;
for (TEntryList::const_iterator it = enfVertex->faceEntries.begin() ; it != enfVertex->faceEntries.end(); ++it) {
_faceEntryEnfVertexListMap[(*it)].insert(enfVertex);
}
}
-
+
enfName.clear();
enfGeomEntry.clear();
enfGroup.clear();
hasCoords = false;
break; // __END_VERTEX__
}
-
+
if (enfSeparator == "__BEGIN_NAME__") { // __BEGIN_NAME__
while (isOK && (enfSeparator != "__END_NAME__")) {
isOK = static_cast<bool>(load >> enfSeparator);
}
}
}
-
+
if (enfSeparator == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
isOK = static_cast<bool>(load >> enfGeomEntry);
isOK = static_cast<bool>(load >> enfSeparator); // __END_ENTRY__
if (enfSeparator != "__END_ENTRY__")
throw std::exception();
}
-
+
if (enfSeparator == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
while (isOK && (enfSeparator != "__END_GROUP__")) {
isOK = static_cast<bool>(load >> enfSeparator);
}
}
}
-
+
if (enfSeparator == "__BEGIN_COORDS__") { // __BEGIN_COORDS__
hasCoords = true;
isOK = static_cast<bool>(load >> enfCoords[0] >> enfCoords[1] >> enfCoords[2]);
isOK = static_cast<bool>(load >> enfSeparator); // __END_COORDS__
if (enfSeparator != "__END_COORDS__")
throw std::exception();
- }
-
+ }
+
if (enfSeparator == "__BEGIN_FACELIST__") { // __BEGIN_FACELIST__
while (isOK && (enfSeparator != "__END_FACELIST__")) {
isOK = static_cast<bool>(load >> enfSeparator);
enfFaceEntryList.insert(enfSeparator);
}
}
- }
+ }
}
}
// PERIODICITY
- if (hasPreCADFacesPeriodicity){
+ if (hasPreCADFacesPeriodicity)
+ {
LoadPreCADPeriodicity(load, "FACES");
isOK = static_cast<bool>(load >> option_or_sm);
}
}
- if (hasPreCADEdgesPeriodicity){
+ if (hasPreCADEdgesPeriodicity)
+ {
LoadPreCADPeriodicity(load, "EDGES");
isOK = static_cast<bool>(load >> option_or_sm);
}
}
- if (hasFacesPeriodicity){
- LoadFacesPeriodicity(load);
+ if (hasFacesPeriodicity)
+ {
+ LoadFacesPeriodicity(load);
isOK = static_cast<bool>(load >> option_or_sm);
if (isOK) {
}
}
- if (hasEdgesPeriodicity){
- LoadEdgesPeriodicity(load);
+ if (hasEdgesPeriodicity)
+ {
+ LoadEdgesPeriodicity(load);
isOK = static_cast<bool>(load >> option_or_sm);
if (isOK)
}
if (hasVerticesPeriodicity)
- LoadVerticesPeriodicity(load);
+ LoadVerticesPeriodicity(load);
+
+ // HYPER-PATCHES
+ if ( !option_or_sm.empty() && option_or_sm[0] == '_' )
+ isOK = static_cast<bool>(load >> option_or_sm);
+ if ( isOK && !option_or_sm.empty() )
+ {
+ int nbPatches = atoi( option_or_sm.c_str() );
+ if ( nbPatches >= 0 )
+ {
+ _hyperPatchList.resize( nbPatches );
+ for ( int iP = 0; iP < nbPatches && isOK; ++iP )
+ {
+ isOK = static_cast<bool>(load >> i) && i >= 2;
+ if ( !isOK ) break;
+ int nbTags = i;
+ for ( int iT = 0; iT < nbTags; ++iT )
+ {
+ if (( isOK = static_cast<bool>(load >> i)))
+ _hyperPatchList[ iP ].insert( i );
+ else
+ break;
+ }
+ }
+ if ( !isOK ) // remove invalid patches
+ {
+ for ( i = nbPatches - 1; i >= 0; i-- )
+ if ( _hyperPatchList[i].size() < 2 )
+ _hyperPatchList.resize( i );
+ }
+ }
+ }
return load;
}
}
}
-void BLSURFPlugin_Hypothesis::LoadVerticesPeriodicity(std::istream & load){
-
+void BLSURFPlugin_Hypothesis::LoadVerticesPeriodicity(std::istream & load)
+{
bool isOK = true;
std::string periodicitySeparator;
#include "BLSURFPluginGUI_HypothesisCreator.h"
#include "BLSURFPluginGUI_Dlg.h"
-#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,
QFrame* 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 );
}
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);
//Layout
QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
// Enforced vertices parameters
myEnfGroup = new QWidget();
QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
-//
-// myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced(myEnfGroup);
-// anEnfLayout->addWidget(myEnforcedVertexWidget);
-// 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 );
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(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
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" ) );
+ myTabWidget->insertTab( HYPERPATCH_TAB, hpGroup, tr( "BLSURF_HYPERPATCH_TAB" ));
myTabWidget->setCurrentIndex( STD_TAB );
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) {
QVariant vertexName = item->data(ENF_VER_NAME_COLUMN, Qt::EditRole);
/** BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
This method is called when a item is added into the enforced vertices tree widget
*/
-void 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 < selEnfVertex + !coordsEmpty; 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)
{
}
}
- //myEnfFaceWdg->SetObject(GEOM::GEOM_Object::_nil());
myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
else
{
item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant( sizeMap ) );
- }
+ }
}
mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
for ( ; evmIt != data.faceEntryEnfVertexListMap.end() ; ++evmIt) {
TEntry entry = (*evmIt).first;
std::string shapeName = myGeomToolSelected->getNameFromEntry(entry);
-
+
//QTreeWidgetItem* faceItem = that->addEnforcedFace(entry, shapeName);
TEnfVertexList evs = (*evmIt).second;
that->addEnforcedVertex(x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName);
}
}
-
+
for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
myEnforcedTreeWidget->resizeColumnToContents(column);
// 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();
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;
}
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;
h->SetAttractorEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData());
}
else if (sizeMap.startsWith("def")) {
-// h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
+ // h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
}
else {
if (!myATTMap[entry].empty()){
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;
// Periodicity
if ( h->GetPreCadFacesPeriodicityVector()->length() > 0 || h->GetPreCadEdgesPeriodicityVector()->length() > 0 )
- h->ClearPreCadPeriodicityVectors();
+ h->ClearPreCadPeriodicityVectors();
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());
}
+ 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;
-// }
+ 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
{
guiHyp += "PERIODICITY = yes; ";
}
+ // 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;
}
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 )
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();
+ }
+}
+
QString BLSURFPluginGUI_HypothesisCreator::caption() const
{
return tr( "BLSURF_TITLE" );
class LightApp_SelectionMgr;
class BLSURFPluginGUI_StdWidget;
class BLSURFPluginGUI_AdvWidget;
+class StdMeshersGUI_SubShapeSelectorWdg;
// class DlgBlSurfHyp_Enforced;
// Name
TGroupNameEnfVertexListMap groupNameEnfVertexListMap;
*/
TPreCadPeriodicityVector preCadPeriodicityVector;
+ QStringList hyperpatches;
QString myName;
} BlsurfHypothesisData;
void onStateChange();
// Advanced tab
void onAddOption();
-// void onDeleteOption();
-// void onEditOption( int, int );
void onChangeOptionName( int, int );
-// void onOptionChosenInPopup( QAction* );
// Sizemap tab
void onMapGeomContentModified();
void onSmpItemClicked( QTreeWidgetItem *, int );
// Enforced vertices tab
QTreeWidgetItem* addEnforcedFace(std::string theFaceEntry, std::string theFaceName);
void addEnforcedVertex(double x=0, double y=0, double z=0,
- std::string vertexName = "", std::string geomEntry = "", std::string groupName = "");
+ std::string vertexName = "",
+ std::string geomEntry = "",
+ std::string groupName = "");
void onAddEnforcedVertices();
void onRemoveEnforcedVertex();
void synchronizeCoords();
void updateEnforcedVertexValues(QTreeWidgetItem* , int );
void onSelectEnforcedVertex();
-// void deactivateSelection(QWidget*, QWidget*);
void clearEnforcedVertexWidgets();
void onInternalVerticesClicked(int);
// Periodicity tab
void onPeriodicityByVerticesChecked(bool);
-// void onPeriodicityRadioButtonChanged();
void onAddPeriodicity();
void onRemovePeriodicity();
void onPeriodicityTreeClicked(QTreeWidgetItem*, int);
void onPeriodicityContentModified();
+ // HyperPatch tab
+ void onHyPatchFaceSelection(bool);
+ void onHyPatchGroupSelection(bool);
+ void onHyPatchSelectionChanged();
+ void onHyPatchAdd();
+ void onHyPatchRemove();
private:
bool readParamsFromHypo( BlsurfHypothesisData& ) const;
static LightApp_SelectionMgr* selectionMgr();
void avoidSimultaneousSelection(ListOfWidgets &myCustomWidgets) const;
void AddPreCadSequenceToVector(BlsurfHypothesisData& h_data, BLSURFPlugin::TPeriodicityList_var preCadFacePeriodicityVector, bool onFace) const;
+ void addHyPatchToTable(const QString& tags);
private:
QWidget* myEnfGroup;
-// TODO FACE AND VERTEX SELECTION
StdMeshersGUI_ObjectReferenceParamWdg *myEnfFaceWdg;
GEOM::GEOM_Object_var myEnfFace;
StdMeshersGUI_ObjectReferenceParamWdg *myEnfVertexWdg;
GEOM::GEOM_Object_var myEnfVertex;
-// DlgBlSurfHyp_Enforced* myEnforcedVertexWidget;
QTreeWidget* myEnforcedTreeWidget;
SMESHGUI_SpinBox* myXCoord;
SMESHGUI_SpinBox* myYCoord;
SMESHGUI_SpinBox* myZCoord;
QLineEdit* myGroupName;
-// QGroupBox* makeGroupsCheck;
-// QCheckBox* myGlobalGroupName;
QPushButton* addVertexButton;
QPushButton* removeVertexButton;
// map = entry , size map
QMap<QString, QString> mySMPMap; // Map <face entry, size>
QMap<QString, TAttractorVec > myATTMap; // Map <face entry, att. entry, etc>
- // QMap<QString, double> myDistMap; // Map <entry,distance with constant size>
- // QMap<QString, double> myAttDistMap; // Map <entry, influence distance>
QMap<QString, TopAbs_ShapeEnum> mySMPShapeTypeMap;
GeomSelectionTools* GeomToolSelected;
LightApp_SelectionMgr* aSel;
// Periodicity
- QWidget* myPeriodicityGroup;
- QSplitter* myPeriodicitySplitter;
- QTreeWidget* myPeriodicityTreeWidget;
- QWidget* myPeriodicityRightWidget;
- QGridLayout* myPeriodicityRightGridLayout;
- QGroupBox* myPeriodicityGroupBox1;
- QGroupBox* myPeriodicityGroupBox2;
+ QWidget* myPeriodicityGroup;
+ QSplitter* myPeriodicitySplitter;
+ QTreeWidget* myPeriodicityTreeWidget;
+ QWidget* myPeriodicityRightWidget;
+ QGridLayout* myPeriodicityRightGridLayout;
+ QGroupBox* myPeriodicityGroupBox1;
+ QGroupBox* myPeriodicityGroupBox2;
QGridLayout* aPeriodicityLayout1;
- QGridLayout* myPeriodicityGroupBox1Layout;
- QGridLayout* myPeriodicityGroupBox2Layout;
+ QGridLayout* myPeriodicityGroupBox1Layout;
+ QGridLayout* myPeriodicityGroupBox2Layout;
QRadioButton* myPeriodicityOnFaceRadioButton;
QRadioButton* myPeriodicityOnEdgeRadioButton;
- QLabel* myPeriodicityMainSourceLabel;
- QLabel* myPeriodicityMainTargetLabel;
- QLabel* myPeriodicitySourceLabel;
- QLabel* myPeriodicityTargetLabel;
+ QLabel* myPeriodicityMainSourceLabel;
+ QLabel* myPeriodicityMainTargetLabel;
+ QLabel* myPeriodicitySourceLabel;
+ QLabel* myPeriodicityTargetLabel;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicitySourceFaceWdg;
-// StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicitySourceEdgeWdg;
GEOM::GEOM_Object_var myPeriodicityFace;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityTargetFaceWdg;
-// StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityTargetEdgeWdg;
GEOM::GEOM_Object_var myPeriodicityEdge;
- QLabel* myPeriodicityP1SourceLabel;
- QLabel* myPeriodicityP2SourceLabel;
- QLabel* myPeriodicityP3SourceLabel;
- QLabel* myPeriodicityP1TargetLabel;
- QLabel* myPeriodicityP2TargetLabel;
- QLabel* myPeriodicityP3TargetLabel;
+ QLabel* myPeriodicityP1SourceLabel;
+ QLabel* myPeriodicityP2SourceLabel;
+ QLabel* myPeriodicityP3SourceLabel;
+ QLabel* myPeriodicityP1TargetLabel;
+ QLabel* myPeriodicityP2TargetLabel;
+ QLabel* myPeriodicityP3TargetLabel;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP1SourceWdg;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP2SourceWdg;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP3SourceWdg;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP2TargetWdg;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP3TargetWdg;
ListOfWidgets myPeriodicitySelectionWidgets;
- QPushButton* myPeriodicityAddButton;
- QPushButton* myPeriodicityRemoveButton;
- QSpacerItem* myPeriodicityVerticalSpacer;
+ QPushButton* myPeriodicityAddButton;
+ QPushButton* myPeriodicityRemoveButton;
+ QSpacerItem* myPeriodicityVerticalSpacer;
+
+ QTableWidget* myHyPatchTable;
+ StdMeshersGUI_SubShapeSelectorWdg* myHyPatchFaceSelector;
+ QLineEdit* myHyPatchTagsLE;
+ QPushButton* myHyPatchFaceSelBtn;
+ QPushButton* myHyPatchGroupSelBtn;
BLSURFPlugin::string_array_var myOptions, myPreCADOptions, myCustomOptions;