1 // Created on: 1999-04-15
2 // Created by: Roman LYGIN
3 // Copyright (c) 1999 Matra Datavision
4 // Copyright (c) 1999-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_WireDivide_HeaderFile
18 #define _ShapeUpgrade_WireDivide_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <TopoDS_Face.hxx>
24 #include <TopoDS_Wire.hxx>
25 #include <Standard_Integer.hxx>
26 #include <ShapeUpgrade_Tool.hxx>
27 #include <ShapeExtend_Status.hxx>
28 class ShapeUpgrade_SplitCurve3d;
29 class ShapeUpgrade_SplitCurve2d;
30 class ShapeUpgrade_EdgeDivide;
31 class ShapeAnalysis_TransferParameters;
32 class ShapeUpgrade_FixSmallCurves;
35 class TopLoc_Location;
37 // resolve name collisions with X11 headers
42 class ShapeUpgrade_WireDivide;
43 DEFINE_STANDARD_HANDLE(ShapeUpgrade_WireDivide, ShapeUpgrade_Tool)
45 //! Divides edges in the wire lying on the face or free wires or
46 //! free edges with a criterion.
47 //! Splits 3D curve and pcurve(s) of the edge on the face.
48 //! Other pcurves which may be associated with the edge are simply
50 //! If 3D curve is split then pcurve on the face is split as
51 //! well, and vice-versa.
52 //! Input shape is not modified.
53 //! The modifications made are recorded in external context
54 //! (ShapeBuild_ReShape). This tool is applied to all edges
55 //! before splitting them in order to keep sharing.
56 class ShapeUpgrade_WireDivide : public ShapeUpgrade_Tool
63 Standard_EXPORT ShapeUpgrade_WireDivide();
65 //! Initializes by wire and face
66 Standard_EXPORT void Init (const TopoDS_Wire& W, const TopoDS_Face& F);
68 //! Initializes by wire and surface
69 Standard_EXPORT void Init (const TopoDS_Wire& W, const Handle(Geom_Surface)& S);
71 //! Loads working wire
72 Standard_EXPORT void Load (const TopoDS_Wire& W);
74 //! Creates wire of one edge and calls Load for wire
75 Standard_EXPORT void Load (const TopoDS_Edge& E);
77 //! Sets supporting surface by face
78 Standard_EXPORT void SetFace (const TopoDS_Face& F);
80 //! Sets supporting surface
81 Standard_EXPORT void SetSurface (const Handle(Geom_Surface)& S);
83 //! Sets supporting surface with location
84 Standard_EXPORT void SetSurface (const Handle(Geom_Surface)& S, const TopLoc_Location& L);
86 //! Computes the resulting wire by splitting all the edges
87 //! according to splitting criteria.
88 //! All the modifications made are recorded in context
89 //! (ShapeBuild_ReShape). This tool is applied to all edges
90 //! before splitting them in order to keep sharings.
91 //! If no supporting face or surface is defined, only 3d
92 //! splitting criteria are used.
93 Standard_EXPORT virtual void Perform();
95 //! Gives the resulting Wire (equal to initial one if not done
96 //! or Null if not loaded)
97 Standard_EXPORT const TopoDS_Wire& Wire() const;
99 //! Queries status of last call to Perform()
100 //! OK - no edges were split, wire left untouched
101 //! DONE1 - some edges were split
102 //! FAIL1 - some edges have no 3d curve (skipped)
103 //! FAIL2 - some edges have no pcurve (skipped)
104 Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
106 //! Sets the tool for splitting 3D curves.
107 Standard_EXPORT void SetSplitCurve3dTool (const Handle(ShapeUpgrade_SplitCurve3d)& splitCurve3dTool);
109 //! Sets the tool for splitting pcurves.
110 Standard_EXPORT void SetSplitCurve2dTool (const Handle(ShapeUpgrade_SplitCurve2d)& splitCurve2dTool);
112 //! Sets the tool for Transfer parameters between curves and pcurves.
113 Standard_EXPORT void SetTransferParamTool (const Handle(ShapeAnalysis_TransferParameters)& TransferParam);
115 //! Sets tool for splitting edge
116 Standard_EXPORT void SetEdgeDivideTool (const Handle(ShapeUpgrade_EdgeDivide)& edgeDivideTool);
118 //! returns tool for splitting edges
119 Standard_EXPORT virtual Handle(ShapeUpgrade_EdgeDivide) GetEdgeDivideTool() const;
121 //! Returns the tool for Transfer of parameters.
122 Standard_EXPORT virtual Handle(ShapeAnalysis_TransferParameters) GetTransferParamTool();
124 //! Sets mode for splitting 3d curves from edges.
125 //! 0 - only curve 3d from free edges.
126 //! 1 - only curve 3d from shared edges.
127 //! 2 - all curve 3d.
128 Standard_EXPORT void SetEdgeMode (const Standard_Integer EdgeMode);
130 //! Sets tool for fixing small curves with specified min tolerance;
131 Standard_EXPORT void SetFixSmallCurveTool (const Handle(ShapeUpgrade_FixSmallCurves)& FixSmallCurvesTool);
133 //! Returns tool for fixing small curves
134 Standard_EXPORT Handle(ShapeUpgrade_FixSmallCurves) GetFixSmallCurveTool() const;
139 DEFINE_STANDARD_RTTIEXT(ShapeUpgrade_WireDivide,ShapeUpgrade_Tool)
144 //! Returns the tool for splitting 3D curves.
145 Standard_EXPORT virtual Handle(ShapeUpgrade_SplitCurve3d) GetSplitCurve3dTool() const;
147 //! Returns the tool for splitting pcurves.
148 Standard_EXPORT virtual Handle(ShapeUpgrade_SplitCurve2d) GetSplitCurve2dTool() const;
152 Standard_Integer myStatus;
153 Standard_Integer myEdgeMode;
159 Handle(ShapeUpgrade_SplitCurve3d) mySplitCurve3dTool;
160 Handle(ShapeUpgrade_SplitCurve2d) mySplitCurve2dTool;
161 Handle(ShapeUpgrade_EdgeDivide) myEdgeDivide;
162 Handle(ShapeAnalysis_TransferParameters) myTransferParamTool;
163 Handle(ShapeUpgrade_FixSmallCurves) myFixSmallCurveTool;
174 #endif // _ShapeUpgrade_WireDivide_HeaderFile