Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:18:06

0001 // Created on: 2016-04-07
0002 // Copyright (c) 2016 OPEN CASCADE SAS
0003 // Created by: Oleg AGASHIN
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _IMeshData_Face_HeaderFile
0017 #define _IMeshData_Face_HeaderFile
0018 
0019 #include <IMeshData_TessellatedShape.hxx>
0020 #include <IMeshData_StatusOwner.hxx>
0021 #include <Standard_Type.hxx>
0022 #include <TopoDS.hxx>
0023 #include <IMeshData_Status.hxx>
0024 #include <IMeshData_Types.hxx>
0025 #include <BRepAdaptor_Surface.hxx>
0026 
0027 class TopoDS_Wire;
0028 
0029 //! Interface class representing discrete model of a face.
0030 //! Face model contains one or several wires.
0031 //! First wire is always outer one.
0032 class IMeshData_Face : public IMeshData_TessellatedShape, public IMeshData_StatusOwner
0033 {
0034 public:
0035   //! Destructor.
0036   ~IMeshData_Face() override = default;
0037 
0038   //! Returns number of wires.
0039   Standard_EXPORT virtual int WiresNb() const = 0;
0040 
0041   //! Adds wire to discrete model of face.
0042   Standard_EXPORT virtual const IMeshData::IWireHandle& AddWire(const TopoDS_Wire& theWire,
0043                                                                 const int theEdgeNb = 0) = 0;
0044 
0045   //! Returns discrete edge with the given index.
0046   Standard_EXPORT virtual const IMeshData::IWireHandle& GetWire(const int theIndex) const = 0;
0047 
0048   //! Returns face's surface.
0049   const occ::handle<BRepAdaptor_Surface>& GetSurface() const { return mySurface; }
0050 
0051   //! Returns TopoDS_Face attached to model.
0052   const TopoDS_Face& GetFace() const { return TopoDS::Face(GetShape()); }
0053 
0054   //! Returns whether the face discrete model is valid.
0055   bool IsValid() const
0056   {
0057     return (IsEqual(IMeshData_NoError) || IsEqual(IMeshData_ReMesh)
0058             || IsEqual(IMeshData_UnorientedWire));
0059   }
0060 
0061   DEFINE_STANDARD_RTTIEXT(IMeshData_Face, IMeshData_TessellatedShape)
0062 
0063 protected:
0064   //! Constructor.
0065   //! Initializes empty model.
0066   IMeshData_Face(const TopoDS_Face& theFace)
0067       : IMeshData_TessellatedShape(theFace)
0068   {
0069     mySurface = new BRepAdaptor_Surface(GetFace(), false);
0070   }
0071 
0072 private:
0073   mutable occ::handle<BRepAdaptor_Surface> mySurface;
0074 };
0075 
0076 #endif