0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / IMeshData / IMeshData_Face.hxx
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.hxx>
23 #include <IMeshData_Status.hxx>
24 #include <IMeshData_Types.hxx>
25 #include <BRepAdaptor_Surface.hxx>
26
27 class TopoDS_Wire;
28
29 //! Interface class representing discrete model of a face.
30 //! Face model contains one or several wires.
31 //! First wire is always outer one.
32 class IMeshData_Face : public IMeshData_TessellatedShape, public IMeshData_StatusOwner
33 {
34 public:
35
36   //! Destructor.
37   virtual ~IMeshData_Face()
38   {
39   }
40
41   //! Returns number of wires.
42   Standard_EXPORT virtual Standard_Integer WiresNb () const = 0;
43
44   //! Adds wire to discrete model of face.
45   Standard_EXPORT virtual const IMeshData::IWireHandle& AddWire (
46     const TopoDS_Wire&     theWire,
47     const Standard_Integer theEdgeNb = 0) = 0;
48
49   //! Returns discrete edge with the given index.
50   Standard_EXPORT virtual const IMeshData::IWireHandle& GetWire (
51     const Standard_Integer theIndex) const = 0;
52
53   //! Returns face's surface.
54   const Handle(BRepAdaptor_Surface)& GetSurface() const
55   {
56     return mySurface;
57   }
58
59   //! Returns TopoDS_Face attached to model.
60   const TopoDS_Face& GetFace () const
61   {
62     return TopoDS::Face (GetShape ());
63   }
64
65   //! Returns whether the face discrete model is valid.
66   Standard_Boolean IsValid () const
67   {
68     return (IsEqual(IMeshData_NoError) ||
69             IsEqual(IMeshData_ReMesh)  ||
70             IsEqual(IMeshData_UnorientedWire));
71   }
72
73   DEFINE_STANDARD_RTTIEXT(IMeshData_Face, IMeshData_TessellatedShape)
74
75 protected:
76
77   //! Constructor.
78   //! Initializes empty model.
79   IMeshData_Face (const TopoDS_Face& theFace)
80     : IMeshData_TessellatedShape(theFace)
81   {
82     BRepAdaptor_Surface aSurfAdaptor(GetFace(), Standard_False);
83     mySurface = new BRepAdaptor_Surface(aSurfAdaptor);
84   }
85
86 private:
87
88   mutable Handle(BRepAdaptor_Surface)  mySurface;
89 };
90
91 #endif