From a5c88747eadb675c60b9c2f5f47a0e4fc05ece5c Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 8 Oct 2019 18:47:43 +0300 Subject: [PATCH] #17819 [CEA] MeshGems 2.9-6 BLURFPLUGIN advanced properties Convert old options to new ones --- src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx | 10 +++++++++ .../BLSURFPlugin_Hypothesis_i.cxx | 22 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx index cec87ca..9655487 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx @@ -39,6 +39,8 @@ #include CORBA_CLIENT_HEADER(SALOMEDS) #include CORBA_CLIENT_HEADER(GEOM_Gen) +#include + namespace { struct GET_DEFAULT // struct used to get default value from GetOptionValue() @@ -230,6 +232,14 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, boo _defaultOptionValues["compute_ridges" ] = "yes"; } + if ( strcmp( MESHGEMS_VERSION_LONG, "2.9.6" ) < 0 ) + { + std::string missingOption = "allow_patch_independent"; + _defaultOptionValues.erase( missingOption ); + _boolOptions.erase( missingOption ); + _option2value.erase( missingOption ); + } + #ifdef _DEBUG_ // check validity of option names of _defaultOptionValues TOptionValues::iterator n2v = _defaultOptionValues.begin(); diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx index 685440d..d80165b 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx @@ -1414,6 +1414,15 @@ void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const cha else if ( name == "tiny_edge_optimisation_length" ) SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue )); + else if ( name == "proximity" ) + SetVolumeProximity( GetImpl()->ToBool( optionValue )); + + else if ( name == "prox_ratio" ) + SetVolumeProximityRatio( GetImpl()->ToDbl( optionValue )); + + else if ( name == "prox_nb_layer" ) + SetNbVolumeProximityLayers( GetImpl()->ToInt( optionValue )); + // advanced options (for backward compatibility) else if ( name == "create_tag_on_collision" || @@ -1761,7 +1770,18 @@ void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues) void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue) { - ASSERT(myBaseImpl); + // backward compatibility + { + std::string name( optionName ); + if ( name == "proximity" ) + SetVolumeProximity( GetImpl()->ToBool( optionValue )); + + else if ( name == "prox_ratio" ) + SetVolumeProximityRatio( GetImpl()->ToDbl( optionValue )); + + else if ( name == "prox_nb_layer" ) + SetNbVolumeProximityLayers( GetImpl()->ToInt( optionValue )); + } bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue); if (valueChanged) { this->GetImpl()->AddOption(optionName, optionValue); -- 2.39.2