1 //-Copyright: Open CASCADE 2014
2 // Created on: 2012-06-09
3 // Created by: jgv@ROLEX
4 // Copyright (c) 2012-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _ShapeUpgrade_UnifySameDomain_HeaderFile
18 #define _ShapeUpgrade_UnifySameDomain_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <TopoDS_Shape.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <MMgt_TShared.hxx>
26 #include <TopTools_DataMapOfShapeShape.hxx>
27 class ShapeBuild_ReShape;
31 class ShapeUpgrade_UnifySameDomain;
32 DEFINE_STANDARD_HANDLE(ShapeUpgrade_UnifySameDomain, MMgt_TShared)
34 //! This tool tries to unify faces and edges of the shape which lies on the same geometry.
35 //! Faces/edges considering as 'same-domain' if a group of neighbouring faces/edges lying on coincident surfaces/curves.
36 //! In this case these faces/edges can be unified into one face/edge.
37 //! ShapeUpgrade_UnifySameDomain initialized by the shape and the next optional parameters:
38 //! UnifyFaces - tries to unify all possible faces
39 //! UnifyEdges - tries to unify all possible edges
40 //! ConcatBSplines - if this flag set to true then all neighbouring edges which lays
41 //! on the BSpline or Bezier curves with C1 continuity on their common vertices will be merged into one common edge
42 //! The output result of tool is an unified shape
43 //! All the modifications of initial shape are recorded during unifying.
44 //! Method Generated() can be used to obtain the new (unified) shape from the old one
45 class ShapeUpgrade_UnifySameDomain : public MMgt_TShared
52 Standard_EXPORT ShapeUpgrade_UnifySameDomain();
54 Standard_EXPORT ShapeUpgrade_UnifySameDomain(const TopoDS_Shape& aShape, const Standard_Boolean UnifyEdges = Standard_True, const Standard_Boolean UnifyFaces = Standard_True, const Standard_Boolean ConcatBSplines = Standard_False);
56 //! Initializes with a shape
57 Standard_EXPORT void Initialize (const TopoDS_Shape& aShape, const Standard_Boolean UnifyEdges = Standard_True, const Standard_Boolean UnifyFaces = Standard_True, const Standard_Boolean ConcatBSplines = Standard_False);
59 //! Builds the resulting shape
60 Standard_EXPORT void Build();
62 //! Gives the resulting shape
63 Standard_EXPORT const TopoDS_Shape& Shape() const;
65 //! Gets new common shape from the old one
66 Standard_EXPORT TopoDS_Shape Generated (const TopoDS_Shape& aShape) const;
68 //! this method makes if possible a common face from each
69 //! group of faces lying on coincident surfaces
70 Standard_EXPORT void UnifyFaces();
72 //! this method makes if possible a common edge from each
73 //! group of edges connecting common couple of faces
74 Standard_EXPORT void UnifyEdges();
76 //! this method unifies same domain faces and edges
77 Standard_EXPORT void UnifyFacesAndEdges();
82 DEFINE_STANDARD_RTTIEXT(ShapeUpgrade_UnifySameDomain,MMgt_TShared)
92 TopoDS_Shape myInitShape;
93 Standard_Boolean myUnifyFaces;
94 Standard_Boolean myUnifyEdges;
95 Standard_Boolean myConcatBSplines;
97 Handle(ShapeBuild_ReShape) myContext;
98 TopTools_DataMapOfShapeShape myOldShapes;
109 #endif // _ShapeUpgrade_UnifySameDomain_HeaderFile