]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
53541: squish: MG-CADSurf Hypothesis Construction does not work correctly
authoreap <eap@opencascade.com>
Thu, 25 Aug 2016 12:26:35 +0000 (15:26 +0300)
committereap <eap@opencascade.com>
Thu, 25 Aug 2016 12:26:35 +0000 (15:26 +0300)
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx

index b3bc714cec0d3ad1994786aaf4b433713775b799..be2f6c70d67f95a22f6bd4e34bd0e088c21e68be 100644 (file)
@@ -325,6 +325,7 @@ void BLSURFPlugin_Hypothesis::SetUseGradation(bool theVal) {
 //=============================================================================
 void BLSURFPlugin_Hypothesis::SetGradation(double theVal) {
   if (theVal != _gradation) {
+    _useGradation = ( theVal > 0 );
     _gradation = theVal;
     NotifySubMeshesHypothesisModification();
   }
@@ -341,6 +342,7 @@ void BLSURFPlugin_Hypothesis::SetUseVolumeGradation(bool theVal) {
 //=============================================================================
 void BLSURFPlugin_Hypothesis::SetVolumeGradation(double theVal) {
   if (theVal != _volumeGradation) {
+    _useVolumeGradation = ( theVal > 0 );
     _volumeGradation = theVal;
     NotifySubMeshesHypothesisModification();
   }
index fb13d351099250bf5f766e808d815673ab5055bd..e5c3c0da60a291befb9e128d47a108a9ee2dcac9 100644 (file)
@@ -249,9 +249,12 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() {
 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue) {
   MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseGradation");
   ASSERT(myBaseImpl);
-  this->GetImpl()->SetUseGradation(theValue);
-  std::string theValueStr = theValue ? "True" : "False";
-  SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
+  if ( GetImpl()->GetUseGradation() != bool( theValue ))
+  {
+    this->GetImpl()->SetUseGradation(theValue);
+    std::string theValueStr = theValue ? "True" : "False";
+    SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
+  }
 }
 
 //=============================================================================
@@ -278,7 +281,11 @@ void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
   ASSERT(myBaseImpl);
   this->GetImpl()->SetGradation(theValue);
-  SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
+
+  if ( theValue < 0 )
+    SetUseGradation( false );
+  else
+    SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
 }
 
 //=============================================================================
@@ -304,9 +311,12 @@ CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue) {
   MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation");
   ASSERT(myBaseImpl);
-  this->GetImpl()->SetUseVolumeGradation(theValue);
-  std::string theValueStr = theValue ? "True" : "False";
-  SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
+  if ( GetImpl()->GetUseVolumeGradation() != bool( theValue ))
+  {
+    this->GetImpl()->SetUseVolumeGradation(theValue);
+    std::string theValueStr = theValue ? "True" : "False";
+    SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
+  }
 }
 
 //=============================================================================
@@ -333,7 +343,10 @@ void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue) {
   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetVolumeGradation");
   ASSERT(myBaseImpl);
   this->GetImpl()->SetVolumeGradation(theValue);
-  SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
+  if ( theValue < 0 )
+    SetUseVolumeGradation( false );
+  else
+    SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
 }
 
 //=============================================================================
@@ -1339,11 +1352,19 @@ void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, con
     else if ( name == "tiny_edge_optimisation_length" )
       SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
 
+    else if ( name == "remove_tiny_uv_edges" )
+      SetPreCADRemoveTinyUVEdges( GetImpl()->ToBool( optionValue ));
+
+    else if ( name == "process_3d_topology" )
+      SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
+
     // advanced options (for backward compatibility)
 
     else if ( name == "create_tag_on_collision" ||
-              name == "tiny_edge_respect_geometry" )
-      AddOption( optionName, optionValue );
+              name == "tiny_edge_respect_geometry" ||
+              name == "remove_tiny_edges" ||
+              name == "tiny_edge_length")
+      AddPreCADOption( optionName, optionValue );
 
     else {
       valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
@@ -3872,10 +3893,10 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
 }
 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
   std::string theValueStr = theValue ? "1" : "0";
-  this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
+  this->AddPreCADOption("remove_tiny_edges",theValueStr.c_str());
 }
 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
-  std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
+  std::string theValueStr = this->GetPreCADOption("remove_tiny_edges");
   if (theValueStr == "1")
       return true;
   return false;
@@ -3883,10 +3904,10 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
   std::ostringstream theValueStr;
   theValueStr << theValue;
-  this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
+  this->AddPreCADOption("tiny_edge_length",theValueStr.str().c_str());
 }
 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
-  std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
+  std::istringstream theValueStr(this->GetPreCADOption("tiny_edge_length"));
   double result;
   theValueStr >> result;
   return result;
index aecdbe569a53afa9a0c5b5c11f736654bcfaf525..fb0f67270d23b5b0a26fbb3183b9614db3869238 100644 (file)
@@ -2525,10 +2525,10 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes
   h_data.myMinSizeRel            = myStdWidget->myMinSizeRel->isChecked();
   h_data.myMaxSize               = myStdWidget->myMaxSize->text().isEmpty() ? -1.0 : myStdWidget->myMaxSize->GetValue();
   h_data.myMaxSizeRel            = myStdWidget->myMaxSizeRel->isChecked();
-  h_data.myUseGradation          = myStdWidget->myUseGradation->isChecked();
-  h_data.myGradation             = myStdWidget->myGradation->text().isEmpty() ? -1.0 : myStdWidget->myGradation->GetValue();
-  h_data.myUseVolumeGradation    = myStdWidget->myUseVolumeGradation->isChecked();
-  h_data.myVolumeGradation       = myStdWidget->myVolumeGradation->text().isEmpty() ? -1.0 : myStdWidget->myVolumeGradation->GetValue();
+  h_data.myUseGradation          = myStdWidget->myUseGradation->isChecked() && !myStdWidget->myGradation->text().isEmpty();
+  h_data.myGradation             = h_data.myUseGradation ? myStdWidget->myGradation->GetValue() : -1.0;
+  h_data.myUseVolumeGradation    = myStdWidget->myUseVolumeGradation->isChecked() && !myStdWidget->myVolumeGradation->text().isEmpty();
+  h_data.myVolumeGradation       = h_data.myUseVolumeGradation ? myStdWidget->myVolumeGradation->GetValue() : -1. ;
   h_data.myAllowQuadrangles      = myStdWidget->myAllowQuadrangles->isChecked();
   h_data.myAngleMesh             = myStdWidget->myAngleMesh->text().isEmpty() ? -1.0 : myStdWidget->myAngleMesh->GetValue();
   h_data.myChordalError          = myStdWidget->myChordalError->text().isEmpty() ? -1.0 : myStdWidget->myChordalError->GetValue();