0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / ShapeUpgrade / ShapeUpgrade_ShapeDivide.hxx
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
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_ShapeDivide_HeaderFile
18 #define _ShapeUpgrade_ShapeDivide_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
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;
33 class Message_Msg;
34
35 // resolve name collisions with X11 headers
36 #ifdef Status
37   #undef Status
38 #endif
39
40 //! Divides a all faces in shell with given criteria Shell.
41 class ShapeUpgrade_ShapeDivide 
42 {
43 public:
44
45   DEFINE_STANDARD_ALLOC
46
47   
48   Standard_EXPORT ShapeUpgrade_ShapeDivide();
49   
50   //! Initialize by a Shape.
51   Standard_EXPORT ShapeUpgrade_ShapeDivide(const TopoDS_Shape& S);
52   
53   //! Initialize by a Shape.
54   Standard_EXPORT void Init (const TopoDS_Shape& S);
55   
56   Standard_EXPORT virtual ~ShapeUpgrade_ShapeDivide();
57   
58   //! Defines the spatial precision used for splitting
59   Standard_EXPORT void SetPrecision (const Standard_Real Prec);
60   
61   //! Sets maximal allowed tolerance
62   Standard_EXPORT void SetMaxTolerance (const Standard_Real maxtol);
63   
64   //! Sets minimal allowed tolerance
65   Standard_EXPORT void SetMinTolerance (const Standard_Real mintol);
66   
67   //! Purpose sets mode for trimming (segment) surface by
68   //! wire UV bounds.
69   Standard_EXPORT void SetSurfaceSegmentMode (const Standard_Boolean Segment);
70   
71   //! Performs splitting and computes the resulting shape
72   //! If newContext is True (default), the internal context
73   //! will be cleared at start, else previous substitutions
74   //! will be acting.
75   Standard_EXPORT virtual Standard_Boolean Perform (const Standard_Boolean newContext = Standard_True);
76   
77   //! Gives the resulting Shape, or Null shape if not done.
78   Standard_EXPORT TopoDS_Shape Result() const;
79   
80   //! Returns context with all the modifications made during
81   //! last call(s) to Perform() recorded
82   Standard_EXPORT Handle(ShapeBuild_ReShape) GetContext() const;
83   
84   //! Sets context with recorded modifications to be applied
85   //! during next call(s) to Perform(shape,Standard_False)
86   Standard_EXPORT void SetContext (const Handle(ShapeBuild_ReShape)& context);
87   
88   //! Sets message registrator
89   Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg);
90   
91   //! Returns message registrator
92   Standard_EXPORT Handle(ShapeExtend_BasicMsgRegistrator) MsgRegistrator() const;
93   
94   //! Sends a message to be attached to the shape.
95   //! Calls corresponding message of message registrator.
96   Standard_EXPORT void SendMsg (const TopoDS_Shape& shape, const Message_Msg& message, const Message_Gravity gravity = Message_Info) const;
97   
98   //! Queries the status of last call to Perform
99   //! OK   : no splitting was done (or no call to Perform)
100   //! DONE1: some edges were splitted
101   //! DONE2: surface was splitted
102   //! FAIL1: some errors occured
103   Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
104   
105   //! Sets the tool for splitting faces.
106   Standard_EXPORT void SetSplitFaceTool (const Handle(ShapeUpgrade_FaceDivide)& splitFaceTool);
107   
108   //! Sets mode for splitting 3d curves from edges.
109   //! 0 - only curve 3d from free edges.
110   //! 1 - only curve 3d from shared edges.
111   //! 2 -  all curve 3d.
112   Standard_EXPORT void SetEdgeMode (const Standard_Integer aEdgeMode);
113
114
115
116
117 protected:
118
119   
120   //! Returns the tool for splitting faces.
121   Standard_EXPORT virtual Handle(ShapeUpgrade_FaceDivide) GetSplitFaceTool() const;
122   
123   Standard_EXPORT virtual Message_Msg GetFaceMsg() const;
124   
125   Standard_EXPORT virtual Message_Msg GetWireMsg() const;
126   
127   //! Returns a message decsribing modification of a shape.
128   Standard_EXPORT virtual Message_Msg GetEdgeMsg() const;
129
130
131   Handle(ShapeBuild_ReShape) myContext;
132   Handle(ShapeExtend_BasicMsgRegistrator) myMsgReg;
133   TopoDS_Shape myShape;
134   TopoDS_Shape myResult;
135   Standard_Real myPrecision;
136   Standard_Real myMinTol;
137   Standard_Real myMaxTol;
138   Standard_Boolean mySegmentMode;
139   Standard_Integer myStatus;
140   Standard_Integer myEdgeMode;
141
142
143 private:
144
145
146
147   Handle(ShapeUpgrade_FaceDivide) mySplitFaceTool;
148
149
150 };
151
152
153
154
155
156
157
158 #endif // _ShapeUpgrade_ShapeDivide_HeaderFile