Salome HOME
23338: [CEA 1943] Regression on the quality of the meshes obtained by CADSurf
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis.cxx
index b3bc714cec0d3ad1994786aaf4b433713775b799..d7c494fe82affda5bc5019f76a29ac3301dded6d 100644 (file)
@@ -324,6 +324,7 @@ void BLSURFPlugin_Hypothesis::SetUseGradation(bool theVal) {
 
 //=============================================================================
 void BLSURFPlugin_Hypothesis::SetGradation(double theVal) {
+  _useGradation = ( theVal > 0 );
   if (theVal != _gradation) {
     _gradation = theVal;
     NotifySubMeshesHypothesisModification();
@@ -340,6 +341,7 @@ void BLSURFPlugin_Hypothesis::SetUseVolumeGradation(bool theVal) {
 
 //=============================================================================
 void BLSURFPlugin_Hypothesis::SetVolumeGradation(double theVal) {
+  _useVolumeGradation = ( theVal > 0 );
   if (theVal != _volumeGradation) {
     _volumeGradation = theVal;
     NotifySubMeshesHypothesisModification();
@@ -719,6 +721,7 @@ void BLSURFPlugin_Hypothesis::SetPreCADProcess3DTopology(bool theVal)
   if (theVal != _preCADProcess3DTopology) {
     //     SetTopology(PreCAD);
     _preCADProcess3DTopology = theVal;
+    AddPreCADOption("process_3d_topology", theVal ? "yes" : "no" );
     NotifySubMeshesHypothesisModification();
   }
 }
@@ -734,6 +737,25 @@ void BLSURFPlugin_Hypothesis::SetPreCADDiscardInput(bool theVal)
   }
 }
 
+//=============================================================================
+// Return true if any PreCAD option is activated
+bool BLSURFPlugin_Hypothesis::HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp)
+{
+  if ( !hyp )
+  {
+    return false;
+  }
+  bool orDefault, isOk;
+  return ( ToBool( hyp->GetPreCADOptionValue("closed_geometry"           , &orDefault )) ||
+           ToBool( hyp->GetPreCADOptionValue("discard_input_topology"    , &orDefault )) ||
+           ToBool( hyp->GetPreCADOptionValue("merge_edges"               , &orDefault )) ||
+           ToBool( hyp->GetPreCADOptionValue("remove_duplicate_cad_faces", &orDefault )) ||
+           ToBool( hyp->GetPreCADOption     ("process_3d_topology")      , &isOk       ) ||
+           ToBool( hyp->GetPreCADOption     ("manifold_geometry")        , &isOk       ) ||
+           hyp->GetPreCADOptionValue("sewing_tolerance") != "5e-4*D"                     ||
+           hyp->GetPreCADProcess3DTopology() );
+}
+
 //=============================================================================
 // void BLSURFPlugin_Hypothesis::SetGMFFile(const std::string& theFileName, bool isBinary)
 void BLSURFPlugin_Hypothesis::SetGMFFile(const std::string& theFileName)
@@ -995,9 +1017,9 @@ void BLSURFPlugin_Hypothesis::AddPreCADOption(const std::string& optionName, con
 }
 
 //=============================================================================
-std::string BLSURFPlugin_Hypothesis::GetOption(const std::string& optionName)
+std::string BLSURFPlugin_Hypothesis::GetOption(const std::string& optionName) const
 {
-  TOptionValues::iterator op_val = _customOption2value.find(optionName);
+  TOptionValues::const_iterator op_val = _customOption2value.find(optionName);
   if (op_val != _customOption2value.end())
     return op_val->second;
   else
@@ -1005,9 +1027,9 @@ std::string BLSURFPlugin_Hypothesis::GetOption(const std::string& optionName)
 }
 
 //=============================================================================
-std::string BLSURFPlugin_Hypothesis::GetPreCADOption(const std::string& optionName)
+std::string BLSURFPlugin_Hypothesis::GetPreCADOption(const std::string& optionName) const
 {
-  TOptionValues::iterator op_val = _customOption2value.find(optionName);
+  TOptionValues::const_iterator op_val = _customOption2value.find(optionName);
   if (op_val != _customOption2value.end())
     return op_val->second;
   else