From a8a5da334dadc50caf6032bfb0666ae4f0044e08 Mon Sep 17 00:00:00 2001 From: mpa Date: Tue, 21 Jul 2015 13:14:14 +0300 Subject: [PATCH] 0023088: [CEA 1480] Able to indicate a new option by name, in addition to the already advanced options --- .../gui/BLSURFPLUGIN/input/blsurf_hypo.doc | 3 + idl/BLSURFPlugin_Algorithm.idl | 12 +- resources/BLSURFPlugin.xml | 2 + src/BLSURFPlugin/BLSURFPluginBuilder.py | 16 ++ src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx | 19 +- src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx | 214 +++++++++++++++++- src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx | 8 + .../BLSURFPlugin_Hypothesis_i.cxx | 136 ++++++++--- .../BLSURFPlugin_Hypothesis_i.hxx | 5 + src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx | 168 +++++++++++--- src/GUI/BLSURFPluginGUI_HypothesisCreator.h | 2 + src/GUI/BLSURFPlugin_msg_en.ts | 4 + src/GUI/BLSURFPlugin_msg_fr.ts | 4 + src/GUI/BLSURFPlugin_msg_ja.ts | 4 + 14 files changed, 525 insertions(+), 72 deletions(-) diff --git a/doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc b/doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc index 5017d4b..81f4075 100644 --- a/doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc +++ b/doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc @@ -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 "" 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 diff --git a/idl/BLSURFPlugin_Algorithm.idl b/idl/BLSURFPlugin_Algorithm.idl index 4992593..8d2f751 100644 --- a/idl/BLSURFPlugin_Algorithm.idl +++ b/idl/BLSURFPlugin_Algorithm.idl @@ -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); diff --git a/resources/BLSURFPlugin.xml b/resources/BLSURFPlugin.xml index d10f9d6..7d2f103 100644 --- a/resources/BLSURFPlugin.xml +++ b/resources/BLSURFPlugin.xml @@ -41,6 +41,8 @@ SetPreCADOptionValue, UnsetOption, UnsetPreCADOption, + AddOption, + AddPreCADOption, SetSizeMap, SetConstantSizeMap, UnsetSizeMap, diff --git a/src/BLSURFPlugin/BLSURFPluginBuilder.py b/src/BLSURFPlugin/BLSURFPluginBuilder.py index 8399cf1..f06850f 100644 --- a/src/BLSURFPlugin/BLSURFPluginBuilder.py +++ b/src/BLSURFPlugin/BLSURFPluginBuilder.py @@ -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 diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index bb54f93..1bace84 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -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 diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx index 445ae35..992fbd3 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx @@ -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__") diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx index 73cd865..43a4aab 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx @@ -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; diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx index b929b59..beaddc1 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx @@ -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); diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx index 5b7b3c8..8a0663c 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx @@ -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); diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index 800a493..fc6f957 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -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 selectedRows; QList 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 *** // ********************** diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.h b/src/GUI/BLSURFPluginGUI_HypothesisCreator.h index 3a84a86..972f544 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.h +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.h @@ -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(); diff --git a/src/GUI/BLSURFPlugin_msg_en.ts b/src/GUI/BLSURFPlugin_msg_en.ts index 78e01c3..2db2607 100644 --- a/src/GUI/BLSURFPlugin_msg_en.ts +++ b/src/GUI/BLSURFPlugin_msg_en.ts @@ -222,6 +222,10 @@ The smaller this distance is, the closer the mesh is to the exact surface (only BLSURF_REMOVE_OPTION Clear option + + BLSURF_OTHER_OPTION + Other option + BLSURF_GMF_FILE Export GMF diff --git a/src/GUI/BLSURFPlugin_msg_fr.ts b/src/GUI/BLSURFPlugin_msg_fr.ts index 22c3607..6bc4feb 100755 --- a/src/GUI/BLSURFPlugin_msg_fr.ts +++ b/src/GUI/BLSURFPlugin_msg_fr.ts @@ -226,6 +226,10 @@ Plus la distance est petite, plus le maillage sera proche de la surface (disponi BLSURF_REMOVE_OPTION Effacer l'option + + BLSURF_OTHER_OPTION + L'autre option + BLSURF_GMF_FILE Export GMF diff --git a/src/GUI/BLSURFPlugin_msg_ja.ts b/src/GUI/BLSURFPlugin_msg_ja.ts index 316c554..efe7152 100644 --- a/src/GUI/BLSURFPlugin_msg_ja.ts +++ b/src/GUI/BLSURFPlugin_msg_ja.ts @@ -211,6 +211,10 @@ BLSURF_REMOVE_OPTION オプションを削除します。 + + BLSURF_OTHER_OPTION + Other option + BLSURF_GMF_FILE エクスポート グループ -- 2.39.2