42cf5bc1 |
1 | //-Copyright: Open CASCADE 2014 |
2 | // Created on: 2012-06-09 |
3 | // Created by: jgv@ROLEX |
4 | // Copyright (c) 2012-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _ShapeUpgrade_UnifySameDomain_HeaderFile |
18 | #define _ShapeUpgrade_UnifySameDomain_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <TopoDS_Shape.hxx> |
24 | #include <Standard_Boolean.hxx> |
25 | #include <MMgt_TShared.hxx> |
f7d70540 |
26 | #include <TopTools_DataMapOfShapeShape.hxx> |
42cf5bc1 |
27 | class ShapeBuild_ReShape; |
28 | class TopoDS_Shape; |
29 | |
30 | |
31 | class ShapeUpgrade_UnifySameDomain; |
32 | DEFINE_STANDARD_HANDLE(ShapeUpgrade_UnifySameDomain, MMgt_TShared) |
33 | |
cef6867c |
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 |
42cf5bc1 |
45 | class ShapeUpgrade_UnifySameDomain : public MMgt_TShared |
46 | { |
47 | |
48 | public: |
49 | |
50 | |
51 | //! empty constructor |
52 | Standard_EXPORT ShapeUpgrade_UnifySameDomain(); |
53 | |
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); |
55 | |
cef6867c |
56 | //! Initializes with a shape |
42cf5bc1 |
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); |
58 | |
59 | //! Builds the resulting shape |
60 | Standard_EXPORT void Build(); |
61 | |
62 | //! Gives the resulting shape |
63 | Standard_EXPORT const TopoDS_Shape& Shape() const; |
64 | |
cef6867c |
65 | //! Gets new common shape from the old one |
42cf5bc1 |
66 | Standard_EXPORT TopoDS_Shape Generated (const TopoDS_Shape& aShape) const; |
67 | |
68 | //! this method makes if possible a common face from each |
69 | //! group of faces lying on coincident surfaces |
70 | Standard_EXPORT void UnifyFaces(); |
71 | |
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(); |
75 | |
76 | //! this method unifies same domain faces and edges |
77 | Standard_EXPORT void UnifyFacesAndEdges(); |
78 | |
79 | |
80 | |
81 | |
82 | DEFINE_STANDARD_RTTI(ShapeUpgrade_UnifySameDomain,MMgt_TShared) |
83 | |
84 | protected: |
85 | |
86 | |
87 | |
88 | |
89 | private: |
90 | |
91 | |
92 | TopoDS_Shape myInitShape; |
93 | Standard_Boolean myUnifyFaces; |
94 | Standard_Boolean myUnifyEdges; |
95 | Standard_Boolean myConcatBSplines; |
96 | TopoDS_Shape myShape; |
97 | Handle(ShapeBuild_ReShape) myContext; |
f7d70540 |
98 | TopTools_DataMapOfShapeShape myOldShapes; |
42cf5bc1 |
99 | |
100 | |
101 | }; |
102 | |
103 | |
104 | |
105 | |
106 | |
107 | |
108 | |
109 | #endif // _ShapeUpgrade_UnifySameDomain_HeaderFile |