0025113: Mesh - Progress indication and user break functionality for BRepMesh component
[occt.git] / src / BRepMesh / BRepMesh_DiscretRoot.hxx
1 // Copyright (c) 2013 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #ifndef _BRepMesh_DiscretRoot_HeaderFile
15 #define _BRepMesh_DiscretRoot_HeaderFile
16
17 #include <Standard.hxx>
18 #include <Standard_Type.hxx>
19 #include <TopoDS_Shape.hxx>
20 #include <Standard_Transient.hxx>
21 #include <Message_ProgressRange.hxx>
22
23 //! This is a common interface for meshing algorithms 
24 //! instantiated by Mesh Factory and implemented by plugins.
25 class BRepMesh_DiscretRoot : public Standard_Transient
26 {
27 public:
28   
29   //! Destructor
30   Standard_EXPORT virtual ~BRepMesh_DiscretRoot();
31
32   //! Set the shape to triangulate.
33   inline void SetShape(const TopoDS_Shape& theShape)
34   {
35     myShape = theShape;
36   }
37   
38   inline const TopoDS_Shape& Shape() const
39   {
40     return myShape;
41   }
42   
43   //! Returns true if triangualtion was performed and has success.
44   inline Standard_Boolean IsDone() const
45   {
46     return myIsDone;
47   }
48
49   //! Compute triangulation for set shape.
50   virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) = 0;
51
52
53   DEFINE_STANDARD_RTTIEXT(BRepMesh_DiscretRoot,Standard_Transient)
54
55 protected:
56   
57   //! Constructor
58   Standard_EXPORT BRepMesh_DiscretRoot();
59   
60   //! Sets IsDone flag.
61   inline void setDone()
62   {
63     myIsDone = Standard_True;
64   }
65   
66   //! Clears IsDone flag.
67   inline void setNotDone()
68   {
69     myIsDone = Standard_False;
70   }
71   
72   Standard_EXPORT virtual void init();
73
74   TopoDS_Shape      myShape;
75   Standard_Boolean  myIsDone;
76 };
77
78 DEFINE_STANDARD_HANDLE(BRepMesh_DiscretRoot, Standard_Transient)
79
80 #endif