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>
23 #include <IMeshData_Status.hxx>
24 #include <IMeshData_Types.hxx>
25 #include <BRepAdaptor_Surface.hxx>
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
37 virtual ~IMeshData_Face()
41 //! Returns number of wires.
42 Standard_EXPORT virtual Standard_Integer WiresNb () const = 0;
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;
49 //! Returns discrete edge with the given index.
50 Standard_EXPORT virtual const IMeshData::IWireHandle& GetWire (
51 const Standard_Integer theIndex) const = 0;
53 //! Returns face's surface.
54 const Handle(BRepAdaptor_Surface)& GetSurface() const
59 //! Returns TopoDS_Face attached to model.
60 const TopoDS_Face& GetFace () const
62 return TopoDS::Face (GetShape ());
65 //! Returns whether the face discrete model is valid.
66 Standard_Boolean IsValid () const
68 return (IsEqual(IMeshData_NoError) ||
69 IsEqual(IMeshData_ReMesh) ||
70 IsEqual(IMeshData_UnorientedWire));
73 DEFINE_STANDARD_RTTIEXT(IMeshData_Face, IMeshData_TessellatedShape)
78 //! Initializes empty model.
79 IMeshData_Face (const TopoDS_Face& theFace)
80 : IMeshData_TessellatedShape(theFace)
82 BRepAdaptor_Surface aSurfAdaptor(GetFace(), Standard_False);
83 mySurface = new BRepAdaptor_Surface(aSurfAdaptor);
88 mutable Handle(BRepAdaptor_Surface) mySurface;