1 // Created on: 1998-02-18
2 // Created by: Pierre BARRAS
3 // Copyright (c) 1998-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_FaceDivide_HeaderFile
18 #define _ShapeUpgrade_FaceDivide_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <TopoDS_Face.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <ShapeUpgrade_Tool.hxx>
27 #include <ShapeExtend_Status.hxx>
28 class ShapeUpgrade_SplitSurface;
29 class ShapeUpgrade_WireDivide;
31 // resolve name collisions with X11 headers
36 class ShapeUpgrade_FaceDivide;
37 DEFINE_STANDARD_HANDLE(ShapeUpgrade_FaceDivide, ShapeUpgrade_Tool)
39 //! Divides a Face (both edges in the wires, by splitting
40 //! curves and pcurves, and the face itself, by splitting
41 //! supporting surface) according to splitting criteria.
42 //! * The domain of the face to divide is defined by the PCurves
43 //! of the wires on the Face.
45 //! * all the PCurves are supposed to be defined (in the parametric
46 //! space of the supporting surface).
48 //! The result is available after the call to the Build method.
49 //! It is a Shell containing all the resulting Faces.
51 //! All the modifications made during splitting are recorded in the
52 //! external context (ShapeBuild_ReShape).
53 class ShapeUpgrade_FaceDivide : public ShapeUpgrade_Tool
59 //! Creates empty constructor.
60 Standard_EXPORT ShapeUpgrade_FaceDivide();
62 //! Initialize by a Face.
63 Standard_EXPORT ShapeUpgrade_FaceDivide(const TopoDS_Face& F);
65 //! Initialize by a Face.
66 Standard_EXPORT void Init (const TopoDS_Face& F);
68 //! Purpose sets mode for trimming (segment) surface by
70 Standard_EXPORT void SetSurfaceSegmentMode (const Standard_Boolean Segment);
72 //! Performs splitting and computes the resulting shell
73 //! The context is used to keep track of former splittings
74 //! in order to keep sharings. It is updated according to
75 //! modifications made.
76 Standard_EXPORT virtual Standard_Boolean Perform();
78 //! Performs splitting of surface and computes the shell
80 Standard_EXPORT virtual Standard_Boolean SplitSurface();
82 //! Performs splitting of curves of all the edges in the
83 //! shape and divides these edges.
84 Standard_EXPORT virtual Standard_Boolean SplitCurves();
86 //! Gives the resulting Shell, or Face, or Null shape if not done.
87 Standard_EXPORT TopoDS_Shape Result() const;
89 //! Queries the status of last call to Perform
90 //! OK : no splitting was done (or no call to Perform)
91 //! DONE1: some edges were splitted
92 //! DONE2: surface was splitted
93 //! DONE3: surface was modified without splitting
94 //! FAIL1: some fails encountered during splitting wires
95 //! FAIL2: face cannot be splitted
96 Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
98 //! Sets the tool for splitting surfaces.
99 Standard_EXPORT void SetSplitSurfaceTool (const Handle(ShapeUpgrade_SplitSurface)& splitSurfaceTool);
101 //! Sets the tool for dividing edges on Face.
102 Standard_EXPORT void SetWireDivideTool (const Handle(ShapeUpgrade_WireDivide)& wireDivideTool);
104 //! Returns the tool for splitting surfaces.
105 //! This tool must be already initialized.
106 Standard_EXPORT virtual Handle(ShapeUpgrade_SplitSurface) GetSplitSurfaceTool() const;
108 //! Returns the tool for dividing edges on Face.
109 //! This tool must be already initialized.
110 Standard_EXPORT virtual Handle(ShapeUpgrade_WireDivide) GetWireDivideTool() const;
115 DEFINE_STANDARD_RTTIEXT(ShapeUpgrade_FaceDivide,ShapeUpgrade_Tool)
121 TopoDS_Shape myResult;
122 Standard_Boolean mySegmentMode;
123 Standard_Integer myStatus;
129 Handle(ShapeUpgrade_SplitSurface) mySplitSurfaceTool;
130 Handle(ShapeUpgrade_WireDivide) myWireDivideTool;
141 #endif // _ShapeUpgrade_FaceDivide_HeaderFile