1 // Created on: 1999-04-26
2 // Created by: Pavel DURANDIN
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_ShapeDivide_HeaderFile
18 #define _ShapeUpgrade_ShapeDivide_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <TopoDS_Shape.hxx>
25 #include <Standard_Real.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_Integer.hxx>
28 #include <Message_Gravity.hxx>
29 #include <ShapeExtend_Status.hxx>
30 class ShapeUpgrade_FaceDivide;
31 class ShapeBuild_ReShape;
32 class ShapeExtend_BasicMsgRegistrator;
37 //! Divides a all faces in shell with given criteria Shell.
38 class ShapeUpgrade_ShapeDivide
45 Standard_EXPORT ShapeUpgrade_ShapeDivide();
47 //! Initialize by a Shape.
48 Standard_EXPORT ShapeUpgrade_ShapeDivide(const TopoDS_Shape& S);
50 //! Initialize by a Shape.
51 Standard_EXPORT void Init (const TopoDS_Shape& S);
53 Standard_EXPORT virtual void Delete();
54 Standard_EXPORT virtual ~ShapeUpgrade_ShapeDivide(){Delete();}
56 //! Defines the spatial precision used for splitting
57 Standard_EXPORT void SetPrecision (const Standard_Real Prec);
59 //! Sets maximal allowed tolerance
60 Standard_EXPORT void SetMaxTolerance (const Standard_Real maxtol);
62 //! Sets minimal allowed tolerance
63 Standard_EXPORT void SetMinTolerance (const Standard_Real mintol);
65 //! Purpose sets mode for trimming (segment) surface by
67 Standard_EXPORT void SetSurfaceSegmentMode (const Standard_Boolean Segment);
69 //! Performs splitting and computes the resulting shape
70 //! If newContext is True (default), the internal context
71 //! will be cleared at start, else previous substitutions
73 Standard_EXPORT virtual Standard_Boolean Perform (const Standard_Boolean newContext = Standard_True);
75 //! Gives the resulting Shape, or Null shape if not done.
76 Standard_EXPORT TopoDS_Shape Result() const;
78 //! Returns context with all the modifications made during
79 //! last call(s) to Perform() recorded
80 Standard_EXPORT Handle(ShapeBuild_ReShape) GetContext() const;
82 //! Sets context with recorded modifications to be applied
83 //! during next call(s) to Perform(shape,Standard_False)
84 Standard_EXPORT void SetContext (const Handle(ShapeBuild_ReShape)& context);
86 //! Sets message registrator
87 Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg);
89 //! Returns message registrator
90 Standard_EXPORT Handle(ShapeExtend_BasicMsgRegistrator) MsgRegistrator() const;
92 //! Sends a message to be attached to the shape.
93 //! Calls corresponding message of message registrator.
94 Standard_EXPORT void SendMsg (const TopoDS_Shape& shape, const Message_Msg& message, const Message_Gravity gravity = Message_Info) const;
96 //! Queries the status of last call to Perform
97 //! OK : no splitting was done (or no call to Perform)
98 //! DONE1: some edges were splitted
99 //! DONE2: surface was splitted
100 //! FAIL1: some errors occured
101 Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
103 //! Sets the tool for splitting faces.
104 Standard_EXPORT void SetSplitFaceTool (const Handle(ShapeUpgrade_FaceDivide)& splitFaceTool);
106 //! Sets mode for splitting 3d curves from edges.
107 //! 0 - only curve 3d from free edges.
108 //! 1 - only curve 3d from shared edges.
109 //! 2 - all curve 3d.
110 Standard_EXPORT void SetEdgeMode (const Standard_Integer aEdgeMode);
118 //! Returns the tool for splitting faces.
119 Standard_EXPORT virtual Handle(ShapeUpgrade_FaceDivide) GetSplitFaceTool() const;
121 Standard_EXPORT virtual Message_Msg GetFaceMsg() const;
123 Standard_EXPORT virtual Message_Msg GetWireMsg() const;
125 //! Returns a message decsribing modification of a shape.
126 Standard_EXPORT virtual Message_Msg GetEdgeMsg() const;
129 Handle(ShapeBuild_ReShape) myContext;
130 Handle(ShapeExtend_BasicMsgRegistrator) myMsgReg;
131 TopoDS_Shape myShape;
132 TopoDS_Shape myResult;
133 Standard_Real myPrecision;
134 Standard_Real myMinTol;
135 Standard_Real myMaxTol;
136 Standard_Boolean mySegmentMode;
137 Standard_Integer myStatus;
138 Standard_Integer myEdgeMode;
145 Handle(ShapeUpgrade_FaceDivide) mySplitFaceTool;
156 #endif // _ShapeUpgrade_ShapeDivide_HeaderFile