0025604: To provide info on what has been done by DropSmallSolids operator
authoreap <eap@opencascade.com>
Fri, 12 Dec 2014 17:09:46 +0000 (20:09 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 25 Dec 2014 13:27:27 +0000 (16:27 +0300)
src/SHMessage/SHAPE.fr
src/SHMessage/SHAPE.us
src/ShapeFix/ShapeFix_FixSmallSolid.cdl
src/ShapeFix/ShapeFix_FixSmallSolid.cxx
src/ShapeProcess/ShapeProcess_OperLibrary.cxx

index a1fe1e3..02aa950 100755 (executable)
@@ -186,6 +186,15 @@ Spot face removed
 Strip face removed
 !
 ! ------------------------------------------------------------------------------
+! Messages for ShapeFix_FixSmallSolid
+!
+.ShapeFix.FixSmallSolid.MSG0
+Small solid removed
+!
+.ShapeFix.FixSmallSolid.MSG1
+Small solid merged with other
+!
+! ------------------------------------------------------------------------------
 ! Messages for ShapeFix_Shell
 !
 .FixAdvShell.FixOrientation.MSG0
index cf5808f..1c708c6 100755 (executable)
@@ -186,6 +186,15 @@ Spot face removed
 Strip face removed
 !
 ! ------------------------------------------------------------------------------
+! Messages for ShapeFix_FixSmallSolid
+!
+.ShapeFix.FixSmallSolid.MSG0
+Small solid removed
+!
+.ShapeFix.FixSmallSolid.MSG1
+Small solid merged with other
+!
+! ------------------------------------------------------------------------------
 ! Messages for ShapeFix_Shell
 !
 .FixAdvShell.FixOrientation.MSG0
index 6905446..9b5f663 100644 (file)
@@ -13,7 +13,7 @@
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-class FixSmallSolid from ShapeFix
+class FixSmallSolid from ShapeFix inherits Root from ShapeFix
 
        ---Purpose: Fixing solids with small size
 
@@ -25,10 +25,10 @@ is
     Create returns FixSmallSolid;
     ---Purpose: Construct
 
-    SetVolumeThreshold (me: in out; theThreshold: Real = -1.0);
+    SetVolumeThreshold (me: mutable; theThreshold: Real = -1.0);
     ---Purpose: Set or clear volume threshold for small solids
 
-    SetWidthFactorThreshold (me: in out; theThreshold: Real = -1.0);
+    SetWidthFactorThreshold (me: mutable; theThreshold: Real = -1.0);
     ---Purpose: Set or clear width factor threshold for small solids
 
     Remove(me; theShape: Shape from TopoDS; theContext: ReShape from ShapeBuild)
index f2b2e25..dfeb260 100644 (file)
@@ -33,6 +33,7 @@
 #include <BRepGProp.hxx>
 #include <BRep_Builder.hxx>
 #include <ShapeBuild_ReShape.hxx>
+#include <Message_Msg.hxx>
 
 //=======================================================================
 //function : ShapeFix_FixSmallSolid
@@ -102,7 +103,10 @@ TopoDS_Shape ShapeFix_FixSmallSolid::Remove (
   {
     const TopoDS_Shape& aSolid = aSolidIter.Current();
     if (IsSmall (aSolid))
+    {
       theContext->Remove (aSolid);
+      SendWarning ( aSolid, Message_Msg( "ShapeFix.FixSmallSolid.MSG0" ));
+    }
   }
 
   // Return updated shape
@@ -441,6 +445,7 @@ TopoDS_Shape ShapeFix_FixSmallSolid::Merge (
         // remove the small solid
         theContext->Remove (aSmallSolid);
         aSmallSolids.Remove (aSolidIter);
+        SendWarning ( aSmallSolid, Message_Msg( "ShapeFix.FixSmallSolid.MSG1" ));
       }
       else
         aSolidIter.Next();
index 040c6bf..42f621d 100644 (file)
@@ -592,7 +592,12 @@ static Standard_Boolean dropsmallsolids (const Handle(ShapeProcess_Context)& con
     Handle(ShapeProcess_ShapeContext)::DownCast (context);
   if (ctx.IsNull()) return Standard_False;
 
+  // activate message mechanism if it is supported by context
+  Handle(ShapeExtend_MsgRegistrator) msg;
+  if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
+
   ShapeFix_FixSmallSolid FSS;
+  FSS.SetMsgRegistrator( msg );
 
   Standard_Real aThreshold;
   if (ctx->GetReal ("VolumeThreshold", aThreshold))
@@ -613,7 +618,7 @@ static Standard_Boolean dropsmallsolids (const Handle(ShapeProcess_Context)& con
 
   if (aResult != ctx->Result())
   {
-    ctx->RecordModification (aReShape);
+    ctx->RecordModification (aReShape, msg);
     ctx->SetResult (aResult);
   }