Salome HOME
Merge changes from 'master' branch.
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPlugin_Hypothesis_i.cxx
index 17bdd35a19da2d78ae6cf9f87a02460621ab5f59..63eb164091fb88698105298e74882947c543ca26 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -30,7 +30,6 @@
 #include "NETGENPlugin_Hypothesis_i.hxx"
 #include "SMESH_Gen.hxx"
 #include "SMESH_PythonDump.hxx"
-#include "GEOM_Object.hxx"
 
 #include "Utils_CorbaException.hxx"
 #include "utilities.h"
@@ -60,15 +59,12 @@ bool NETGENPlugin_Hypothesis_i::isToSetParameter<double>(double curValue,
 //=============================================================================
 NETGENPlugin_Hypothesis_i::
 NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
-                           int                     theStudyId,
                            ::SMESH_Gen*            theGenImpl)
   : SALOME::GenericObj_i( thePOA ), 
     SMESH_Hypothesis_i( thePOA ),
     mySetMethodFlags(0)
 {
-  MESSAGE( "NETGENPlugin_Hypothesis_i::NETGENPlugin_Hypothesis_i" );
   myBaseImpl = new ::NETGENPlugin_Hypothesis (theGenImpl->GetANewId(),
-                                              theStudyId,
                                               theGenImpl);
 }
 
@@ -81,7 +77,6 @@ NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
 //=============================================================================
 NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i()
 {
-  MESSAGE( "NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i" );
 }
 
 //=============================================================================
@@ -310,11 +305,45 @@ CORBA::Double NETGENPlugin_Hypothesis_i::GetNbSegPerRadius()
 
 //=============================================================================
 
+void NETGENPlugin_Hypothesis_i::SetChordalErrorEnabled(CORBA::Boolean theValue)
+{
+  if ( isToSetParameter( GetChordalErrorEnabled(), theValue, METH_SetChordalErrorEnabled ))
+  {
+    this->GetImpl()->SetChordalErrorEnabled(theValue);
+    SMESH::TPythonDump() << _this() << ".SetChordalErrorEnabled( " << theValue << " )";
+  }
+}
+
+CORBA::Boolean NETGENPlugin_Hypothesis_i::GetChordalErrorEnabled()
+{
+  return GetImpl()->GetChordalErrorEnabled();
+}
+
+void NETGENPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue)
+{
+  if ( isToSetParameter( GetChordalError(), theValue, METH_SetChordalError ))
+  {
+    this->GetImpl()->SetChordalError(theValue);
+    SMESH::TPythonDump() << _this() << ".SetChordalError( " << SMESH::TVar(theValue) << " )";
+  }
+}
+
+CORBA::Double NETGENPlugin_Hypothesis_i::GetChordalError()
+{
+  return GetImpl()->GetChordalError();
+}
+
+//=============================================================================
+
 void NETGENPlugin_Hypothesis_i::SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj,
                                                     CORBA::Double         localSize)
+  throw (SALOME::SALOME_Exception)
 {
   string entry;
   entry = GeomObj->GetStudyEntry();
+  if ( entry.empty() )
+    THROW_SALOME_CORBA_EXCEPTION( "SetLocalSizeOnShape(), shape is not published in study!",
+                                  SALOME::BAD_PARAM );
   SetLocalSizeOnEntry(entry.c_str(), localSize);
 }
 
@@ -360,7 +389,25 @@ NETGENPlugin::string_array* NETGENPlugin_Hypothesis_i::GetLocalSizeEntries()
 void NETGENPlugin_Hypothesis_i::UnsetLocalSizeOnEntry(const char* entry)
 {
   this->GetImpl()->UnsetLocalSizeOnEntry(entry);
-  SMESH::TPythonDump() << _this() << ".UnsetLocalSizeOnEntry(" << entry << ")";
+  SMESH::TPythonDump() << _this() << ".UnsetLocalSizeOnEntry(\"" << entry << "\")";
+}
+
+//=============================================================================
+
+void NETGENPlugin_Hypothesis_i::SetMeshSizeFile(const char* fileName)
+{
+  if ( GetImpl()->GetMeshSizeFile() != fileName )
+  {
+    GetImpl()->SetMeshSizeFile( fileName );
+    SMESH::TPythonDump() << _this() << ".SetMeshSizeFile( '" << fileName << "' )";
+  }
+}
+
+//=============================================================================
+
+char* NETGENPlugin_Hypothesis_i::GetMeshSizeFile()
+{
+  return CORBA::string_dup( GetImpl()->GetMeshSizeFile().c_str() );
 }
 
 //=============================================================================
@@ -383,6 +430,46 @@ CORBA::Boolean NETGENPlugin_Hypothesis_i::GetQuadAllowed()
   return this->GetImpl()->GetQuadAllowed();
 }
 
+//=============================================================================
+
+void NETGENPlugin_Hypothesis_i::SetUseSurfaceCurvature (CORBA::Boolean theValue)
+{
+  if ( NETGENPlugin_Hypothesis_i::isToSetParameter( GetUseSurfaceCurvature(),
+                                                    theValue,
+                                                    METH_SetSurfaceCurvature ))
+  {
+    this->GetImpl()->SetSurfaceCurvature(theValue);
+    SMESH::TPythonDump() << _this() << ".SetUseSurfaceCurvature( " << theValue << " )";
+  }
+}
+
+//=============================================================================
+
+CORBA::Boolean NETGENPlugin_Hypothesis_i::GetUseSurfaceCurvature()
+{
+  return this->GetImpl()->GetSurfaceCurvature();
+}
+
+//=============================================================================
+
+void NETGENPlugin_Hypothesis_i::SetFuseEdges (CORBA::Boolean theValue)
+{
+  if ( NETGENPlugin_Hypothesis_i::isToSetParameter( GetFuseEdges(),
+                                                    theValue,
+                                                    METH_SetFuseEdges ))
+  {
+    this->GetImpl()->SetFuseEdges(theValue);
+    SMESH::TPythonDump() << _this() << ".SetFuseEdges( " << theValue << " )";
+  }
+}
+
+//=============================================================================
+
+CORBA::Boolean NETGENPlugin_Hypothesis_i::GetFuseEdges()
+{
+  return this->GetImpl()->GetFuseEdges();
+}
+
 //=============================================================================
 /*!
  *  NETGENPlugin_Hypothesis_i::GetImpl