]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
0023088: [CEA 1480] Able to indicate a new option by name, in addition to the already...
authormpa <mpa@opencascade.com>
Tue, 21 Jul 2015 10:14:14 +0000 (13:14 +0300)
committermpa <mpa@opencascade.com>
Tue, 21 Jul 2015 10:14:14 +0000 (13:14 +0300)
14 files changed:
doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc
idl/BLSURFPlugin_Algorithm.idl
resources/BLSURFPlugin.xml
src/BLSURFPlugin/BLSURFPluginBuilder.py
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
src/GUI/BLSURFPlugin_msg_ja.ts

index 5017d4b12587f44e06c41b3002a394d071575e6a..81f4075a48bb059715c7b67c4539ebcdca6c8d58 100644 (file)
@@ -268,6 +268,9 @@ By default this option is \f$\mathrm{diag} \times 5 \cdot 10^{-4}\f$.
 - \b tiny_edge_length (real) -  the length below which en edge is considered as nano for the topology processing.
 By default this option is \f$10^{-5}\f$.
 
+\note Moreover, user can choose "<Other option>" item in these two pop-up menus 
+(MG-CADSurf and PreCAD) to be able to specify both the option name and the option value. 
+
 \ref blsurf_top "Back to top"
 
 \section blsurf_local_size Local size
index 49925939e097678117a64a48984c731e98d15ef6..8d2f751a82758ccdaec8f5362577a3ba033cb472 100644 (file)
@@ -305,9 +305,17 @@ module BLSURFPlugin
     void UnsetOption(in string optionName);
     void UnsetPreCADOption(in string optionName);
 
+    /*!
+     * Adds custom advanced option and its value
+     */
+    void AddOption(in string optionName, in string optionValue);
+    void AddPreCADOption(in string optionName, in string optionValue);
+    string GetOption(in string optionName);
+    string GetPreCADOption(in string optionName);
+
     /*!
      * Return array of strings each of which is option name concatenated
-     * with option value devided by semicolon - "option_name:option_value".
+     * with option value devided by semicolon - "option_name:option_value:option_type".
      * Option value is empty if an option is not set.
      * Note: the method is mostly for interaction with GUI.
      */
@@ -315,7 +323,7 @@ module BLSURFPlugin
     string_array GetPreCADOptionValues();
 
     /*!
-     * Set option values each in the form "option_name[:option_value]".
+     * Set option values each in the form "option_name[:option_value][:option_type]".
      * Note: the method is mostly for interaction with GUI.
      */
     void SetOptionValues(in string_array options) raises (SALOME::SALOME_Exception);
index d10f9d69b7bff6dc97dca73665a438c5827d23e6..7d2f103482e37c05be299996b7cc5e6d4a396af1 100644 (file)
@@ -41,6 +41,8 @@
           SetPreCADOptionValue,
           UnsetOption,
           UnsetPreCADOption,
+          AddOption,
+          AddPreCADOption,
           SetSizeMap,
           SetConstantSizeMap,
           UnsetSizeMap,
index 8399cf10f8cef75f0c603d0b1c120978bd6da3fb..f06850f72f37704dbb05219f267b802e8d198cc3 100644 (file)
@@ -240,6 +240,22 @@ class BLSURF_Algorithm(Mesh_Algorithm):
       self.SetTopology(PreCAD)
     self.Parameters().SetPreCADOptionValue(optionName,optionValue)
     pass
+  
+  ## Adds custom advanced option value.
+  #  @param optionName custom advanced option name
+  #  @param level custom advanced option value
+  def AddOption(self, optionName, level):
+    self.Parameters().AddOption(optionName,level)
+    pass
+
+  ## Adds custom advanced PreCAD option value.
+  #  @param optionName custom name of the option
+  #  @param optionValue value of the option
+  def AddPreCADOption(self, optionName, optionValue):
+    if self.Parameters().GetTopology() != PreCAD:
+      self.SetTopology(PreCAD)
+    self.Parameters().AddPreCADOption(optionName,optionValue)
+    pass
 
   ## Sets GMF file for export at computation
   #  @param fileName GMF file name
