Salome HOME
23051: [CEA 1470] SMESH NetGen - Local refinement not computed and dumped properly cbr/crowdin_V7_6_BR
authoreap <eap@opencascade.com>
Thu, 23 Apr 2015 15:03:26 +0000 (18:03 +0300)
committereap <eap@opencascade.com>
Thu, 23 Apr 2015 15:03:26 +0000 (18:03 +0300)
  Add protection against not published shapes passed to SetLocalSizeOnShape()

idl/NETGENPlugin_Algorithm.idl
src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx
src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx
src/NETGENPlugin/NETGENPlugin_Mesher.cxx

index 16b7a0767a1543a8d868f7e991b78f55c819a1c4..a8f1fd687edb3dc705c2b2ce0634cc4fb52d977b 100644 (file)
@@ -104,7 +104,8 @@ module NETGENPlugin
     void SetFuseEdges(in boolean value);
     boolean GetFuseEdges();
 
-    void SetLocalSizeOnShape(in GEOM::GEOM_Object GeomObj, in double localSize);
+    void SetLocalSizeOnShape(in GEOM::GEOM_Object GeomObj, in double localSize)
+      raises (SALOME::SALOME_Exception);
     void SetLocalSizeOnEntry(in string entry, in double localSize);
     double GetLocalSizeOnEntry(in string entry);
     string_array GetLocalSizeEntries();
index 5055b00e5a0d0ef2cb4ee58ae976d95252b2be4b..2da2e821abcc68d5fb726d3013b2a6b6a858cff8 100644 (file)
@@ -311,9 +311,13 @@ CORBA::Double NETGENPlugin_Hypothesis_i::GetNbSegPerRadius()
 
 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);
 }
 
index 0ffa29129caa5d6516b2f97243e9245f7732a335..0113bcb8572818981bedbdff4750bdefe35c1a0e 100644 (file)
@@ -79,7 +79,8 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
   void SetNbSegPerRadius(CORBA::Double theVal);
   CORBA::Double GetNbSegPerRadius();
 
-  void SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double localSize);
+  void SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double localSize)
+    throw (SALOME::SALOME_Exception);
   void SetLocalSizeOnEntry(const char* entry, CORBA::Double localSize);
   CORBA::Double GetLocalSizeOnEntry(const char* entry);
   NETGENPlugin::string_array* GetLocalSizeEntries();
index 897a2cca3ee4625c67b5655e15dac4149c93b142..d06bbc277accf2a4d9c2d0c6242309b7a3f65769 100644 (file)
@@ -212,8 +212,10 @@ void NETGENPlugin_Mesher::SetDefaultParameters()
  *
  */
 //=============================================================================
+
 void SetLocalSize(TopoDS_Shape GeomShape, double LocalSize)
 {
+  if ( GeomShape.IsNull() ) return;
   TopAbs_ShapeEnum GeomType = GeomShape.ShapeType();
   if (GeomType == TopAbs_COMPOUND) {
     for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()) {