1 // Created on: 2016-04-07
2 // Copyright (c) 2016 OPEN CASCADE SAS
3 // Created by: Oleg AGASHIN
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _IMeshData_Face_HeaderFile
17 #define _IMeshData_Face_HeaderFile
19 #include <IMeshData_TessellatedShape.hxx>
20 #include <IMeshData_StatusOwner.hxx>
21 #include <Standard_Type.hxx>
22 #include <TopoDS_Face.hxx>
24 #include <IMeshData_Status.hxx>
25 #include <IMeshData_Types.hxx>
26 #include <BRepAdaptor_HSurface.hxx>
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
39 Standard_EXPORT virtual ~IMeshData_Face()
43 //! Returns number of wires.
44 Standard_EXPORT virtual Standard_Integer WiresNb () const = 0;
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;
51 //! Returns discrete edge with the given index.
52 Standard_EXPORT virtual const IMeshData::IWireHandle& GetWire (
53 const Standard_Integer theIndex) const = 0;
55 //! Returns face's surface.
56 inline const Handle(BRepAdaptor_HSurface)& GetSurface() const
61 //! Returns TopoDS_Face attached to model.
62 inline const TopoDS_Face& GetFace () const
64 return TopoDS::Face (GetShape ());
67 //! Returns whether the face discrete model is valid.
68 inline Standard_Boolean IsValid () const
70 return (IsEqual(IMeshData_NoError) ||
71 IsEqual(IMeshData_ReMesh) ||
72 IsEqual(IMeshData_UnorientedWire));
75 DEFINE_STANDARD_RTTI_INLINE(IMeshData_Face, IMeshData_TessellatedShape)
80 //! Initializes empty model.
81 Standard_EXPORT IMeshData_Face (const TopoDS_Face& theFace)
82 : IMeshData_TessellatedShape(theFace)
84 BRepAdaptor_Surface aSurfAdaptor(GetFace(), Standard_False);
85 mySurface = new BRepAdaptor_HSurface(aSurfAdaptor);
90 mutable Handle(BRepAdaptor_HSurface) mySurface;