7bd071ed |
1 | // Created on: 2016-04-07 |
2 | // Copyright (c) 2016 OPEN CASCADE SAS |
3 | // Created by: Oleg AGASHIN |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _IMeshData_Face_HeaderFile |
17 | #define _IMeshData_Face_HeaderFile |
18 | |
19 | #include <IMeshData_TessellatedShape.hxx> |
20 | #include <IMeshData_StatusOwner.hxx> |
21 | #include <Standard_Type.hxx> |
22 | #include <TopoDS_Face.hxx> |
23 | #include <TopoDS.hxx> |
24 | #include <IMeshData_Status.hxx> |
25 | #include <IMeshData_Types.hxx> |
26 | #include <BRepAdaptor_HSurface.hxx> |
27 | |
28 | class IMeshData_Wire; |
29 | class TopoDS_Wire; |
30 | |
31 | //! Interface class representing discrete model of a face. |
32 | //! Face model contains one or several wires. |
33 | //! First wire is always outer one. |
34 | class IMeshData_Face : public IMeshData_TessellatedShape, public IMeshData_StatusOwner |
35 | { |
36 | public: |
37 | |
38 | //! Destructor. |
39 | Standard_EXPORT virtual ~IMeshData_Face() |
40 | { |
41 | } |
42 | |
43 | //! Returns number of wires. |
44 | Standard_EXPORT virtual Standard_Integer WiresNb () const = 0; |
45 | |
46 | //! Adds wire to discrete model of face. |
47 | Standard_EXPORT virtual const IMeshData::IWireHandle& AddWire ( |
48 | const TopoDS_Wire& theWire, |
49 | const Standard_Integer theEdgeNb = 0) = 0; |
50 | |
51 | //! Returns discrete edge with the given index. |
52 | Standard_EXPORT virtual const IMeshData::IWireHandle& GetWire ( |
53 | const Standard_Integer theIndex) const = 0; |
54 | |
55 | //! Returns face's surface. |
56 | inline const Handle(BRepAdaptor_HSurface)& GetSurface() const |
57 | { |
58 | return mySurface; |
59 | } |
60 | |
61 | //! Returns TopoDS_Face attached to model. |
62 | inline const TopoDS_Face& GetFace () const |
63 | { |
64 | return TopoDS::Face (GetShape ()); |
65 | } |
66 | |
67 | //! Returns whether the face discrete model is valid. |
68 | inline Standard_Boolean IsValid () const |
69 | { |
70 | return (IsEqual(IMeshData_NoError) || |
71 | IsEqual(IMeshData_ReMesh) || |
72 | IsEqual(IMeshData_UnorientedWire)); |
73 | } |
74 | |
75 | DEFINE_STANDARD_RTTI_INLINE(IMeshData_Face, IMeshData_TessellatedShape) |
76 | |
77 | protected: |
78 | |
79 | //! Constructor. |
80 | //! Initializes empty model. |
81 | Standard_EXPORT IMeshData_Face (const TopoDS_Face& theFace) |
82 | : IMeshData_TessellatedShape(theFace) |
83 | { |
84 | BRepAdaptor_Surface aSurfAdaptor(GetFace(), Standard_False); |
85 | mySurface = new BRepAdaptor_HSurface(aSurfAdaptor); |
86 | } |
87 | |
88 | private: |
89 | |
90 | mutable Handle(BRepAdaptor_HSurface) mySurface; |
91 | }; |
92 | |
93 | #endif |