mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0026458: BRepBuilderAPI_Copy does not copy mesh structure
* The possibility to copy mesh is implemented. It may be enabled by copyMesh flag, by default it is disabled. * Poly_Triangulation::Copy() method is added. * The mesh is copied if and only if copyMesh flag is true.
This commit is contained in:
@@ -24,13 +24,16 @@
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
|
||||
//! Tool class implementing necessary functionality for copying geometry
|
||||
class BRepBuilderAPI_Copy_Modification : public BRepTools_Modification
|
||||
{
|
||||
public:
|
||||
BRepBuilderAPI_Copy_Modification (const Standard_Boolean copyGeom)
|
||||
: myCopyGeom(copyGeom)
|
||||
BRepBuilderAPI_Copy_Modification (const Standard_Boolean copyGeom,
|
||||
const Standard_Boolean copyMesh = Standard_False)
|
||||
: myCopyGeom(copyGeom),
|
||||
myCopyMesh(copyMesh)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -50,6 +53,23 @@ public:
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy triangulation;
|
||||
//! copies it if required
|
||||
Standard_Boolean NewTriangulation(const TopoDS_Face& F, Handle(Poly_Triangulation)& T)
|
||||
{
|
||||
if (!myCopyMesh)
|
||||
return Standard_False;
|
||||
|
||||
TopLoc_Location L;
|
||||
T = BRep_Tool::Triangulation(F, L);
|
||||
|
||||
if (T.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
T = T->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//! Returns true to indicate the need to copy edge;
|
||||
//! copies curves if requested
|
||||
Standard_Boolean NewCurve (const TopoDS_Edge& E, Handle(Geom_Curve)& C,
|
||||
@@ -118,6 +138,7 @@ public:
|
||||
|
||||
private:
|
||||
Standard_Boolean myCopyGeom;
|
||||
Standard_Boolean myCopyMesh;
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(BRepBuilderAPI_Copy_Modification, BRepTools_Modification)
|
||||
@@ -139,9 +160,9 @@ BRepBuilderAPI_Copy::BRepBuilderAPI_Copy ()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom)
|
||||
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom, const Standard_Boolean copyMesh)
|
||||
{
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom);
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom, copyMesh);
|
||||
DoModif(S);
|
||||
}
|
||||
|
||||
@@ -151,9 +172,9 @@ BRepBuilderAPI_Copy::BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_B
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepBuilderAPI_Copy::Perform(const TopoDS_Shape& S, const Standard_Boolean copyGeom)
|
||||
void BRepBuilderAPI_Copy::Perform(const TopoDS_Shape& S, const Standard_Boolean copyGeom, const Standard_Boolean copyMesh)
|
||||
{
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom);
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(copyGeom, copyMesh);
|
||||
NotDone(); // on force la copie si on vient deja d`en faire une
|
||||
DoModif(S);
|
||||
}
|
||||
|
@@ -48,13 +48,13 @@ public:
|
||||
//! geometry will be shared with original shape.
|
||||
//! Note: the constructed framework can be reused to copy
|
||||
//! other shapes: just specify them with the function Perform.
|
||||
Standard_EXPORT BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom = Standard_True);
|
||||
Standard_EXPORT BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom = Standard_True, const Standard_Boolean copyMesh = Standard_False);
|
||||
|
||||
//! Copies the shape S.
|
||||
//! Use the function Shape to access the result.
|
||||
//! If copyGeom is False, only topological objects will be copied, while
|
||||
//! geometry will be shared with original shape.
|
||||
Standard_EXPORT void Perform (const TopoDS_Shape& S, const Standard_Boolean copyGeom = Standard_True);
|
||||
Standard_EXPORT void Perform (const TopoDS_Shape& S, const Standard_Boolean copyGeom = Standard_True, const Standard_Boolean copyMesh = Standard_False);
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user