index bb54f930adcb0be83902468b55ee8c60735004b5..1bace844dae0e90846066518016aa9b9e604591f 100644 (file)
@@ -1004,7 +1004,7 @@ void BLSURFPlugin_BLSURF::SetParameters(
      _precadProcess3DTopology = hyp->GetPreCADProcess3DTopology();
      _precadDiscardInput = hyp->GetPreCADDiscardInput();
 
-    const BLSURFPlugin_Hypothesis::TOptionValues & opts = hyp->GetOptionValues();
+    const BLSURFPlugin_Hypothesis::TOptionValues& opts = hyp->GetOptionValues();
     BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt;
     for ( opIt = opts.begin(); opIt != opts.end(); ++opIt )
       if ( !opIt->second.empty() ) {
@@ -1012,13 +1012,28 @@ void BLSURFPlugin_BLSURF::SetParameters(
         set_param(css, opIt->first.c_str(), opIt->second.c_str());
       }
       
-    const BLSURFPlugin_Hypothesis::TOptionValues & preCADopts = hyp->GetPreCADOptionValues();
+    const BLSURFPlugin_Hypothesis::TOptionValues& custom_opts = hyp->GetCustomOptionValues();
+    for ( opIt = custom_opts.begin(); opIt != custom_opts.end(); ++opIt )
+      if ( !opIt->second.empty() ) {
+        MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second);
+        set_param(css, opIt->first.c_str(), opIt->second.c_str());
+     }
+
+    const BLSURFPlugin_Hypothesis::TOptionValues& preCADopts = hyp->GetPreCADOptionValues();
     for ( opIt = preCADopts.begin(); opIt != preCADopts.end(); ++opIt )
       if ( !opIt->second.empty() ) {
         *use_precad = true;
         MESSAGE("precad_set_param(): " << opIt->first << " = " << opIt->second);
         precad_set_param(pcs, opIt->first.c_str(), opIt->second.c_str());
       }
+
+    const BLSURFPlugin_Hypothesis::TOptionValues& custom_preCADopts = hyp->GetCustomPreCADOptionValues();
+    for ( opIt = custom_preCADopts.begin(); opIt != custom_preCADopts.end(); ++opIt )
+      if ( !opIt->second.empty() ) {
+        *use_precad = true;
+        MESSAGE("precad_set_param(): " << opIt->first << " = " << opIt->second);
+        precad_set_param(pcs, opIt->first.c_str(), opIt->second.c_str());
+      }
   }
 //   else {
 //     //0020968: EDF1545 SMESH: Problem in the creation of a mesh group on geometry
