From 48726a4d5ad7aa7c09997e9e7d5e6bffe614c9df Mon Sep 17 00:00:00 2001 From: gdd Date: Thu, 28 Jul 2011 16:50:11 +0000 Subject: [PATCH] Add export to .mesh file at computation if a file name is given. --- idl/BLSURFPlugin_Algorithm.idl | 9 +- src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx | 29 +++- src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx | 18 ++- src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx | 13 +- .../BLSURFPlugin_Hypothesis_i.cxx | 54 +++++++ .../BLSURFPlugin_Hypothesis_i.hxx | 8 + src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx | 144 ++++++++++++------ src/GUI/BLSURFPluginGUI_HypothesisCreator.h | 6 + src/GUI/BLSURFPlugin_msg_en.ts | 16 ++ src/GUI/BLSURFPlugin_msg_fr.ts | 16 ++ 10 files changed, 261 insertions(+), 52 deletions(-) diff --git a/idl/BLSURFPlugin_Algorithm.idl b/idl/BLSURFPlugin_Algorithm.idl index 10ec2f0..b77fcd4 100644 --- a/idl/BLSURFPlugin_Algorithm.idl +++ b/idl/BLSURFPlugin_Algorithm.idl @@ -377,7 +377,14 @@ module BLSURFPlugin raises (SALOME::SALOME_Exception); */ /////////////////////// - + + /*! + * Sets the file for export resulting mesh in GMF format + */ +// void SetGMFFile(in string theFileName, in boolean isBinary); + void SetGMFFile(in string theFileName); + string GetGMFFile(); +// boolean GetGMFFileMode(); }; }; diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 9d888ae..17ddf40 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -1148,7 +1148,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) cad_face_set_orientation(fce, CAD_ORIENTATION_FORWARD); } - if (HasSizeMapOnFace){ + if (HasSizeMapOnFace && !use_precad){ // MESSAGE("A size map is defined on a face") // std::cout << "A size map is defined on a face" << std::endl; // Classic size map @@ -1409,7 +1409,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) if(!cleanc){ cout << "Unable to retrieve PreCAD result \n"; } - + cout << "PreCAD processing successfull \n"; // Now we can delete the PreCAD session precad_session_delete(pcs); } @@ -1481,6 +1481,30 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) //return false; } + std::string GMFFileName = _hypothesis->GetGMFFile(); + if (GMFFileName != "") { +// bool GMFFileMode = _hypothesis->GetGMFFileMode(); + bool asciiFound = (GMFFileName.find(".mesh",GMFFileName.length()-5) != std::string::npos); + bool binaryFound = (GMFFileName.find(".meshb",GMFFileName.length()-6) != std::string::npos); + if (!asciiFound && !binaryFound) + GMFFileName.append(".mesh"); + /* + if (GMFFileMode) { + if (!binaryFound) { + if (asciiFound) + GMFFileName.append("b"); + else + GMFFileName.append(".meshb"); + } + } + else { + if (!asciiFound) + GMFFileName.append(".mesh"); + } + */ + mesh_write_mesh(msh, GMFFileName.c_str()); + } + /* retrieve mesh data (see distene/mesh.h) */ integer nv, ne, nt, nq, vtx[4], tag; real xyz[3]; @@ -1675,6 +1699,7 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) FacesWithEnforcedVertices.Statistics(std::cout); */ + MESSAGE("END OF BLSURFPlugin_BLSURF::Compute()"); return true; } diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx index 7fb73c9..838d435 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx @@ -76,7 +76,10 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G { _name = "BLSURF_Parameters"; _param_algo_dim = 2; - + + _GMFFileName = ""; // no GMF export +// _GMFFileMode = false; // GMF ascii mode + // to disable writing boundaries //_phyMin = _phyMax = _hgeoMin = _hgeoMax = undefinedDouble(); @@ -268,6 +271,7 @@ void BLSURFPlugin_Hypothesis::SetVerbosity(int theVal) { //============================================================================= void BLSURFPlugin_Hypothesis::SetPreCADOptimCAD(bool theVal) { if (theVal != _preCADOptimCAD) { + SetTopology(PreCAD); _preCADOptimCAD = theVal; NotifySubMeshesHypothesisModification(); } @@ -276,6 +280,7 @@ void BLSURFPlugin_Hypothesis::SetPreCADOptimCAD(bool theVal) { //============================================================================= void BLSURFPlugin_Hypothesis::SetPreCADDiscardInput(bool theVal) { if (theVal != _preCADDiscardInput) { + SetTopology(PreCAD); _preCADDiscardInput = theVal; NotifySubMeshesHypothesisModification(); } @@ -284,6 +289,7 @@ void BLSURFPlugin_Hypothesis::SetPreCADDiscardInput(bool theVal) { //============================================================================= void BLSURFPlugin_Hypothesis::SetPreCADManifoldGeom(bool theVal) { if (theVal != _preCADManifoldGeom) { + SetTopology(PreCAD); _preCADManifoldGeom = theVal; NotifySubMeshesHypothesisModification(); } @@ -292,11 +298,21 @@ void BLSURFPlugin_Hypothesis::SetPreCADManifoldGeom(bool theVal) { //============================================================================= void BLSURFPlugin_Hypothesis::SetPreCADClosedGeom(bool theVal) { if (theVal != _preCADClosedGeom) { + SetTopology(PreCAD); _preCADClosedGeom = theVal; NotifySubMeshesHypothesisModification(); } } +//============================================================================= +// void BLSURFPlugin_Hypothesis::SetGMFFile(const std::string& theFileName, bool isBinary) +void BLSURFPlugin_Hypothesis::SetGMFFile(const std::string& theFileName) +{ + _GMFFileName = theFileName; +// _GMFFileMode = isBinary; + NotifySubMeshesHypothesisModification(); +} + //============================================================================= void BLSURFPlugin_Hypothesis::SetOptionValue(const std::string& optionName, const std::string& optionValue) throw (std::invalid_argument) { diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx index c268148..493c18b 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx @@ -286,7 +286,7 @@ public: static bool GetDefaultDecimesh(); static int GetDefaultVerbosity() { return 10; } // PreCAD - static bool GetDefaultPreCADOptimCAD() { return false; } + static bool GetDefaultPreCADOptimCAD() { return true; } static bool GetDefaultPreCADDiscardInput() { return false; } static bool GetDefaultPreCADManifoldGeom() { return false; } static bool GetDefaultPreCADClosedGeom() { return false; } @@ -318,6 +318,14 @@ public: void ClearOption(const std::string& optionName); const TOptionValues& GetOptionValues() const { return _option2value; } + /*! + * Sets the file for export resulting mesh in GMF format + */ +// void SetGMFFile(const std::string& theFileName, bool isBinary); + void SetGMFFile(const std::string& theFileName); + std::string GetGMFFile() const { return _GMFFileName; } +// bool GetGMFFileMode() const { return _GMFFileMode; } + // Persistence virtual std::ostream & SaveTo(std::ostream & save); virtual std::istream & LoadFrom(std::istream & load); @@ -373,6 +381,9 @@ private: TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap; TGroupNameNodeIDMap _groupNameNodeIDMap; + std::string _GMFFileName; +// bool _GMFFileMode; + /* TODO GROUPS TGroupNameEnfVertexListMap _groupNameEnfVertexListMap; */ diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx index 882e698..48c353d 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx @@ -2047,6 +2047,60 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEn /////////////////////// +//================================================================================ +/*! + * \brief Sets the file for export resulting mesh in GMF format + * \param theFileName - full name of the file (.mesh, .meshb) + * + * After compute, export the resulting mesh in the given file with the GMF format (.mesh) + */ +//================================================================================ +// void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) { +void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) { + ASSERT(myBaseImpl); + MESSAGE("IDL : SetGMFFile(" << theFileName << ")"); + bool valueChanged/*, modeChanged*/ = false; + try { + valueChanged = (this->GetImpl()->GetGMFFile() != theFileName); +// modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary); + if (valueChanged)// or (!valueChanged && modeChanged)) + this->GetImpl()->SetGMFFile(theFileName);// ,isBinary); + } catch (const std::exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + if (valueChanged)// or (!valueChanged && modeChanged)) + SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")"; + MESSAGE("IDL : SetGMFFile END "); +} + +//================================================================================ +/*! + * \brief Gets the file name for export resulting mesh in GMF format + * \retval char* - The file name + * + * Returns the GMF file name + */ +//================================================================================ +char* BLSURFPlugin_Hypothesis_i::GetGMFFile() { + ASSERT(myBaseImpl); + MESSAGE("IDL : GetGMFFile()"); + return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str()); +} + +// //================================================================================ +// /*! +// * \brief Gets the file mode for export resulting mesh in GMF format +// * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode +// * +// * Returns the GMF file mode +// */ +// //================================================================================ +// CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() { +// ASSERT(myBaseImpl); +// MESSAGE("IDL : GetGMFFileMode()"); +// return this->GetImpl()->GetGMFFileMode(); +// } + //============================================================================= /*! * BLSURFPlugin_Hypothesis_i::GetImpl diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx index f4f8ecb..9fd864f 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx @@ -220,6 +220,14 @@ public: char* GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception); */ /////////////////////// + + /*! + * Sets the file for export resulting mesh in GMF format + */ +// void SetGMFFile(const char* theFileName, CORBA::Boolean isBinary); + void SetGMFFile(const char* theFileName); + char* GetGMFFile(); +// CORBA::Boolean GetGMFFileMode(); // Get implementation ::BLSURFPlugin_Hypothesis* GetImpl(); diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index 249a9d1..f954a3c 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -776,6 +777,7 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() myPreCADGroupBox->setEnabled(false); QGridLayout* aPreCADGroupLayout = new QGridLayout(myPreCADGroupBox); myPreCADOptimCAD = new QCheckBox(tr("BLSURF_PRECAD_OPTIM_CAD"),myPreCADGroupBox); + myPreCADOptimCAD->setChecked(true); aPreCADGroupLayout->addWidget(myPreCADOptimCAD); myPreCADDiscardInput = new QCheckBox(tr("BLSURF_PRECAD_DISCARD_INPUT"),myPreCADGroupBox); aPreCADGroupLayout->addWidget(myPreCADDiscardInput); @@ -784,6 +786,9 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() myPreCADClosedGeom = new QCheckBox(tr("BLSURF_PRECAD_CLOSED_GEOM"),myPreCADGroupBox); aPreCADGroupLayout->addWidget(myPreCADClosedGeom); + QPushButton* chooseGMFBtn = new QPushButton( tr( "BLSURF_GMF_FILE" ), myAdvGroup ); + myGMFFileName = new QLineEdit(myAdvGroup); +// myGMFFileMode = new QCheckBox(tr("BLSURF_GMF_MODE"),myAdvGroup); // ADD WIDGETS (ADVANCED TAB) anAdvLayout->addWidget( new QLabel( tr( "BLSURF_VERBOSITY" ), myAdvGroup ), 0, 0, 1, 1 ); @@ -793,9 +798,11 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() anAdvLayout->addWidget( myPreCADGroupBox , 2, 0, 1, 2 ); anAdvLayout->addWidget( addBtn, 0, 2, 1, 1 ); anAdvLayout->addWidget( rmBtn, 0, 3, 1, 1 ); - anAdvLayout->addWidget( myOptionTable, 1, 2, 2, 2 ); - anAdvLayout->setColumnStretch(2,0); - anAdvLayout->setRowStretch(3,1); + anAdvLayout->addWidget( myOptionTable, 1, 2, 3, 2 ); + anAdvLayout->addWidget( chooseGMFBtn, 3, 0, 1, 1 ); + anAdvLayout->addWidget( myGMFFileName, 3, 1, 1, 1 ); +// anAdvLayout->addWidget( myGMFFileMode, 4, 0, 1, 2 ); + anAdvLayout->setRowStretch(4,1); // Size Maps parameters @@ -1042,24 +1049,12 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() // --- connect( myGeometricMesh, SIGNAL( activated( int ) ), this, SLOT( onGeometricMeshChanged() ) ); connect( myPhysicalMesh, SIGNAL( activated( int ) ), this, SLOT( onPhysicalMeshChanged() ) ); + connect( myTopology, SIGNAL( activated( int ) ), this, SLOT( onTopologyChanged( int ) ) ); connect( addBtn->menu(), SIGNAL( aboutToShow() ), this, SLOT( onAddOption() ) ); connect( addBtn->menu(), SIGNAL( triggered( QAction* ) ), this, SLOT( onOptionChosenInPopup( QAction* ) ) ); connect( rmBtn, SIGNAL( clicked()), this, SLOT( onDeleteOption() ) ); + connect( chooseGMFBtn, SIGNAL( clicked()), this, SLOT( onChooseGMFFile() ) ); - connect( myEnforcedTreeWidget,SIGNAL( itemClicked(QTreeWidgetItem *, int)), this, SLOT( synchronizeCoords() ) ); - connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this, SLOT( updateEnforcedVertexValues(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( myEnfVertexWdg, SIGNAL( selectionActivated()), this, SLOT( onVertexSelectionActivated() ) ); -// connect( myEnfFaceWdg, SIGNAL( selectionActivated()), this, SLOT( onFaceSelectionActivated() ) ); -// connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(deactivateSelection(QWidget*, QWidget*))); - connect( myGeometricMesh, SIGNAL( activated( int ) ), this, SLOT( onGeometricMeshChanged() ) ); - connect( myPhysicalMesh, SIGNAL( activated( int ) ), this, SLOT( onPhysicalMeshChanged() ) ); - connect( addBtn->menu(), SIGNAL( aboutToShow() ), this, SLOT( onAddOption() ) ); - connect( addBtn->menu(), SIGNAL( triggered( QAction* ) ), this, SLOT( onOptionChosenInPopup( QAction* ) ) ); - connect( rmBtn, SIGNAL( clicked()), this, SLOT( onDeleteOption() ) ); // Size Maps connect( addMapButton, SIGNAL( clicked()), this, SLOT( onAddMap() ) ); connect( removeMapButton, SIGNAL( clicked()), this, SLOT( onRemoveMap() ) ); @@ -1076,11 +1071,14 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() // 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( myEnfVertexWdg, SIGNAL( selectionActivated()), this, SLOT( onVertexSelectionActivated() ) ); +// connect( myEnfFaceWdg, SIGNAL( selectionActivated()), this, SLOT( onFaceSelectionActivated() ) ); return fr; } @@ -1473,6 +1471,11 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const myName->setMinimumWidth( metrics.width( data.myName )+5 ); } myTopology->setCurrentIndex( data.myTopology ); + myPreCADGroupBox->setEnabled(data.myTopology == PreCAD); + myPreCADOptimCAD->setChecked( data.myPreCADOptimCAD ); + myPreCADDiscardInput->setChecked( data.myPreCADDiscardInput ); + myPreCADManifoldGeom->setChecked( data.myPreCADManifoldGeom ); + myPreCADClosedGeom->setChecked( data.myPreCADClosedGeom ); myPhysicalMesh->setCurrentIndex( data.myPhysicalMesh ); myPhySize->SetValue( data.myPhySize ); #ifdef WITH_SIZE_BOUNDARIES @@ -1498,9 +1501,6 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const myGeoMax->SetValue( data.myGeoMax ); #endif myGeometricMesh->setCurrentIndex( data.myGeometricMesh ); -// myAngleMeshS->setValue( data.myAngleMeshS ); -// myAngleMeshC->setValue( data.myAngleMeshC ); -// myGradation->setValue( data.myGradation ); myAngleMeshS->SetValue( data.myAngleMeshS ); myAngleMeshC->SetValue( data.myAngleMeshC ); myGradation->SetValue( data.myGradation ); @@ -1529,7 +1529,9 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const } } myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN ); - + myGMFFileName->setText(QString(data.myGMFFileName.c_str())); +// myGMFFileMode->setChecked(data.myGMFFileMode); + // Sizemaps MESSAGE("retrieveParams():that->mySMPMap.size() = " << that->mySMPMap.size()); QMapIterator i(that->mySMPMap); @@ -1638,16 +1640,20 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData HypothesisData* data = SMESH::GetHypothesisData( hypType() ); h_data.myName = isCreation() && data ? hypName() : ""; - h_data.myTopology = (int) h->GetTopology(); - h_data.myPhysicalMesh = (int) h->GetPhysicalMesh(); - h_data.myPhySize = h->GetPhySize(); - h_data.myGeometricMesh = (int) h->GetGeometricMesh(); - h_data.myAngleMeshS = h->GetAngleMeshS(); - h_data.myAngleMeshC = h->GetAngleMeshC(); - h_data.myGradation = h->GetGradation(); - h_data.myAllowQuadrangles = h->GetQuadAllowed(); - h_data.myDecimesh = h->GetDecimesh(); - h_data.myVerbosity = h->GetVerbosity(); + h_data.myTopology = (int) h->GetTopology(); + h_data.myPhysicalMesh = (int) h->GetPhysicalMesh(); + h_data.myPhySize = h->GetPhySize(); + h_data.myGeometricMesh = (int) h->GetGeometricMesh(); + h_data.myAngleMeshS = h->GetAngleMeshS(); + h_data.myAngleMeshC = h->GetAngleMeshC(); + h_data.myGradation = h->GetGradation(); + h_data.myAllowQuadrangles = h->GetQuadAllowed(); + h_data.myDecimesh = h->GetDecimesh(); + h_data.myVerbosity = h->GetVerbosity(); + h_data.myPreCADOptimCAD = h->GetPreCADOptimCAD(); + h_data.myPreCADDiscardInput = h->GetPreCADDiscardInput(); + h_data.myPreCADManifoldGeom = h->GetPreCADManifoldGeom(); + h_data.myPreCADClosedGeom = h->GetPreCADClosedGeom(); #ifdef WITH_SIZE_BOUNDARIES double PhyMin = h->GetPhyMin(); @@ -1667,6 +1673,9 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; that->myOptions = h->GetOptionValues(); + + h_data.myGMFFileName = h->GetGMFFile(); +// h_data.myGMFFileMode = h->GetGMFFileMode(); that->mySMPMap.clear(); that->myATTMap.clear(); @@ -1826,6 +1835,14 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi h->SetDecimesh( h_data.myDecimesh ); if ( h->GetVerbosity() != h_data.myVerbosity ) h->SetVerbosity( h_data.myVerbosity ); + if ( h->GetPreCADOptimCAD() != h_data.myPreCADOptimCAD ) + h->SetPreCADOptimCAD( h_data.myPreCADOptimCAD ); + if ( h->GetPreCADDiscardInput() != h_data.myPreCADDiscardInput ) + h->SetPreCADDiscardInput( h_data.myPreCADDiscardInput ); + if ( h->GetPreCADManifoldGeom() != h_data.myPreCADManifoldGeom ) + h->SetPreCADManifoldGeom( h_data.myPreCADManifoldGeom ); + if ( h->GetPreCADClosedGeom() != h_data.myPreCADClosedGeom ) + h->SetPreCADClosedGeom( h_data.myPreCADClosedGeom ); if( ((int) h_data.myPhysicalMesh == PhysicalUserDefined)||((int) h_data.myPhysicalMesh == SizeMap) ) { if ( h->GetPhySize() != h_data.myPhySize ) @@ -1849,6 +1866,11 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi #endif h->SetOptionValues( myOptions ); // is set in checkParams() + + if ( h->GetGMFFile() != h_data.myGMFFileName ) +// || ( 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; QMapIterator i(that->mySMPMap); @@ -1907,7 +1929,8 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi // 1. Clear all enforced vertices in hypothesis // 2. Add new enforced vertex according to h_data - h->ClearAllEnforcedVertices(); + if ( h->GetAllEnforcedVertices()->length() > 0 ) + h->ClearAllEnforcedVertices(); TEnfName faceEntry; TEnfVertexList evs; TEnfVertexList::const_iterator evsIt; @@ -1948,23 +1971,27 @@ 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.myTopology = myTopology->currentIndex(); - h_data.myPhysicalMesh = myPhysicalMesh->currentIndex(); - h_data.myPhySize = myPhySize->GetValue(); + h_data.myName = myName ? myName->text() : ""; + h_data.myTopology = myTopology->currentIndex(); + h_data.myPhysicalMesh = myPhysicalMesh->currentIndex(); + h_data.myPhySize = myPhySize->GetValue(); #ifdef WITH_SIZE_BOUNDARIES - h_data.myPhyMin = myPhyMin->GetValue(); - h_data.myPhyMax = myPhyMax->GetValue(); - h_data.myGeoMin = myGeoMin->GetValue(); - h_data.myGeoMax = myGeoMax->GetValue(); + h_data.myPhyMin = myPhyMin->GetValue(); + h_data.myPhyMax = myPhyMax->GetValue(); + h_data.myGeoMin = myGeoMin->GetValue(); + h_data.myGeoMax = myGeoMax->GetValue(); #endif - h_data.myGeometricMesh = myGeometricMesh->currentIndex(); - h_data.myAngleMeshS = myAngleMeshS->GetValue(); - h_data.myAngleMeshC = myAngleMeshC->GetValue(); - h_data.myGradation = myGradation->GetValue(); - h_data.myAllowQuadrangles = myAllowQuadrangles->isChecked(); - h_data.myDecimesh = myDecimesh->isChecked(); - h_data.myVerbosity = myVerbosity->value(); + h_data.myGeometricMesh = myGeometricMesh->currentIndex(); + h_data.myAngleMeshS = myAngleMeshS->GetValue(); + h_data.myAngleMeshC = myAngleMeshC->GetValue(); + h_data.myGradation = myGradation->GetValue(); + h_data.myAllowQuadrangles = myAllowQuadrangles->isChecked(); + h_data.myDecimesh = myDecimesh->isChecked(); + h_data.myVerbosity = myVerbosity->value(); + h_data.myPreCADOptimCAD = myPreCADOptimCAD->isChecked(); + h_data.myPreCADDiscardInput = myPreCADDiscardInput->isChecked(); + h_data.myPreCADManifoldGeom = myPreCADManifoldGeom->isChecked(); + h_data.myPreCADClosedGeom = myPreCADClosedGeom->isChecked(); QString guiHyp; guiHyp += tr("BLSURF_TOPOLOGY") + " = " + QString::number( h_data.myTopology ) + "; "; @@ -1981,6 +2008,10 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes guiHyp += "hgeomin = " + QString::number( h_data.myGeoMin ) + "; "; guiHyp += "hgeomax = " + QString::number( h_data.myGeoMax ) + "; "; #endif + guiHyp += tr("BLSURF_PRECAD_OPTIM_CAD") + " = " + QString(h_data.myPreCADOptimCAD ? "yes" : "no") + "; "; + guiHyp += tr("BLSURF_PRECAD_DISCARD_INPUT") + " = " + QString(h_data.myPreCADDiscardInput ? "yes" : "no") + "; "; + guiHyp += tr("BLSURF_PRECAD_MANIFOLD_GEOM") + " = " + QString(h_data.myPreCADManifoldGeom ? "yes" : "no") + "; "; + guiHyp += tr("BLSURF_PRECAD_CLOSED_GEOM") + " = " + QString(h_data.myPreCADClosedGeom ? "yes" : "no") + "; "; BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; int row = 0, nbRows = myOptionTable->rowCount(); @@ -1998,6 +2029,9 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes guiHyp += name + " = " + value + "; "; } } + + h_data.myGMFFileName = myGMFFileName->text().toStdString(); +// h_data.myGMFFileMode = myGMFFileMode->isChecked(); // SizeMap row = 0, nbRows = mySizeMapTable->topLevelItemCount(); @@ -2067,6 +2101,12 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes return guiHyp; } + +void BLSURFPluginGUI_HypothesisCreator::onTopologyChanged(int index) { + MESSAGE("BLSURFPluginGUI_HypothesisCreator::onTopologyChanged"); + myPreCADGroupBox->setEnabled(index == PreCAD); +} + void BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged() { MESSAGE("BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged"); bool isPhysicalUserDefined = (myPhysicalMesh->currentIndex() == PhysicalUserDefined); @@ -2184,6 +2224,16 @@ void BLSURFPluginGUI_HypothesisCreator::onDeleteOption() myOptionTable->removeRow( it.previous() ); } +void BLSURFPluginGUI_HypothesisCreator::onChooseGMFFile() +{ +// QFileDialog dlg(0); +// dlg.selectFile(myGMFFileName->text()); +// dlg.setNameFilter(tr("BLSURF_GMF_FILE_FORMAT")); +// dlg.setDefaultSuffix(QString("mesh")); + myGMFFileName->setText(QFileDialog::getSaveFileName(0, tr("BLSURF_GMF_FILE_DIALOG"), myGMFFileName->text(), tr("BLSURF_GMF_FILE_FORMAT"))); +} + + // ********************** // *** BEGIN SIZE MAP *** // ********************** diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.h b/src/GUI/BLSURFPluginGUI_HypothesisCreator.h index c8686d9..38a6bfa 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.h +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.h @@ -126,6 +126,8 @@ typedef struct double myPhySize, myGeoMin, myGeoMax, myPhyMin,myPhyMax; bool myAllowQuadrangles, myDecimesh,mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex; bool myPreCADOptimCAD, myPreCADDiscardInput, myPreCADManifoldGeom, myPreCADClosedGeom; +// bool myGMFFileMode; + std::string myGMFFileName; TEnfVertexList enfVertexList; TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap; /* TODO GROUPS @@ -191,7 +193,9 @@ protected slots: void onGeometricMeshChanged(); void onAddOption(); void onDeleteOption(); + void onChooseGMFFile(); void onOptionChosenInPopup( QAction* ); + void onTopologyChanged( int ); void onMapGeomContentModified(); void onSmpItemClicked( QTreeWidgetItem *, int ); void onSmpTabChanged(int); @@ -247,6 +251,8 @@ private: QCheckBox* myPreCADClosedGeom; QSpinBox* myVerbosity; QTableWidget* myOptionTable; + QLineEdit* myGMFFileName; +// QCheckBox* myGMFFileMode; // Sizemap widgets QWidget *mySmpGroup; diff --git a/src/GUI/BLSURFPlugin_msg_en.ts b/src/GUI/BLSURFPlugin_msg_en.ts index e8f0a61..a29405c 100644 --- a/src/GUI/BLSURFPlugin_msg_en.ts +++ b/src/GUI/BLSURFPlugin_msg_en.ts @@ -123,6 +123,22 @@ REMOVE_OPTION Clear option + + BLSURF_GMF_FILE + Export GMF + + + BLSURF_GMF_MODE + Binary + + + BLSURF_GMF_FILE_DIALOG + Select GMF file... + + + BLSURF_GMF_FILE_FORMAT + GMF File (*.mesh *.meshb) + BLSURF_PRECAD_GROUP PreCAD options diff --git a/src/GUI/BLSURFPlugin_msg_fr.ts b/src/GUI/BLSURFPlugin_msg_fr.ts index 03b0618..95cdb9d 100755 --- a/src/GUI/BLSURFPlugin_msg_fr.ts +++ b/src/GUI/BLSURFPlugin_msg_fr.ts @@ -123,6 +123,22 @@ REMOVE_OPTION Effacer l'option + + BLSURF_GMF_FILE + Export GMF + + + BLSURF_GMF_MODE + Binaire + + + BLSURF_GMF_FILE_DIALOG + Choisir un fichier au format GMF... + + + BLSURF_GMF_FILE_FORMAT + Fichier GMF (*.mesh *.meshb) + BLSURF_PRECAD_GROUP Options PreCAD -- 2.39.2