1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0025957: nurbsconvert modifies original shape

- Ensure that the subshapes from the original shape will not be changed after nurbsconvert operation.
For that create the new vertexes (NewPoint(..)) as well as new curves (NewCurve(..)) and new surfaces (NewSurface(..)) before calling of Rebuild() method. Make copies of all vertexes impacted by curve or surface modifications. This eliminates necessity of creation of new vertices during recursive rebuilding of the entire shape.

- Compatibility with the old behavior of BRepTools_Modifier has been retained as an option. For that the new flag MutableInput has been added in the interface of the class.

- This patch also impacts other operations based on BRepTools_Modifier, in the sense that they also become safe regarding input shapes.

- Create new test cases. Some test cases with nurbsconvert command are changed to lock input shapes from modifications.

fix regressions
This commit is contained in:
isn
2016-06-07 07:20:13 +03:00
committed by bugmaster
parent 5a0fc7ce60
commit b47bcd7ea7
12 changed files with 386 additions and 127 deletions

View File

@@ -61,7 +61,8 @@ TopoDS_Shape ShapeProcess_OperLibrary::ApplyModifier (const TopoDS_Shape &S,
const Handle(ShapeProcess_ShapeContext)& context,
const Handle(BRepTools_Modification) &M,
TopTools_DataMapOfShapeShape &map,
const Handle(ShapeExtend_MsgRegistrator) &msg)
const Handle(ShapeExtend_MsgRegistrator) &msg,
Standard_Boolean theMutableInput)
{
// protect against INTERNAL/EXTERNAL shapes
TopoDS_Shape SF = S.Oriented(TopAbs_FORWARD);
@@ -81,7 +82,7 @@ TopoDS_Shape ShapeProcess_OperLibrary::ApplyModifier (const TopoDS_Shape &S,
res = map.Find ( shape ).Oriented ( shape.Orientation() );
else {
res = ApplyModifier (shape, context, M, map );
res = ApplyModifier (shape, context, M, map, 0, theMutableInput );
map.Bind ( shape, res );
}
if ( ! res.IsSame ( shape ) ) locModified = Standard_True;
@@ -95,7 +96,9 @@ TopoDS_Shape ShapeProcess_OperLibrary::ApplyModifier (const TopoDS_Shape &S,
}
// Modify the shape
BRepTools_Modifier MD(SF,M);
BRepTools_Modifier MD(SF);
MD.SetMutableInput(theMutableInput);
MD.Perform(M);
context->RecordModification ( SF, MD, msg );
return MD.ModifiedShape(SF).Oriented(S.Orientation());
}
@@ -118,7 +121,7 @@ static Standard_Boolean directfaces (const Handle(ShapeProcess_Context)& context
Handle(ShapeCustom_DirectModification) DM = new ShapeCustom_DirectModification;
DM->SetMsgRegistrator( msg );
TopTools_DataMapOfShapeShape map;
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, DM, map, msg );
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, DM, map, msg, Standard_True );
ctx->RecordModification ( map, msg );
ctx->SetResult ( res );
return Standard_True;
@@ -271,7 +274,7 @@ static Standard_Boolean bsplinerestriction (const Handle(ShapeProcess_Context)&
aMaxDeg, aMaxSeg, ModeDeg, Rational, aParameters );
LD->SetMsgRegistrator( msg );
TopTools_DataMapOfShapeShape map;
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, LD, map, msg );
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, LD, map, msg, Standard_True );
ctx->RecordModification ( map, msg );
ctx->SetResult ( res );
return Standard_True;
@@ -295,7 +298,7 @@ static Standard_Boolean torevol (const Handle(ShapeProcess_Context)& context)
Handle(ShapeCustom_ConvertToRevolution) CR = new ShapeCustom_ConvertToRevolution();
CR->SetMsgRegistrator( msg );
TopTools_DataMapOfShapeShape map;
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, CR, map, msg );
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, CR, map, msg, Standard_True );
ctx->RecordModification ( map, msg );
ctx->SetResult ( res );
return Standard_True;
@@ -319,7 +322,7 @@ static Standard_Boolean swepttoelem (const Handle(ShapeProcess_Context)& context
Handle(ShapeCustom_SweptToElementary) SE = new ShapeCustom_SweptToElementary();
SE->SetMsgRegistrator( msg );
TopTools_DataMapOfShapeShape map;
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, SE, map, msg );
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier ( ctx->Result(), ctx, SE, map, msg, Standard_True );
ctx->RecordModification ( map, msg );
ctx->SetResult ( res );
return Standard_True;
@@ -415,7 +418,7 @@ static Standard_Boolean converttobspline (const Handle(ShapeProcess_Context)& co
CBspl->SetMsgRegistrator( msg );
TopTools_DataMapOfShapeShape map;
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier( ctx->Result(), ctx, CBspl, map, msg );
TopoDS_Shape res = ShapeProcess_OperLibrary::ApplyModifier( ctx->Result(), ctx, CBspl, map, msg, Standard_True );
ctx->RecordModification ( map, msg );
ctx->SetResult ( res );
return Standard_True;

View File

@@ -57,7 +57,14 @@ public:
//! Applies BRepTools_Modification to a shape,
//! taking into account sharing of components of compounds.
Standard_EXPORT static TopoDS_Shape ApplyModifier (const TopoDS_Shape& S, const Handle(ShapeProcess_ShapeContext)& context, const Handle(BRepTools_Modification)& M, TopTools_DataMapOfShapeShape& map, const Handle(ShapeExtend_MsgRegistrator)& msg = 0);
//! if theMutableInput vat is set to true then imput shape S
//! can be modified during the modification process.
Standard_EXPORT static TopoDS_Shape ApplyModifier (const TopoDS_Shape& S,
const Handle(ShapeProcess_ShapeContext)& context,
const Handle(BRepTools_Modification)& M,
TopTools_DataMapOfShapeShape& map,
const Handle(ShapeExtend_MsgRegistrator)& msg = 0,
Standard_Boolean theMutableInput = Standard_False);