mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0025520: To provide info on what has been done by Shape Process and Shape Fix
Messages are registered in ShapeExtend_MsgRegistrator added to ShapeCutom and ShapeUpgrade packages All operators of ShapeProcess_OperLibrary are instrumented with MsgRegistrator 0025520: To provide info on what has been done by Shape Process and Shape Fix Update SHAPE.fr Fix some messages (minor change)
This commit is contained in:
@@ -40,7 +40,8 @@ uses
|
||||
UOperator from ShapeProcess,
|
||||
ShapeContext from ShapeProcess,
|
||||
Modification from BRepTools,
|
||||
DataMapOfShapeShape from TopTools
|
||||
DataMapOfShapeShape from TopTools,
|
||||
MsgRegistrator from ShapeExtend
|
||||
|
||||
is
|
||||
|
||||
@@ -50,7 +51,8 @@ is
|
||||
ApplyModifier (myclass; S: Shape from TopoDS;
|
||||
context: ShapeContext from ShapeProcess;
|
||||
M: Modification from BRepTools;
|
||||
map: in out DataMapOfShapeShape from TopTools)
|
||||
map: in out DataMapOfShapeShape from TopTools;
|
||||
msg : MsgRegistrator from ShapeExtend=0)
|
||||
---Purpose: Applies BRepTools_Modification to a shape,
|
||||
-- taking into account sharing of components of compounds.
|
||||
returns Shape from TopoDS;
|
||||
|
@@ -67,7 +67,8 @@
|
||||
TopoDS_Shape ShapeProcess_OperLibrary::ApplyModifier (const TopoDS_Shape &S,
|
||||
const Handle(ShapeProcess_ShapeContext)& context,
|
||||
const Handle(BRepTools_Modification) &M,
|
||||
TopTools_DataMapOfShapeShape &map)
|
||||
TopTools_DataMapOfShapeShape &map,
|
||||
const Handle(ShapeExtend_MsgRegistrator) &msg)
|
||||
{
|
||||
// protect against INTERNAL/EXTERNAL shapes
|
||||
TopoDS_Shape SF = S.Oriented(TopAbs_FORWARD);
|
||||
@@ -102,7 +103,7 @@ TopoDS_Shape ShapeProcess_OperLibrary::ApplyModifier (const TopoDS_Shape &S,
|
||||
|
||||
// Modify the shape
|
||||
BRepTools_Modifier MD(SF,M);
|
||||
context->RecordModification ( SF, MD );
|
||||
context->RecordModification ( SF, MD, msg );
|
||||
return MD.ModifiedShape(SF).Oriented(S.Orientation());
|
||||
}
|
||||
|
||||
@@ -117,10 +118,15 @@ static Standard_Boolean directfaces (const Handle(ShapeProcess_Context)& context
|
||||
Handle(ShapeProcess_ShapeContext) ctx = 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;
|
||||
|
||||
Handle(ShapeCustom_DirectModification) DM = new ShapeCustom_DirectModification;
|
||||
DM->SetMsgRegistrator( msg );
|
||||
TopTools_DataMapOfShapeShape map;
|
||||
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, DM, map );
|
||||
ctx->RecordModification ( map );
|
||||
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, DM, map, msg );
|
||||
ctx->RecordModification ( map, msg );
|
||||
ctx->SetResult ( res );
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -128,17 +134,29 @@ static Standard_Boolean directfaces (const Handle(ShapeProcess_Context)& context
|
||||
|
||||
//=======================================================================
|
||||
//function : sameparam
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean sameparam (const Handle(ShapeProcess_Context)& context)
|
||||
{
|
||||
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
|
||||
if ( ctx.IsNull() ) return Standard_False;
|
||||
ShapeFix::SameParameter ( ctx->Result(),
|
||||
ctx->IntegerVal ( "Force", Standard_False ),
|
||||
ctx->RealVal ( "Tolerance3d", Precision::Confusion() /* -1 */) );
|
||||
// WARNING: no update of context yet!
|
||||
|
||||
// activate message mechanism if it is supported by context
|
||||
Handle(ShapeExtend_MsgRegistrator) msg;
|
||||
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
|
||||
|
||||
ShapeFix::SameParameter ( ctx->Result(),
|
||||
ctx->IntegerVal ( "Force", Standard_False ),
|
||||
ctx->RealVal ( "Tolerance3d", Precision::Confusion() /* -1 */),
|
||||
NULL, msg );
|
||||
|
||||
if ( !msg.IsNull() )
|
||||
{
|
||||
// WARNING: not FULL update of context yet!
|
||||
Handle(ShapeBuild_ReShape) reshape = new ShapeBuild_ReShape;
|
||||
ctx->RecordModification( reshape, msg );
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -175,25 +193,30 @@ static Standard_Boolean settol (const Handle(ShapeProcess_Context)& context)
|
||||
|
||||
//=======================================================================
|
||||
//function : splitangle
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Boolean splitangle (const Handle(ShapeProcess_Context)& context)
|
||||
{
|
||||
Handle(ShapeProcess_ShapeContext) ctx = 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;
|
||||
|
||||
ShapeUpgrade_ShapeDivideAngle SDA ( ctx->RealVal ( "Angle", 2*M_PI ), ctx->Result() );
|
||||
SDA.SetMaxTolerance ( ctx->RealVal ( "MaxTolerance", 1. ) );
|
||||
|
||||
SDA.SetMsgRegistrator ( msg );
|
||||
|
||||
if ( ! SDA.Perform() && SDA.Status (ShapeExtend_FAIL) ) {
|
||||
#ifdef OCCT_DEBUG
|
||||
cout<<"ShapeDivideAngle failed"<<endl;
|
||||
#endif
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
ctx->RecordModification ( SDA.GetContext() );
|
||||
|
||||
ctx->RecordModification ( SDA.GetContext(), msg );
|
||||
ctx->SetResult ( SDA.Result() );
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -209,6 +232,10 @@ static Standard_Boolean bsplinerestriction (const Handle(ShapeProcess_Context)&
|
||||
Handle(ShapeProcess_ShapeContext) ctx = 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;
|
||||
|
||||
Standard_Boolean ModeSurf = ctx->IntegerVal ( "SurfaceMode", Standard_True );
|
||||
Standard_Boolean ModeC3d = ctx->IntegerVal ( "Curve3dMode", Standard_True );
|
||||
Standard_Boolean ModeC2d = ctx->IntegerVal ( "Curve2dMode", Standard_True );
|
||||
@@ -249,9 +276,10 @@ static Standard_Boolean bsplinerestriction (const Handle(ShapeProcess_Context)&
|
||||
new ShapeCustom_BSplineRestriction ( ModeSurf, ModeC3d, ModeC2d,
|
||||
aTol3d, aTol2d, aCont3d, aCont2d,
|
||||
aMaxDeg, aMaxSeg, ModeDeg, Rational, aParameters );
|
||||
LD->SetMsgRegistrator( msg );
|
||||
TopTools_DataMapOfShapeShape map;
|
||||
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, LD, map );
|
||||
ctx->RecordModification ( map );
|
||||
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, LD, map, msg );
|
||||
ctx->RecordModification ( map, msg );
|
||||
ctx->SetResult ( res );
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -267,11 +295,15 @@ static Standard_Boolean torevol (const Handle(ShapeProcess_Context)& context)
|
||||
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast ( context );
|
||||
if ( ctx.IsNull() ) return Standard_False;
|
||||
|
||||
Handle(ShapeCustom_ConvertToRevolution) CR =
|
||||
new ShapeCustom_ConvertToRevolution();
|
||||
// activate message mechanism if it is supported by context
|
||||
Handle(ShapeExtend_MsgRegistrator) msg;
|
||||
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
|
||||
|
||||
Handle(ShapeCustom_ConvertToRevolution) CR = new ShapeCustom_ConvertToRevolution();
|
||||
CR->SetMsgRegistrator( msg );
|
||||
TopTools_DataMapOfShapeShape map;
|
||||
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, CR, map );
|
||||
ctx->RecordModification ( map );
|
||||
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, CR, map, msg );
|
||||
ctx->RecordModification ( map, msg );
|
||||
ctx->SetResult ( res );
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -287,10 +319,15 @@ static Standard_Boolean swepttoelem (const Handle(ShapeProcess_Context)& context
|
||||
Handle(ShapeProcess_ShapeContext) ctx = 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;
|
||||
|
||||
Handle(ShapeCustom_SweptToElementary) SE = new ShapeCustom_SweptToElementary();
|
||||
SE->SetMsgRegistrator( msg );
|
||||
TopTools_DataMapOfShapeShape map;
|
||||
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, SE, map );
|
||||
ctx->RecordModification ( map );
|
||||
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, SE, map, msg );
|
||||
ctx->RecordModification ( map, msg );
|
||||
ctx->SetResult ( res );
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -306,6 +343,10 @@ static Standard_Boolean shapetobezier (const Handle(ShapeProcess_Context)& conte
|
||||
Handle(ShapeProcess_ShapeContext) ctx = 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;
|
||||
|
||||
Standard_Boolean ModeC3d = ctx->BooleanVal ( "Curve3dMode", Standard_False );
|
||||
Standard_Boolean ModeC2d = ctx->BooleanVal ( "Curve2dMode", Standard_False );
|
||||
Standard_Boolean ModeSurf = ctx->BooleanVal ( "SurfaceMode", Standard_False );
|
||||
@@ -319,6 +360,7 @@ static Standard_Boolean shapetobezier (const Handle(ShapeProcess_Context)& conte
|
||||
Standard_Boolean BSplineMode = ctx->BooleanVal ( "BSplineMode", Standard_True );
|
||||
|
||||
ShapeUpgrade_ShapeConvertToBezier SCB (ctx->Result());
|
||||
SCB.SetMsgRegistrator( msg );
|
||||
SCB.SetSurfaceSegmentMode(SegmentMode);
|
||||
SCB.SetSurfaceConversion (ModeSurf);
|
||||
SCB.Set2dConversion (ModeC2d);
|
||||
@@ -349,7 +391,7 @@ static Standard_Boolean shapetobezier (const Handle(ShapeProcess_Context)& conte
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
ctx->RecordModification ( SCB.GetContext() );
|
||||
ctx->RecordModification ( SCB.GetContext(), msg );
|
||||
ctx->SetResult ( SCB.Result() );
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -365,6 +407,10 @@ static Standard_Boolean converttobspline (const Handle(ShapeProcess_Context)& co
|
||||
Handle(ShapeProcess_ShapeContext) ctx = 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;
|
||||
|
||||
Standard_Boolean extrMode = ctx->BooleanVal ( "LinearExtrusionMode", Standard_True );
|
||||
Standard_Boolean revolMode = ctx->BooleanVal ( "RevolutionMode", Standard_True );
|
||||
Standard_Boolean offsetMode = ctx->BooleanVal ( "OffsetMode", Standard_True );
|
||||
@@ -373,10 +419,11 @@ static Standard_Boolean converttobspline (const Handle(ShapeProcess_Context)& co
|
||||
CBspl->SetExtrusionMode(extrMode);
|
||||
CBspl->SetRevolutionMode(revolMode);
|
||||
CBspl->SetOffsetMode(offsetMode);
|
||||
CBspl->SetMsgRegistrator( msg );
|
||||
|
||||
TopTools_DataMapOfShapeShape map;
|
||||
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, CBspl, map );
|
||||
ctx->RecordModification ( map );
|
||||
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier( ctx->Result(), ctx, CBspl, map, msg );
|
||||
ctx->RecordModification ( map, msg );
|
||||
ctx->SetResult ( res );
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -392,6 +439,10 @@ static Standard_Boolean splitcontinuity (const Handle(ShapeProcess_Context)& con
|
||||
Handle(ShapeProcess_ShapeContext) ctx = 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;
|
||||
|
||||
Standard_Real aTol = ctx->RealVal ( "Tolerance3d", 1.e-7 );
|
||||
Standard_Real aTol2D = ctx->RealVal ( "Tolerance2d", 1.e-9 );
|
||||
GeomAbs_Shape aCrvCont = ctx->ContinuityVal ( "CurveContinuity", GeomAbs_C1 );
|
||||
@@ -403,7 +454,9 @@ static Standard_Boolean splitcontinuity (const Handle(ShapeProcess_Context)& con
|
||||
tool.SetPCurveCriterion(aCrv2dCont);
|
||||
tool.SetTolerance(aTol);
|
||||
tool.SetTolerance2d(aTol2D);
|
||||
|
||||
|
||||
tool.SetMsgRegistrator( msg );
|
||||
|
||||
Standard_Real maxTol;
|
||||
if ( ctx->GetReal ( "MaxTolerance", maxTol ) ) tool.SetMaxTolerance(maxTol);
|
||||
|
||||
@@ -414,7 +467,7 @@ static Standard_Boolean splitcontinuity (const Handle(ShapeProcess_Context)& con
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
ctx->RecordModification ( tool.GetContext() );
|
||||
ctx->RecordModification ( tool.GetContext(), msg );
|
||||
ctx->SetResult ( tool.Result() );
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -430,7 +483,12 @@ static Standard_Boolean splitclosedfaces (const Handle(ShapeProcess_Context)& co
|
||||
Handle(ShapeProcess_ShapeContext) ctx = 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;
|
||||
|
||||
ShapeUpgrade_ShapeDivideClosed tool ( ctx->Result() );
|
||||
tool.SetMsgRegistrator( msg );
|
||||
|
||||
Standard_Real closeTol;
|
||||
if ( ctx->GetReal ( "CloseTolerance", closeTol ) ) tool.SetPrecision(closeTol);
|
||||
@@ -451,7 +509,7 @@ static Standard_Boolean splitclosedfaces (const Handle(ShapeProcess_Context)& co
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
ctx->RecordModification ( tool.GetContext() );
|
||||
ctx->RecordModification ( tool.GetContext(), msg );
|
||||
ctx->SetResult ( tool.Result() );
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -467,10 +525,15 @@ static Standard_Boolean fixfacesize (const Handle(ShapeProcess_Context)& context
|
||||
Handle(ShapeProcess_ShapeContext) ctx = 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;
|
||||
|
||||
Handle(ShapeBuild_ReShape) reshape = new ShapeBuild_ReShape;
|
||||
ShapeFix_FixSmallFace FSC;
|
||||
FSC.SetContext(reshape);
|
||||
FSC.Init(ctx->Result());
|
||||
FSC.SetMsgRegistrator ( msg );
|
||||
|
||||
Standard_Real aTol;
|
||||
if ( ctx->GetReal ( "Tolerance", aTol ) ) FSC.SetPrecision (aTol);
|
||||
@@ -479,7 +542,7 @@ static Standard_Boolean fixfacesize (const Handle(ShapeProcess_Context)& context
|
||||
TopoDS_Shape newsh = FSC.Shape();
|
||||
|
||||
if ( newsh != ctx->Result() ) {
|
||||
ctx->RecordModification ( reshape );
|
||||
ctx->RecordModification ( reshape, msg );
|
||||
ctx->SetResult ( newsh );
|
||||
}
|
||||
|
||||
@@ -497,17 +560,22 @@ static Standard_Boolean fixwgaps (const Handle(ShapeProcess_Context)& context)
|
||||
Handle(ShapeProcess_ShapeContext) ctx = 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;
|
||||
|
||||
Standard_Real aTol3d = ctx->RealVal ( "Tolerance3d", Precision::Confusion() );
|
||||
|
||||
Handle(ShapeBuild_ReShape) reshape = new ShapeBuild_ReShape;
|
||||
Handle(ShapeFix_Wireframe) sfwf = new ShapeFix_Wireframe(ctx->Result());
|
||||
sfwf->SetMsgRegistrator( msg );
|
||||
sfwf->SetContext(reshape);
|
||||
sfwf->SetPrecision(aTol3d);
|
||||
sfwf->FixWireGaps();
|
||||
TopoDS_Shape result = sfwf->Shape();
|
||||
|
||||
if ( result != ctx->Result() ) {
|
||||
ctx->RecordModification ( reshape );
|
||||
ctx->RecordModification ( reshape, msg );
|
||||
ctx->SetResult ( result );
|
||||
}
|
||||
return Standard_True;
|
||||
@@ -589,15 +657,20 @@ static Standard_Boolean mergesmalledges (const Handle(ShapeProcess_Context)& con
|
||||
Handle(ShapeProcess_ShapeContext) ctx = 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;
|
||||
|
||||
Standard_Real aTol3d = ctx->RealVal ( "Tolerance3d", Precision::Confusion() );
|
||||
|
||||
Handle(ShapeBuild_ReShape) reshape = new ShapeBuild_ReShape;
|
||||
ShapeFix_Wireframe ShapeFixWireframe(ctx->Result());
|
||||
ShapeFixWireframe.SetContext(reshape);
|
||||
ShapeFixWireframe.SetPrecision(aTol3d);
|
||||
ShapeFixWireframe.SetMsgRegistrator( msg );
|
||||
|
||||
if ( ShapeFixWireframe.FixSmallEdges() ) {
|
||||
ctx->RecordModification ( reshape );
|
||||
ctx->RecordModification ( reshape, msg );
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -618,9 +691,9 @@ static Standard_Boolean fixshape (const Handle(ShapeProcess_Context)& context)
|
||||
if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
|
||||
|
||||
Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
|
||||
sfs->SetMsgRegistrator ( msg );
|
||||
Handle(ShapeFix_Face) sff = Handle(ShapeFix_Face)::DownCast(sfs->FixFaceTool());
|
||||
Handle(ShapeFix_Wire) sfw = Handle(ShapeFix_Wire)::DownCast(sfs->FixWireTool());
|
||||
sfs->SetMsgRegistrator( msg );
|
||||
|
||||
sfs->SetPrecision ( ctx->RealVal ( "Tolerance3d", Precision::Confusion() ) );
|
||||
sfs->SetMinTolerance ( ctx->RealVal ( "MinTolerance3d", Precision::Confusion() ) );
|
||||
@@ -681,7 +754,9 @@ static Standard_Boolean fixshape (const Handle(ShapeProcess_Context)& context)
|
||||
return Standard_False;
|
||||
|
||||
TopoDS_Shape result = sfs->Shape();
|
||||
if ( result != ctx->Result() ) {
|
||||
if (( result != ctx->Result() ) ||
|
||||
( !msg.IsNull() && !msg->MapShape().IsEmpty()))
|
||||
{
|
||||
ctx->RecordModification ( sfs->Context(), msg );
|
||||
ctx->SetResult ( result );
|
||||
}
|
||||
@@ -700,10 +775,15 @@ static Standard_Boolean spltclosededges (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;
|
||||
|
||||
Standard_Integer nbSplits = ctx->IntegerVal ( "NbSplitPoints", 1 );
|
||||
|
||||
ShapeUpgrade_ShapeDivideClosedEdges tool (ctx->Result());
|
||||
tool.SetNbSplitPoints(nbSplits);
|
||||
tool.SetMsgRegistrator( msg );
|
||||
|
||||
if ( ! tool.Perform() && tool.Status (ShapeExtend_FAIL) ) {
|
||||
#ifdef OCCT_DEBUG
|
||||
@@ -712,7 +792,7 @@ static Standard_Boolean spltclosededges (const Handle(ShapeProcess_Context)& con
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
ctx->RecordModification ( tool.GetContext() );
|
||||
ctx->RecordModification ( tool.GetContext(), msg );
|
||||
ctx->SetResult ( tool.Result() );
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -729,16 +809,22 @@ static Standard_Boolean splitcommonvertex (const Handle(ShapeProcess_Context)& c
|
||||
Handle(ShapeProcess_ShapeContext) ctx = 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;
|
||||
|
||||
Handle(ShapeBuild_ReShape) reshape = new ShapeBuild_ReShape;
|
||||
ShapeFix_SplitCommonVertex SCV;
|
||||
SCV.SetContext(reshape);
|
||||
SCV.Init(ctx->Result());
|
||||
|
||||
SCV.SetMsgRegistrator( msg );
|
||||
|
||||
SCV.Perform();
|
||||
TopoDS_Shape newsh = SCV.Shape();
|
||||
|
||||
if ( newsh != ctx->Result() ) {
|
||||
ctx->RecordModification ( reshape );
|
||||
ctx->RecordModification ( reshape, msg );
|
||||
ctx->SetResult ( newsh );
|
||||
}
|
||||
|
||||
|
@@ -81,12 +81,14 @@ is
|
||||
-- with explicit definition of mapping from current
|
||||
-- result to a new one
|
||||
|
||||
RecordModification (me: mutable; repl: DataMapOfShapeShape from TopTools);
|
||||
RecordModification (me: mutable; repl: DataMapOfShapeShape from TopTools;
|
||||
msg : MsgRegistrator from ShapeExtend=0);
|
||||
RecordModification (me: mutable; repl: ReShape from ShapeBuild;
|
||||
msg : MsgRegistrator from ShapeExtend);
|
||||
RecordModification (me: mutable; repl: ReShape from ShapeBuild);
|
||||
RecordModification (me: mutable; sh : Shape from TopoDS;
|
||||
repl: Modifier from BRepTools);
|
||||
repl: Modifier from BRepTools;
|
||||
msg : MsgRegistrator from ShapeExtend=0);
|
||||
---Purpose: Records modifications and resets result accordingly
|
||||
-- NOTE: modification of resulting shape should be explicitly
|
||||
-- defined in the maps along with modifications of subshapes
|
||||
|
@@ -168,7 +168,9 @@ static void DumpMap (const TopTools_DataMapOfShapeShape &map)
|
||||
|
||||
static void RecModif (const TopoDS_Shape &S,
|
||||
const TopTools_DataMapOfShapeShape &repl,
|
||||
const Handle(ShapeExtend_MsgRegistrator) &msg,
|
||||
TopTools_DataMapOfShapeShape &map,
|
||||
Handle(ShapeExtend_MsgRegistrator) &myMsg,
|
||||
const TopAbs_ShapeEnum until)
|
||||
{
|
||||
TopoDS_Shape r = S;
|
||||
@@ -218,17 +220,35 @@ static void RecModif (const TopoDS_Shape &S,
|
||||
if ( res != r ) map.Bind ( S.Located(aNullLoc), res );
|
||||
}
|
||||
|
||||
// update messages (messages must be taken from each level in the substitution map)
|
||||
if ( ! r.IsNull() && ! myMsg.IsNull() &&
|
||||
! msg.IsNull() && msg->MapShape().Extent() >0 )
|
||||
{
|
||||
const ShapeExtend_DataMapOfShapeListOfMsg& msgmap = msg->MapShape();
|
||||
if ( msgmap.IsBound( r )) {
|
||||
const Message_ListOfMsg &msglist = msgmap.Find (r);
|
||||
for (Message_ListIteratorOfListOfMsg iter (msglist); iter.More(); iter.Next())
|
||||
myMsg->Send ( S, iter.Value(), Message_Warning );
|
||||
}
|
||||
else if ( msgmap.IsBound( S )) {
|
||||
const Message_ListOfMsg &msglist = msgmap.Find (S);
|
||||
for (Message_ListIteratorOfListOfMsg iter (msglist); iter.More(); iter.Next())
|
||||
myMsg->Send ( S, iter.Value(), Message_Warning );
|
||||
}
|
||||
}
|
||||
|
||||
if ( until == TopAbs_SHAPE || S.ShapeType() >= until ) return;
|
||||
|
||||
for ( TopoDS_Iterator it(S); it.More(); it.Next() ) {
|
||||
RecModif ( it.Value(), repl, map, until );
|
||||
RecModif ( it.Value(), repl, msg, map, myMsg, until );
|
||||
}
|
||||
}
|
||||
|
||||
void ShapeProcess_ShapeContext::RecordModification (const TopTools_DataMapOfShapeShape &repl)
|
||||
void ShapeProcess_ShapeContext::RecordModification (const TopTools_DataMapOfShapeShape &repl,
|
||||
const Handle(ShapeExtend_MsgRegistrator)& msg)
|
||||
{
|
||||
if ( repl.Extent() <=0 ) return;
|
||||
RecModif ( myShape, repl, myMap, myUntil );
|
||||
RecModif ( myShape, repl, msg, myMap, myMsg, myUntil );
|
||||
if ( myMap.IsBound(myShape) ) myResult = myMap.Find ( myShape );
|
||||
#ifdef OCCT_DEBUG
|
||||
// cout << "Modifier: " << endl; DumpMap (myMap);
|
||||
@@ -274,6 +294,8 @@ static void RecModif (const TopoDS_Shape &S,
|
||||
! msg.IsNull() && msg->MapShape().Extent() >0 ) {
|
||||
TopoDS_Shape cur, next = r;
|
||||
const ShapeExtend_DataMapOfShapeListOfMsg& msgmap = msg->MapShape();
|
||||
if ( msgmap.IsBound( S ))
|
||||
next = S;
|
||||
do {
|
||||
cur = next;
|
||||
if (msgmap.IsBound (cur)) {
|
||||
@@ -288,7 +310,7 @@ static void RecModif (const TopoDS_Shape &S,
|
||||
|
||||
if ( until == TopAbs_SHAPE || S.ShapeType() >= until ) return;
|
||||
|
||||
for ( TopoDS_Iterator it(S,Standard_False,Standard_False); it.More(); it.Next() ) {
|
||||
for ( TopoDS_Iterator it(S,Standard_False/*,Standard_False*/); it.More(); it.Next() ) {
|
||||
RecModif ( it.Value(), repl, msg, map, myMsg, until );
|
||||
}
|
||||
}
|
||||
@@ -354,11 +376,12 @@ static void ExplodeModifier (const TopoDS_Shape &S,
|
||||
}
|
||||
|
||||
void ShapeProcess_ShapeContext::RecordModification (const TopoDS_Shape &S,
|
||||
const BRepTools_Modifier &repl)
|
||||
const BRepTools_Modifier &repl,
|
||||
const Handle(ShapeExtend_MsgRegistrator)& msg)
|
||||
{
|
||||
TopTools_DataMapOfShapeShape map;
|
||||
ExplodeModifier ( S, repl, map, myUntil );
|
||||
RecordModification ( map );
|
||||
RecordModification ( map, msg );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
Reference in New Issue
Block a user