Salome HOME
Add export to .mesh file at computation if a file name is given.
authorgdd <gdd>
Thu, 28 Jul 2011 16:50:11 +0000 (16:50 +0000)
committergdd <gdd>
Thu, 28 Jul 2011 16:50:11 +0000 (16:50 +0000)
idl/BLSURFPlugin_Algorithm.idl
src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.h
src/GUI/BLSURFPlugin_msg_en.ts
src/GUI/BLSURFPlugin_msg_fr.ts

index 10ec2f022232558149a1edcbc90049fa5548e9b1..b77fcd48c76d0819639b6f20472c50031ba8aee3 100644 (file)
@@ -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();
   };
 };
 
index 9d888ae8fb6b8358bb6ab7f97afc77417abb5998..17ddf40c8f0d8c15d6882a4b0fb5e9042b1266c6 100644 (file)
@@ -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;
 }
 
index 7fb73c95c7ece9802ea7f50b6e46d87716a93e58..838d435e641ebc972c8656d906f326750eca7ec1 100644 (file)
@@ -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) {
index c2681482086aef7d75f2417c9f0ebe743ce8309b..493c18b8d66b1b350c56db379d8948d44860a630 100644 (file)
@@ -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;
   */
index 882e6985547a1b987929cebe40dd63b005ef727a..48c353daf7609e0d7d24f7448fa827f70d14f877 100644 (file)
@@ -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
index f4f8ecbc5e390864a6d33ef0da7c4bd0a8f83d65..9fd864f234f99edeca3b546041caec03e8472c77 100644 (file)
@@ -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();
index 249a9d159ff87b8f67d35c67d598916be2ed9be0..f954a3cc20475c6365ca7670160a979299bd9a44 100644 (file)
@@ -58,6 +58,7 @@
 #include <QHeaderView>
 #include <QApplication>
 #include <QRadioButton>
+#include <QFileDialog>
 
 #include <QStandardItemModel>
 #include <QStandardItem>
@@ -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<QString, QString> 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<QString,QString> 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 ***
 // **********************
index c8686d928c3cab16252c0ab24db40646c4e101f0..38a6bfafc7187dcf92461a3eee021b87872e32a1 100644 (file)
@@ -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;
index e8f0a615a243eebd6c8c93e6e067c3d5bdf34c7d..a29405c66c1ac91ee4fdee11e2273327c55a0f04 100644 (file)
         <source>REMOVE_OPTION</source>
         <translation>Clear option</translation>
     </message>
+    <message>
+        <source>BLSURF_GMF_FILE</source>
+        <translation>Export GMF</translation>
+    </message>
+    <message>
+        <source>BLSURF_GMF_MODE</source>
+        <translation>Binary</translation>
+    </message>
+    <message>
+        <source>BLSURF_GMF_FILE_DIALOG</source>
+        <translation>Select GMF file...</translation>
+    </message>
+    <message>
+        <source>BLSURF_GMF_FILE_FORMAT</source>
+        <translation>GMF File (*.mesh *.meshb)</translation>
+    </message>
     <message>
         <source>BLSURF_PRECAD_GROUP</source>
         <translation>PreCAD options</translation>
index 03b0618373c7cc2cd6049aa43aa7e52c6eb47be2..95cdb9d10fad3dbd2ace41877cb525d32c52ac90 100755 (executable)
         <source>REMOVE_OPTION</source>
         <translation>Effacer l&apos;option</translation>
     </message>
+    <message>
+        <source>BLSURF_GMF_FILE</source>
+        <translation>Export GMF</translation>
+    </message>
+    <message>
+        <source>BLSURF_GMF_MODE</source>
+        <translation>Binaire</translation>
+    </message>
+    <message>
+        <source>BLSURF_GMF_FILE_DIALOG</source>
+        <translation>Choisir un fichier au format GMF...</translation>
+    </message>
+    <message>
+        <source>BLSURF_GMF_FILE_FORMAT</source>
+        <translation>Fichier GMF (*.mesh *.meshb)</translation>
+    </message>
     <message>
         <source>BLSURF_PRECAD_GROUP</source>
         <translation>Options PreCAD</translation>