index 445ae3542b211ccf0f5ce5a78dab835d36f61689..992fbd3df68fcdd42ed57cc0e3cc55762c7453c2 100644 (file)
@@ -532,16 +532,82 @@ std::string BLSURFPlugin_Hypothesis::GetPreCADOptionValue(const std::string& opt
 
 //=============================================================================
 void BLSURFPlugin_Hypothesis::ClearOption(const std::string& optionName) {
-  TOptionValues::iterator op_val = _option2value.find(optionName);
-  if (op_val != _option2value.end())
-    op_val->second.clear();
+  TOptionValues::iterator op_val = _customOption2value.find(optionName);
+  if (op_val != _customOption2value.end())
+   _customOption2value.erase(op_val);
+  else {
+    op_val = _option2value.find(optionName);
+    if (op_val != _option2value.end())
+      op_val->second.clear();
+  }
 }
 
 //=============================================================================
 void BLSURFPlugin_Hypothesis::ClearPreCADOption(const std::string& optionName) {
+  TOptionValues::iterator op_val = _customPreCADOption2value.find(optionName);
+  if (op_val != _customPreCADOption2value.end())
+    _customPreCADOption2value.erase(op_val);
+  else {
+    op_val = _preCADoption2value.find(optionName);
+    if (op_val != _preCADoption2value.end())
+      op_val->second.clear();
+  }
+}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis::AddOption(const std::string& optionName, const std::string& optionValue)
+{
+  TOptionValues::iterator op_val = _option2value.find(optionName);
+  if (op_val != _option2value.end()) {
+    if (op_val->second != optionValue)
+      op_val->second = optionValue;
+  }
+  else {
+    op_val = _customOption2value.find(optionName);
+    if (op_val == _customOption2value.end())
+      _customOption2value[optionName] = optionValue;
+    else if (op_val->second != optionValue)
+      op_val->second = optionValue;
+  }
+  NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis::AddPreCADOption(const std::string& optionName, const std::string& optionValue)
+{
   TOptionValues::iterator op_val = _preCADoption2value.find(optionName);
-  if (op_val != _preCADoption2value.end())
-    op_val->second.clear();
+  if (op_val != _preCADoption2value.end()) {
+    if (op_val->second != optionValue)
+      op_val->second = optionValue;
+  }
+  else {
+    op_val = _customPreCADOption2value.find(optionName);
+    if (op_val == _customPreCADOption2value.end())
+      _customPreCADOption2value[optionName] = optionValue;
+    else if (op_val->second != optionValue)
+      op_val->second = optionValue;
+  }
+  NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+std::string BLSURFPlugin_Hypothesis::GetOption(const std::string& optionName)
+{
+  TOptionValues::iterator op_val = _customOption2value.find(optionName);
+  if (op_val != _customOption2value.end())
+    return op_val->second;
+  else
+    return "";
+}
+
+//=============================================================================
+std::string BLSURFPlugin_Hypothesis::GetPreCADOption(const std::string& optionName)
+{
+  TOptionValues::iterator op_val = _customPreCADOption2value.find(optionName);
+  if (op_val != _customPreCADOption2value.end())
+    return op_val->second;
+  else
+    return "";
 }
 
 //=======================================================================
@@ -1395,6 +1461,16 @@ std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
     save << " " << "__OPTIONS_END__";
   }
   
+  op_val = _customOption2value.begin();
+  if (op_val != _customOption2value.end()) {
+    save << " " << "__CUSTOM_OPTIONS_BEGIN__";
+    for (; op_val != _customOption2value.end(); ++op_val) {
+      if (!op_val->second.empty())
+        save << " " << op_val->first << " " << op_val->second << "%#"; // "%#" is a mark of value end
+    }
+    save << " " << "__CUSTOM_OPTIONS_END__";
+  }
+
   op_val = _preCADoption2value.begin();
   if (op_val != _preCADoption2value.end()) {
     save << " " << "__PRECAD_OPTIONS_BEGIN__";
@@ -1405,6 +1481,16 @@ std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
     save << " " << "__PRECAD_OPTIONS_END__";
   }
 
+  op_val = _customPreCADOption2value.begin();
+  if (op_val != _customPreCADOption2value.end()) {
+    save << " " << "__CUSTOM_PRECAD_OPTIONS_BEGIN__";
+    for (; op_val != _customPreCADOption2value.end(); ++op_val) {
+      if (!op_val->second.empty())
+        save << " " << op_val->first << " " << op_val->second << "%#"; // "%#" is a mark of value end
+    }
+    save << " " << "__CUSTOM_PRECAD_OPTIONS_END__";
+  }
+
   TSizeMap::iterator it_sm = _sizeMap.begin();
   if (it_sm != _sizeMap.end()) {
     save << " " << "__SIZEMAP_BEGIN__";
@@ -1781,7 +1867,9 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
 
   bool hasCADSurfOptions = false;
   bool hasOptions = false;
+  bool hasCustomOptions = false;
   bool hasPreCADOptions = false;
+  bool hasCustomPreCADOptions = false;
   bool hasSizeMap = false;
   bool hasAttractor = false;
   bool hasNewAttractor = false;
@@ -1801,8 +1889,12 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
     }
     if (option_or_sm == "__OPTIONS_BEGIN__")
       hasOptions = true;
+    else if (option_or_sm == "__CUSTOM_OPTIONS_BEGIN__")
+      hasCustomOptions = true;
     else if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
       hasPreCADOptions = true;
+    else if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
+      hasCustomPreCADOptions = true;
     else if (option_or_sm == "__SIZEMAP_BEGIN__")
       hasSizeMap = true;
     else if (option_or_sm == "__ATTRACTORS_BEGIN__")
@@ -1903,8 +1995,12 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
     if (isOK)
       if (option_or_sm == "__OPTIONS_BEGIN__")
         hasOptions = true;
+      else if (option_or_sm == "__CUSTOM_OPTIONS_BEGIN__")
+        hasCustomOptions = true;
       else if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
         hasPreCADOptions = true;
+      else if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
+        hasCustomPreCADOptions = true;
       else if (option_or_sm == "__SIZEMAP_BEGIN__")
         hasSizeMap = true;
       else if (option_or_sm == "__ATTRACTORS_BEGIN__")
@@ -1953,10 +2049,67 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
   }
 
   if (hasOptions) {
+    isOK = (load >> option_or_sm);
+    if (isOK)
+      if (option_or_sm == "__CUSTOM_OPTIONS_BEGIN__")
+        hasCustomOptions = true;
+      else if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
+        hasPreCADOptions = true;
+      else if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
+        hasCustomPreCADOptions = true;
+      else if (option_or_sm == "__SIZEMAP_BEGIN__")
+        hasSizeMap = true;
+      else if (option_or_sm == "__ATTRACTORS_BEGIN__")
+        hasAttractor = true;
+      else if (option_or_sm == "__NEW_ATTRACTORS_BEGIN__")
+        hasNewAttractor = true;
+      else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
+        hasEnforcedVertex = true;
+      else if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
+        hasPreCADFacesPeriodicity = true;
+      else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+        hasPreCADEdgesPeriodicity = true;
+      else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+        hasFacesPeriodicity = true;
+      else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+        hasEdgesPeriodicity = true;
+      else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+        hasVerticesPeriodicity = true;
+  }
+
+  while (isOK && hasCustomOptions) {
+    isOK = (load >> optName);
+    if (isOK) {
+      if (optName == "__CUSTOM_OPTIONS_END__")
+        break;
+      isOK = (load >> optValue);
+    }
+    if (isOK) {
+      std::string& value = optValue;
+      int len = value.size();
+      // continue reading until "%#" encountered
+      while (value[len - 1] != '#' || value[len - 2] != '%') {
+        isOK = (load >> optValue);
+        if (isOK) {
+          value += " ";
+          value += optValue;
+          len = value.size();
+        } else {
+          break;
+        }
+      }
+      _customOption2value[optName] = value.substr(0,len-2);
+      value[len - 2] = '\0'; //cut off "%#"
+    }
+  }
+
+  if (hasCustomOptions) {
     isOK = (load >> option_or_sm);
     if (isOK)
       if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
         hasPreCADOptions = true;
+      else if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
+        hasCustomPreCADOptions = true;
       else if (option_or_sm == "__SIZEMAP_BEGIN__")
         hasSizeMap = true;
       else if (option_or_sm == "__ATTRACTORS_BEGIN__")
@@ -2004,6 +2157,57 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
   }
 
   if (hasPreCADOptions) {
+    isOK = (load >> option_or_sm);
+    if (isOK)
+      if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
+        hasCustomPreCADOptions = true;
+      else if (option_or_sm == "__SIZEMAP_BEGIN__")
+        hasSizeMap = true;
+      else if (option_or_sm == "__ATTRACTORS_BEGIN__")
+        hasAttractor = true;
+      else if (option_or_sm == "__NEW_ATTRACTORS_BEGIN__")
+        hasNewAttractor = true;
+      else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
+        hasEnforcedVertex = true;
+      else if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
+        hasPreCADFacesPeriodicity = true;
+      else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+        hasPreCADEdgesPeriodicity = true;
+      else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+        hasFacesPeriodicity = true;
+      else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+        hasEdgesPeriodicity = true;
+      else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+        hasVerticesPeriodicity = true;
+  }
+
+  while (isOK && hasCustomPreCADOptions) {
+    isOK = (load >> optName);
+    if (isOK) {
+      if (optName == "__CUSTOM_PRECAD_OPTIONS_END__")
+        break;
+      isOK = (load >> optValue);
+    }
+    if (isOK) {
+      std::string& value = optValue;
+      int len = value.size();
+      // continue reading until "%#" encountered
+      while (value[len - 1] != '#' || value[len - 2] != '%') {
+        isOK = (load >> optValue);
+        if (isOK) {
+          value += " ";
+          value += optValue;
+          len = value.size();
+        } else {
+          break;
+        }
+      }
+      _customPreCADOption2value[optName] = value.substr(0,len-2);
+      value[len - 2] = '\0'; //cut off "%#"
+    }
+  }
+
+  if (hasCustomPreCADOptions) {
     isOK = (load >> option_or_sm);
     if (isOK)
       if (option_or_sm == "__SIZEMAP_BEGIN__")
index 73cd865eee94c57acb0688846f41fa5742162a89..43a4aab0e854f9bee8f41ed1d59f21ae1f5dd6cb 100644 (file)
@@ -435,6 +435,13 @@ public:
   void ClearPreCADOption(const std::string& optionName);
   const TOptionValues& GetOptionValues() const { return _option2value; }
   const TOptionValues& GetPreCADOptionValues() const { return _preCADoption2value; }
+  const TOptionValues& GetCustomOptionValues() const { return _customOption2value; }
+  const TOptionValues& GetCustomPreCADOptionValues() const { return _customPreCADOption2value; }
+
+  void AddOption(const std::string& optionName, const std::string& optionValue);
+  void AddPreCADOption(const std::string& optionName, const std::string& optionValue);
+  std::string GetOption(const std::string& optionName);
+  std::string GetPreCADOption(const std::string& optionName);
 
   /*!
     * Sets the file for export resulting mesh in GMF format
@@ -494,6 +501,7 @@ private:
   double          _preCADEpsNano;
   
   TOptionValues   _option2value, _preCADoption2value;
+  TOptionValues   _customOption2value, _customPreCADOption2value;
   TOptionNames    _doubleOptions, _charOptions;
   TOptionNames    _preCADdoubleOptions, _preCADcharOptions;
   TSizeMap        _sizeMap;
index b929b591a76e8e53adc2c8807124838c8c6e497b..beaddc1b30b9a60713a33f5d78db4ff812e72d7d 100644 (file)
@@ -808,16 +808,30 @@ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
 
   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
-  result->length(opts.size());
+  const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
+  result->length(opts.size()+custom_opts.size());
+  int i=0;
 
   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
-  for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
-    string name_value = opIt->first;
+  for (; opIt != opts.end(); ++opIt, ++i) {
+    string name_value_type = opIt->first;
     if (!opIt->second.empty()) {
-      name_value += ":";
-      name_value += opIt->second;
+      name_value_type += ":";
+      name_value_type += opIt->second;
+      name_value_type += ":0";
     }
-    result[i] = CORBA::string_dup(name_value.c_str());
+    result[i] = CORBA::string_dup(name_value_type.c_str());
+  }
+
+  opIt = custom_opts.begin();
+  for (; opIt != custom_opts.end(); ++opIt,++i) {
+    string name_value_type = opIt->first;
+    if (!opIt->second.empty()) {
+      name_value_type += ":";
+      name_value_type += opIt->second;
+      name_value_type += ":1";
+    }
+    result[i] = CORBA::string_dup(name_value_type.c_str());
   }
   return result._retn();
 }
@@ -829,16 +843,30 @@ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
 
   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
-  result->length(opts.size());
+  const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomPreCADOptionValues();
+  result->length(opts.size()+custom_opts.size());
+  int i=0;
 
   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
-  for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
-    string name_value = opIt->first;
+  for (; opIt != opts.end(); ++opIt, ++i) {
+    string name_value_type = opIt->first;
     if (!opIt->second.empty()) {
-      name_value += ":";
-      name_value += opIt->second;
+      name_value_type += ":";
+      name_value_type += opIt->second;
+      name_value_type += ":0";
     }
-    result[i] = CORBA::string_dup(name_value.c_str());
+    result[i] = CORBA::string_dup(name_value_type.c_str());
+  }
+
+  opIt = custom_opts.begin();
+  for (; opIt != custom_opts.end(); ++opIt,++i) {
+    string name_value_type = opIt->first;
+    if (!opIt->second.empty()) {
+      name_value_type += ":";
+      name_value_type += opIt->second;
+      name_value_type += ":1";
+    }
+    result[i] = CORBA::string_dup(name_value_type.c_str());
   }
   return result._retn();
 }
@@ -849,17 +877,25 @@ void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
   for (int i = 0; i < options.length(); ++i) {
-    string name_value = options[i].in();
-    int colonPos = name_value.find(':');
+    string name_value_type = options[i].in();
+    if(name_value_type.empty())
+      continue;
+    int colonPos = name_value_type.find(':');
     string name, value;
+    bool custom = false;
     if (colonPos == string::npos) // ':' not found
-      name = name_value;
+      name = name_value_type;
     else {
-      name = name_value.substr(0, colonPos);
-      if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
-        value = name_value.substr(colonPos + 1);
+      name = name_value_type.substr(0, colonPos);
+      if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
+        string value_type = name_value_type.substr(colonPos + 1);
+        colonPos = value_type.find(':');
+        value = value_type.substr(0, colonPos);
+        if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
+          custom = atoi((value_type.substr(colonPos + 1)).c_str());
+      }
     }
-    SetOptionValue(name.c_str(), value.c_str());
+    custom ? AddOption(name.c_str(), value.c_str()) : SetOptionValue(name.c_str(), value.c_str());
   }
 }
 
@@ -869,22 +905,70 @@ void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
   for (int i = 0; i < options.length(); ++i) {
-    string name_value = options[i].in();
-    int colonPos = name_value.find(':');
+    string name_value_type = options[i].in();
+    if(name_value_type.empty())
+      continue;
+    int colonPos = name_value_type.find(':');
     string name, value;
+    bool custom = false;
     if (colonPos == string::npos) // ':' not found
-      name = name_value;
+      name = name_value_type;
     else {
-      name = name_value.substr(0, colonPos);
-      if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
-        value = name_value.substr(colonPos + 1);
+      name = name_value_type.substr(0, colonPos);
+      if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
+        string value_type = name_value_type.substr(colonPos + 1);
+        colonPos = value_type.find(':');
+        value = value_type.substr(0, colonPos);
+        if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
+          custom = atoi((value_type.substr(colonPos + 1)).c_str());
+      }
     }
-    SetPreCADOptionValue(name.c_str(), value.c_str());
+    custom ? AddPreCADOption(name.c_str(), value.c_str()) : SetPreCADOptionValue(name.c_str(), value.c_str());
+  }
+}
+
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
+{
+  ASSERT(myBaseImpl);
+  bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
+  if (valueChanged) {
+    this->GetImpl()->AddOption(optionName, optionValue);
+    SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
+  }
+}
+
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
+{
+  ASSERT(myBaseImpl);
+  bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
+  if (valueChanged) {
+    this->GetImpl()->AddPreCADOption(optionName, optionValue);
+    SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
   }
 }
 
 //=============================================================================
 
+char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
+{
+  ASSERT(myBaseImpl);
+  return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
+}
+
+//=============================================================================
+
+char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
+{
+  ASSERT(myBaseImpl);
+  return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
+}
+
+//=============================================================================
+
 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
     throw (SALOME::SALOME_Exception) {
   ASSERT(myBaseImpl);
index 5b7b3c8a286e75ef73a82618ec4e741d71ba5597..8a0663cd882b3d736b491547d1c89280080720a7 100644 (file)
@@ -131,6 +131,11 @@ public:
   void SetOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
   void SetPreCADOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
 
+  void AddOption(const char* optionName, const char* optionValue);
+  void AddPreCADOption(const char* optionName, const char* optionValue);
+  char* GetOption(const char* optionName);
+  char* GetPreCADOption(const char* optionName);
+
   void SetSizeMapEntry(const char* entry, const char* sizeMap) throw (SALOME::SALOME_Exception);
 
   void SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap) throw (SALOME::SALOME_Exception);
index 800a4933870ad7fba72ceb6d42139e9ffa3c4770..fc6f957da7d6881cb2c0d857fbe28e12a190e852 100644 (file)
@@ -529,7 +529,8 @@ bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const
     {
       QString name  = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text();
       QString value = myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->text().trimmed();
-      if ( !value.isEmpty() ) {
+      bool custom = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->data(Qt::UserRole).toBool();
+      if ( !value.isEmpty() && !custom ) {
         try {
           QString optionType = myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().trimmed();
           if (optionType == "PRECAD")
@@ -1115,10 +1116,12 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
 
   myTabWidget->setCurrentIndex( STD_TAB );
 
-  connect( myAdvWidget->addBtn->menu(), SIGNAL( aboutToShow() ),         this, SLOT( onAddOption() ) );
-  connect( myAdvWidget->addBtn->menu(), SIGNAL( triggered( QAction* ) ), this, SLOT( onOptionChosenInPopup( QAction* ) ) );
-  connect( myAdvWidget->rmBtn,          SIGNAL( clicked()),              this, SLOT( onDeleteOption() ) );
-  connect( myStdWidget->myAllowQuadrangles, SIGNAL( stateChanged( int )),this, SLOT( onStateChange() ));
+  connect( myAdvWidget->addBtn->menu(), SIGNAL( aboutToShow() ),           this, SLOT( onAddOption() ) );
+  connect( myAdvWidget->addBtn->menu(), SIGNAL( triggered( QAction* ) ),   this, SLOT( onOptionChosenInPopup( QAction* ) ) );
+  connect( myAdvWidget->rmBtn,          SIGNAL( clicked()),                this, SLOT( onDeleteOption() ) );
+  connect( myAdvWidget->myOptionTable,  SIGNAL( cellPressed( int, int ) ), this, SLOT( onEditOption( int, int ) ) );
+  connect( myAdvWidget->myOptionTable,  SIGNAL( cellChanged( int, int ) ), this, SLOT( onChangeOptionName( int, int ) ) );
+  connect( myStdWidget->myAllowQuadrangles, SIGNAL( stateChanged( int ) ), this, SLOT( onStateChange() ));
 
   // Size Maps
   connect( addMapButton,        SIGNAL( clicked()),                    this,         SLOT( onAddMap() ) );
@@ -1830,8 +1833,9 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
 //     MESSAGE("retrieveParams():myOptions->length() = " << myOptions->length());
     for ( int i = 0, nb = myOptions->length(); i < nb; ++i ) {
       QString option = that->myOptions[i].in();
-      QStringList name_value = option.split( ":", QString::KeepEmptyParts );
-      if ( name_value.count() > 1 ) {
+      QStringList name_value_type = option.split( ":", QString::KeepEmptyParts );
+      bool custom = ( name_value_type.size() == 3 ) ? name_value_type[2].toInt() : false;
+      if ( name_value_type.count() > 1 ) {
         QString idStr = QString("%1").arg( i );
         int row = myAdvWidget->myOptionTable->rowCount();
         myAdvWidget->myOptionTable->setRowCount( row+1 );
@@ -1839,9 +1843,16 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
         myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 );
         myAdvWidget->myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( "BLSURF" ) );
         myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 );
-        myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value[0] ) );
-        myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
-        myAdvWidget->myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value[1] ) );
+        myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value_type[0] ) );
+        if ( custom ) {
+          myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( Qt::ItemIsSelectable |
+                                                                                 Qt::ItemIsEditable   |
+                                                                                 Qt::ItemIsEnabled );
+          myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setData( Qt::UserRole, QVariant(true) );
+        }
+        else
+          myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
+        myAdvWidget->myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value_type[1] ) );
         myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable |
                                                                                 Qt::ItemIsEditable   |
                                                                                 Qt::ItemIsEnabled );
@@ -1852,8 +1863,9 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
 //     MESSAGE("retrieveParams():myPreCADOptions->length() = " << myPreCADOptions->length());
     for ( int i = 0, nb = myPreCADOptions->length(); i < nb; ++i ) {
       QString option = that->myPreCADOptions[i].in();
-      QStringList name_value = option.split( ":", QString::KeepEmptyParts );
-      if ( name_value.count() > 1 ) {
+      QStringList name_value_type = option.split( ":", QString::KeepEmptyParts );
+      bool custom = ( name_value_type.size() == 3 ) ? name_value_type[2].toInt() : false;
+      if ( name_value_type.count() > 1 ) {
         QString idStr = QString("%1").arg( i );
         int row = myAdvWidget->myOptionTable->rowCount();
         myAdvWidget->myOptionTable->setRowCount( row+1 );
@@ -1861,9 +1873,16 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
         myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 );
         myAdvWidget->myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( "PRECAD" ) );
         myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 );
-        myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value[0] ) );
-        myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
-        myAdvWidget->myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value[1] ) );
+        myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value_type[0] ) );
+        if ( custom ) {
+          myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( Qt::ItemIsSelectable |
+                                                                                 Qt::ItemIsEditable   |
+                                                                                 Qt::ItemIsEnabled );
+          myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setData( Qt::UserRole, QVariant(true) );
+        }
+        else
+          myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
+        myAdvWidget->myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value_type[1] ) );
         myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable |
                                                                                 Qt::ItemIsEditable   |
                                                                                 Qt::ItemIsEnabled );
@@ -2539,16 +2558,25 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes
   {
     int id = myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->text().toInt();
     std::string optionType = myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().toStdString();
-    if ( id >= 0 && ( ( optionType == "BLSURF" && id < myOptions->length() ) || ( optionType == "PRECAD" && id < myPreCADOptions->length() ) ) )
+    bool custom = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->data(Qt::UserRole).toBool();
+    if ( optionType == "BLSURF" && custom ) {
+      id = that->myOptions->length();
+      that->myOptions->length( that->myOptions->length() + 1 );
+    }
+    if ( optionType == "PRECAD" && custom ) {
+      id = that->myPreCADOptions->length();
+      that->myPreCADOptions->length( that->myPreCADOptions->length() + 1 );
+    }
+    if ( custom || ( id >= 0 && ( ( optionType == "BLSURF" && id < myOptions->length() ) || ( optionType == "PRECAD" && id < myPreCADOptions->length() ) ) ) )
     {
       QString name  = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text();
       QString value = myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->text().trimmed();
       if ( value.isNull() )
         value = "";
       if (optionType == "PRECAD")
-        that->myPreCADOptions[ id ] = ( name + ":" + value).toLatin1().constData();
+        that->myPreCADOptions[ id ] = ( name + ":" + value  + ":" + ( custom ? "1" : "0" ) ).toLatin1().constData();
       else
-        that->myOptions[ id ] = ( name + ":" + value).toLatin1().constData();
+        that->myOptions[ id ] = ( name + ":" + value + ":" + ( custom ? "1" : "0" ) ).toLatin1().constData();
 
       if ( value != "" ) {
         if (optionType == "PRECAD")
@@ -2657,22 +2685,28 @@ void BLSURFPluginGUI_HypothesisCreator::onAddOption()
   QMenu* menu = (QMenu*)sender();
   // fill popup with option names
   menu->clear();
-  QString name_value, name;
+  QStringList name_value_type;
   if ( myOptions.operator->() ) {
     QMenu* blsurfMenu = menu->addMenu(tr("OPTION_MENU_BLSURF"));
     for ( int i = 0, nb = myOptions->length(); i < nb; ++i ) {
-      name_value = myOptions[i].in();
-      name = name_value.split( ":", QString::KeepEmptyParts )[0];
-      blsurfMenu->addAction( name );
+      name_value_type = QString( myOptions[i].in() ).split( ":", QString::KeepEmptyParts );
+      bool custom = ( name_value_type.size() == 3 ) ? name_value_type[2].toInt() : false;
+      if ( !custom && !name_value_type[0].isEmpty() )
+        blsurfMenu->addAction( name_value_type[0] );
     }
+    // this user-customized action must be last in the menu
+    blsurfMenu->addAction( QString( "<" + tr("BLSURF_OTHER_OPTION") + ">" ) );
   }
   if ( myPreCADOptions.operator->() ) {
     QMenu* preCADmenu = menu->addMenu(tr("OPTION_MENU_PRECAD"));
     for ( int i = 0, nb = myPreCADOptions->length(); i < nb; ++i ) {
-      name_value = myPreCADOptions[i].in();
-      name = name_value.split( ":", QString::KeepEmptyParts )[0];
-      preCADmenu->addAction( name );
+      name_value_type = QString( myPreCADOptions[i].in() ).split( ":", QString::KeepEmptyParts );
+      bool custom = ( name_value_type.size() == 3 ) ? name_value_type[2].toInt() : false;
+      if ( !custom && !name_value_type[0].isEmpty() )
+        preCADmenu->addAction( name_value_type[0] );
     }
+    // this user-customized action must be last in the menu
+    preCADmenu->addAction( QString( "<" + tr("BLSURF_OTHER_OPTION") + ">" ) );
   }
 }
 
@@ -2682,14 +2716,18 @@ void BLSURFPluginGUI_HypothesisCreator::onOptionChosenInPopup( QAction* a )
   QMenu* menu = (QMenu*)( a->parent() );
 
   int idx = menu->actions().indexOf( a );
+  bool custom = menu->actions().last() == a;
+
   QString idStr = QString("%1").arg( idx );
   QString option, optionType;
   if (menu->title() == tr("OPTION_MENU_BLSURF")) {
-    option = myOptions[idx].in();
+    if (idx < myOptions->length())
+      option = myOptions[idx].in();
     optionType = "BLSURF";
   }
   else if (menu->title() == tr("OPTION_MENU_PRECAD")) {
-    option = myPreCADOptions[idx].in();
+    if (idx < myPreCADOptions->length())
+      option = myPreCADOptions[idx].in();
     optionType = "PRECAD";
   }
   QString optionName = option.split( ":", QString::KeepEmptyParts )[0];
@@ -2700,6 +2738,8 @@ void BLSURFPluginGUI_HypothesisCreator::onOptionChosenInPopup( QAction* a )
     if ( myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->text() == idStr )
       if ( myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text() == optionType )
         break;
+  if (custom)
+    row = nbRows;
   // add a row if not found
   if ( row == nbRows ) {
     myAdvWidget->myOptionTable->setRowCount( row+1 );
@@ -2707,8 +2747,17 @@ void BLSURFPluginGUI_HypothesisCreator::onOptionChosenInPopup( QAction* a )
     myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 );
     myAdvWidget->myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( optionType ) );
     myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 );
-    myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( optionName ) );
-    myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
+    if (custom) {
+      myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( "" ) );
+      myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( Qt::ItemIsSelectable |
+                                                                             Qt::ItemIsEditable   |
+                                                                             Qt::ItemIsEnabled );
+      myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setData( Qt::UserRole, QVariant(true) );
+    }
+    else {
+      myAdvWidget->myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( optionName ) );
+      myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
+    }
     myAdvWidget->myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( "" ) );
     myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable |
                                                                             Qt::ItemIsEditable   |
@@ -2716,14 +2765,17 @@ void BLSURFPluginGUI_HypothesisCreator::onOptionChosenInPopup( QAction* a )
     myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
   }
   myAdvWidget->myOptionTable->clearSelection();
-  myAdvWidget->myOptionTable->scrollToItem( myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN ) );
-  //myAdvWidget->myOptionTable->item( row, OPTION_VALUE_COLUMN )->setSelected( true );
-  myAdvWidget->myOptionTable->setCurrentCell( row, OPTION_VALUE_COLUMN );
-  //myAdvWidget->myOptionTable->openPersistentEditor( myOptionTable->item( row, OPTION_VALUE_COLUMN ) );
+  int activeColumn = custom ? OPTION_NAME_COLUMN : OPTION_VALUE_COLUMN;
+  myAdvWidget->myOptionTable->scrollToItem( myAdvWidget->myOptionTable->item( row, activeColumn ) );
+  //myAdvWidget->myOptionTable->item( row, activeColumn )->setSelected( true );
+  myAdvWidget->myOptionTable->setCurrentCell( row, activeColumn );
+  //myAdvWidget->myOptionTable->openPersistentEditor( myOptionTable->item( row, activeColumn ) );
 }
 
 void BLSURFPluginGUI_HypothesisCreator::onDeleteOption()
 {
+  BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
+    BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() );
   // clear option values and remember selected row
   QList<int> selectedRows;
   QList<QTableWidgetItem*> selected = myAdvWidget->myOptionTable->selectedItems();
@@ -2734,11 +2786,23 @@ void BLSURFPluginGUI_HypothesisCreator::onDeleteOption()
       selectedRows.append( row );
       int id = myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->text().toInt();
       QString optionType = myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text();
+      bool custom = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->data(Qt::UserRole).toBool();
+      QString name = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text();
       if ( id >= 0 )
-        if (optionType == "BLSURF" && id < myOptions->length() )
-          myOptions[ id ] = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text().toLatin1().constData();
-        else if (optionType == "PRECAD" && id < myPreCADOptions->length() )
-          myPreCADOptions[ id ] = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text().toLatin1().constData();
+        if ( optionType == "BLSURF" && id < myOptions->length() )
+          if ( custom ) {
+            h->UnsetOption( name.toLatin1().constData() );
+            myOptions[id] = "";
+          }
+          else
+            myOptions[id] = name.toLatin1().constData();
+        else if ( optionType == "PRECAD" && id < myPreCADOptions->length() )
+          if ( custom ) {
+            h->UnsetPreCADOption( name.toLatin1().constData() );
+            myPreCADOptions[id] = "";
+          }
+          else
+            myPreCADOptions[id] = name.toLatin1().constData();
     }
   }
   qSort( selectedRows );
@@ -2748,6 +2812,36 @@ void BLSURFPluginGUI_HypothesisCreator::onDeleteOption()
     myAdvWidget->myOptionTable->removeRow( it.previous() );
 }
 
+void BLSURFPluginGUI_HypothesisCreator::onEditOption( int row, int column )
+{
+  if ( column != OPTION_NAME_COLUMN )
+    return;
+  bool custom = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->data(Qt::UserRole).toBool();
+  if ( !custom )
+    return;
+
+  BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
+    BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() );
+
+  int id = myAdvWidget->myOptionTable->item( row, OPTION_ID_COLUMN )->text().toInt();
+  QString optionType = myAdvWidget->myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().trimmed();
+  QString name = myAdvWidget->myOptionTable->item( row, OPTION_NAME_COLUMN )->text();
+  if ( optionType == "PRECAD"  && id < myPreCADOptions->length() ) {
+    h->UnsetPreCADOption(name.toLatin1().constData());
+    myPreCADOptions[id] = "";
+  }
+  else if ( optionType == "BLSURF" && id < myOptions->length() ) {
+    h->UnsetOption(name.toLatin1().constData());
+    myOptions[id] = "";
+  }
+}
+
+void BLSURFPluginGUI_HypothesisCreator::onChangeOptionName( int row, int column )
+{
+  if ( column != OPTION_NAME_COLUMN )
+    return;
+  myAdvWidget->myOptionTable->resizeColumnToContents( OPTION_NAME_COLUMN );
+}
 // **********************
 // *** BEGIN SIZE MAP ***
 // **********************
index 3a84a86382b247574a3e0c5a76d6eea41512367a..972f544bbf7a1f7111eb65c40acf5dcf7bffc5b8 100644 (file)
@@ -210,6 +210,8 @@ protected slots:
   // Advanced tab
   void                onAddOption();
   void                onDeleteOption();
+  void                onEditOption( int, int );
+  void                onChangeOptionName( int, int );
   void                onOptionChosenInPopup( QAction* );
   // Sizemap tab
   void                onMapGeomContentModified();
index 78e01c3f67edb89c087a6108f75faf4640debe20..2db2607b4277e4110f868e61c8dfb8115bcc265c 100644 (file)
@@ -222,6 +222,10 @@ The smaller this distance is, the closer the mesh is to the exact surface (only
         <source>BLSURF_REMOVE_OPTION</source>
         <translation>Clear option</translation>
     </message>
+    <message>
+        <source>BLSURF_OTHER_OPTION</source>
+        <translation>Other option</translation>
+    </message>
     <message>
         <source>BLSURF_GMF_FILE</source>
         <translation>Export GMF</translation>
index 22c3607316826033f8c09d200306888bff972a93..6bc4feb085eb252238b74f734e66218979b72e06 100755 (executable)
@@ -226,6 +226,10 @@ Plus la distance est petite, plus le maillage sera proche de la surface (disponi
         <source>BLSURF_REMOVE_OPTION</source>
         <translation>Effacer l&apos;option</translation>
     </message>
+    <message>
+        <source>BLSURF_OTHER_OPTION</source>
+        <translation>L&apos;autre option</translation>
+    </message>
     <message>
         <source>BLSURF_GMF_FILE</source>
         <translation>Export GMF</translation>
index 316c55422198d9031fb1e1a387fd13a1205ddb94..efe715252f71ff1a5ef24f82f3d793de18e9a398 100644 (file)
       <source>BLSURF_REMOVE_OPTION</source>
       <translation>オプションを削除します。</translation>
     </message>
+    <message>
+        <source>BLSURF_OTHER_OPTION</source>
+        <translation type="unfinished">Other option</translation>
+    </message>
     <message>
       <source>BLSURF_GMF_FILE</source>
       <translation>エクスポート グループ</translation>