mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0028707: Simplify type 'BRepTools_ReShape'
Type 'BRepTools_ReShape' was simplified: - the functionality to process shapes different only in orientation by different ways was removed as it is not used anywhere; - method 'Apply' with the build mode parameter was moved to type 'ShapeBuild_ReShape' as it is used only through the last type.
This commit is contained in:
@@ -46,7 +46,101 @@ TopoDS_Shape ShapeBuild_ReShape::Apply (const TopoDS_Shape& shape,
|
||||
const TopAbs_ShapeEnum until,
|
||||
const Standard_Integer buildmode)
|
||||
{
|
||||
return BRepTools_ReShape::Apply (shape,until,buildmode);
|
||||
if (shape.IsNull()) return shape;
|
||||
TopoDS_Shape newsh;
|
||||
if (Status (shape,newsh,Standard_False) != 0) return newsh;
|
||||
|
||||
TopAbs_ShapeEnum st = shape.ShapeType();
|
||||
if (st == until) return newsh; // critere d arret
|
||||
|
||||
Standard_Integer modif = 0;
|
||||
if (st == TopAbs_COMPOUND || st == TopAbs_COMPSOLID) {
|
||||
BRep_Builder B;
|
||||
TopoDS_Compound C;
|
||||
B.MakeCompound (C);
|
||||
for (TopoDS_Iterator it (shape); it.More(); it.Next()) {
|
||||
TopoDS_Shape sh = it.Value();
|
||||
Standard_Integer stat = Status (sh,newsh,Standard_False);
|
||||
if (stat != 0) modif = 1;
|
||||
if (stat >= 0) B.Add (C,newsh);
|
||||
}
|
||||
if (modif == 0) return shape;
|
||||
return C;
|
||||
}
|
||||
|
||||
if (st == TopAbs_SOLID) {
|
||||
BRep_Builder B;
|
||||
TopoDS_Compound C;
|
||||
B.MakeCompound (C);
|
||||
TopoDS_Solid S;
|
||||
B.MakeSolid (S);
|
||||
for (TopoDS_Iterator it (shape); it.More(); it.Next()) {
|
||||
TopoDS_Shape sh = it.Value();
|
||||
newsh = Apply (sh,until,buildmode);
|
||||
if (newsh.IsNull()) {
|
||||
modif = -1;
|
||||
}
|
||||
else if (newsh.ShapeType() != TopAbs_SHELL) {
|
||||
Standard_Integer nbsub = 0;
|
||||
for (TopExp_Explorer exh(newsh,TopAbs_SHELL); exh.More(); exh.Next()) {
|
||||
TopoDS_Shape onesh = exh.Current ();
|
||||
B.Add (S,onesh);
|
||||
nbsub ++;
|
||||
}
|
||||
if (nbsub == 0) modif = -1;
|
||||
B.Add (C,newsh); // c est tout
|
||||
}
|
||||
else {
|
||||
if (modif == 0 && !sh.IsEqual(newsh)) modif = 1;
|
||||
B.Add (C,newsh);
|
||||
B.Add (S,newsh);
|
||||
}
|
||||
}
|
||||
|
||||
if ( (modif < 0 && buildmode < 2) || (modif == 0 && buildmode < 1) )
|
||||
return C;
|
||||
else
|
||||
return S;
|
||||
}
|
||||
|
||||
if (st == TopAbs_SHELL) {
|
||||
BRep_Builder B;
|
||||
TopoDS_Compound C;
|
||||
B.MakeCompound (C);
|
||||
TopoDS_Shell S;
|
||||
B.MakeShell (S);
|
||||
for (TopoDS_Iterator it (shape); it.More(); it.Next()) {
|
||||
TopoDS_Shape sh = it.Value();
|
||||
newsh = Apply (sh,until,buildmode);
|
||||
if (newsh.IsNull()) {
|
||||
modif = -1;
|
||||
}
|
||||
else if (newsh.ShapeType() != TopAbs_FACE) {
|
||||
Standard_Integer nbsub = 0;
|
||||
for (TopExp_Explorer exf(newsh,TopAbs_FACE); exf.More(); exf.Next()) {
|
||||
TopoDS_Shape onesh = exf.Current ();
|
||||
B.Add (S,onesh);
|
||||
nbsub ++;
|
||||
}
|
||||
if (nbsub == 0) modif = -1;
|
||||
B.Add (C,newsh); // c est tout
|
||||
}
|
||||
else {
|
||||
if (modif == 0 && !sh.IsEqual(newsh)) modif = 1;
|
||||
B.Add (C,newsh);
|
||||
B.Add (S,newsh);
|
||||
}
|
||||
}
|
||||
if ( (modif < 0 && buildmode < 2) || (modif == 0 && buildmode < 1) )
|
||||
return C;
|
||||
else
|
||||
{
|
||||
S.Closed (BRep_Tool::IsClosed (S));
|
||||
return S;
|
||||
}
|
||||
}
|
||||
cout<<"BRepTools_ReShape::Apply NOT YET IMPLEMENTED"<<endl;
|
||||
return shape;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -51,7 +51,7 @@ public:
|
||||
|
||||
//! Returns an empty Reshape
|
||||
Standard_EXPORT ShapeBuild_ReShape();
|
||||
|
||||
|
||||
//! Applies the substitutions requests to a shape
|
||||
//!
|
||||
//! <until> gives the level of type until which requests are taken
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
//! 2: Replace and Remove are both ignored
|
||||
//! If Replace/Remove are ignored or absent, the result as same
|
||||
//! type as the starting shape
|
||||
Standard_EXPORT virtual TopoDS_Shape Apply (const TopoDS_Shape& shape, const TopAbs_ShapeEnum until, const Standard_Integer buildmode) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual TopoDS_Shape Apply (const TopoDS_Shape& shape, const TopAbs_ShapeEnum until, const Standard_Integer buildmode);
|
||||
|
||||
//! Applies the substitutions requests to a shape.
|
||||
//!
|
||||
|
Reference in New Issue
Block a user