Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:05

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 
0036   //! Destructor.
0037   virtual ~IMeshData_Face()
0038   {
0039   }
0040 
0041   //! Returns number of wires.
0042   Standard_EXPORT virtual Standard_Integer WiresNb () const = 0;
0043 
0044   //! Adds wire to discrete model of face.
0045   Standard_EXPORT virtual const IMeshData::IWireHandle& AddWire (
0046     const TopoDS_Wire&     theWire,
0047     const Standard_Integer theEdgeNb = 0) = 0;
0048 
0049   //! Returns discrete edge with the given index.
0050   Standard_EXPORT virtual const IMeshData::IWireHandle& GetWire (
0051     const Standard_Integer theIndex) const = 0;
0052 
0053   //! Returns face's surface.
0054   const Handle(BRepAdaptor_Surface)& GetSurface() const
0055   {
0056     return mySurface;
0057   }
0058 
0059   //! Returns TopoDS_Face attached to model.
0060   const TopoDS_Face& GetFace () const
0061   {
0062     return TopoDS::Face (GetShape ());
0063   }
0064 
0065   //! Returns whether the face discrete model is valid.
0066   Standard_Boolean IsValid () const
0067   {
0068     return (IsEqual(IMeshData_NoError) ||
0069             IsEqual(IMeshData_ReMesh)  ||
0070             IsEqual(IMeshData_UnorientedWire));
0071   }
0072 
0073   DEFINE_STANDARD_RTTIEXT(IMeshData_Face, IMeshData_TessellatedShape)
0074 
0075 protected:
0076 
0077   //! Constructor.
0078   //! Initializes empty model.
0079   IMeshData_Face (const TopoDS_Face& theFace)
0080     : IMeshData_TessellatedShape(theFace)
0081   {
0082     BRepAdaptor_Surface aSurfAdaptor(GetFace(), Standard_False);
0083     mySurface = new BRepAdaptor_Surface(aSurfAdaptor);
0084   }
0085 
0086 private:
0087 
0088   mutable Handle(BRepAdaptor_Surface)  mySurface;
0089 };
0090 
0091 #endif