Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:06

0001 // Created on: 1992-05-27
0002 // Created by: Remi LEQUETTE
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BRep_TFace_HeaderFile
0018 #define _BRep_TFace_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Poly_ListOfTriangulation.hxx>
0023 #include <TopLoc_Location.hxx>
0024 #include <Standard_Real.hxx>
0025 #include <TopoDS_TFace.hxx>
0026 class Geom_Surface;
0027 class TopoDS_TShape;
0028 
0029 class BRep_TFace;
0030 DEFINE_STANDARD_HANDLE(BRep_TFace, TopoDS_TFace)
0031 
0032 //! The Tface from BRep  is  based  on the TFace  from
0033 //! TopoDS. The TFace contains :
0034 //!
0035 //! * A surface, a tolerance and a Location.
0036 //!
0037 //! * A NaturalRestriction flag,   when this  flag  is
0038 //! True the  boundary of the  face is known to be the
0039 //! parametric space (Umin, UMax, VMin, VMax).
0040 //!
0041 //! * An optional list of triangulations. If there are any
0042 //! triangulations the surface can be absent.
0043 //!
0044 //! The  Location is  used   for the Surface.
0045 //!
0046 //! The triangulation  is in the same reference system
0047 //! than the TFace.     A point on mySurface must   be
0048 //! transformed with myLocation,  but  not a point  on
0049 //! the triangulation.
0050 //!
0051 //! The Surface may  be shared by different TFaces but
0052 //! not the  Triangulation, because the  Triangulation
0053 //! may be modified by  the edges.
0054 class BRep_TFace : public TopoDS_TFace
0055 {
0056 
0057 public:
0058 
0059   //! Creates an empty TFace.
0060   Standard_EXPORT BRep_TFace();
0061 
0062   //! Returns face surface.
0063   const Handle(Geom_Surface)& Surface() const { return mySurface; }
0064 
0065   //! Sets surface for this face.
0066   void Surface (const Handle(Geom_Surface)& theSurface) { mySurface = theSurface;}
0067 
0068   //! Returns the face location.
0069   const TopLoc_Location& Location() const { return myLocation; }
0070 
0071   //! Sets the location for this face.
0072   void Location (const TopLoc_Location& theLocation) { myLocation = theLocation; }
0073 
0074   //! Returns the face tolerance.
0075   Standard_Real Tolerance() const { return myTolerance; }
0076 
0077   //! Sets the tolerance for this face.
0078   void Tolerance (const Standard_Real theTolerance) { myTolerance = theTolerance; }
0079 
0080   //! Returns TRUE if the boundary of this face is known to be the parametric space (Umin, UMax, VMin, VMax).
0081   Standard_Boolean NaturalRestriction() const { return myNaturalRestriction; }
0082 
0083   //! Sets the flag that is TRUE if the boundary of this face is known to be the parametric space.
0084   void NaturalRestriction (const Standard_Boolean theRestriction) { myNaturalRestriction = theRestriction; }
0085 
0086   //! Returns the triangulation of this face according to the mesh purpose.
0087   //! @param[in] thePurpose a mesh purpose to find appropriate triangulation (NONE by default).
0088   //! @return an active triangulation in case of NONE purpose,
0089   //!         the first triangulation appropriate for the input purpose,
0090   //!         just the first triangulation if none matching other criteria and input purpose is AnyFallback
0091   //!         or null handle if there is no any suitable triangulation.
0092   Standard_EXPORT const Handle(Poly_Triangulation)& Triangulation (const Poly_MeshPurpose thePurpose = Poly_MeshPurpose_NONE) const;
0093 
0094   //! Sets input triangulation for this face.
0095   //! @param theTriangulation [in] triangulation to be set
0096   //! @param theToReset [in] flag to reset triangulations list to new list with only one input triangulation.
0097   //! If theTriangulation is NULL internal list of triangulations will be cleared and active triangulation will be nullified.
0098   //! If theToReset is TRUE internal list of triangulations will be reset
0099   //! to new list with only one input triangulation that will be active.
0100   //! Else if input triangulation is contained in internal triangulations list it will be made active,
0101   //!      else the active triangulation will be replaced to input one.
0102   Standard_EXPORT void Triangulation (const Handle(Poly_Triangulation)& theTriangulation, const Standard_Boolean theToReset = true);
0103 
0104   //! Returns a copy  of the  TShape  with no sub-shapes.
0105   //! The new Face has no triangulation.
0106   Standard_EXPORT virtual Handle(TopoDS_TShape) EmptyCopy() const Standard_OVERRIDE;
0107 
0108   //! Dumps the content of me into the stream
0109   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0110 
0111 public:
0112 
0113   //! Returns the list of available face triangulations.
0114   const Poly_ListOfTriangulation& Triangulations() const { return myTriangulations; }
0115 
0116   //! Sets input list of triangulations and currently active triangulation for this face.
0117   //! If list is empty internal list of triangulations will be cleared and active triangulation will be nullified.
0118   //! Else this list will be saved and the input active triangulation be saved as active.
0119   //! Use NULL active triangulation to set the first triangulation in list as active.
0120   //! Note: the method throws exception if there is any NULL triangulation in input list or
0121   //!       if this list doesn't contain input active triangulation.
0122   Standard_EXPORT void Triangulations (const Poly_ListOfTriangulation& theTriangulations, const Handle(Poly_Triangulation)& theActiveTriangulation);
0123 
0124   //! Returns number of available face triangulations.
0125   Standard_Integer NbTriangulations() const { return myTriangulations.Size(); }
0126 
0127   //! Returns current active triangulation.
0128   const Handle(Poly_Triangulation)& ActiveTriangulation() const { return myActiveTriangulation; }
0129 
0130   DEFINE_STANDARD_RTTIEXT(BRep_TFace,TopoDS_TFace)
0131 
0132 private:
0133 
0134   Poly_ListOfTriangulation myTriangulations;
0135   Handle(Poly_Triangulation) myActiveTriangulation;
0136   Handle(Geom_Surface) mySurface;
0137   TopLoc_Location myLocation;
0138   Standard_Real myTolerance;
0139   Standard_Boolean myNaturalRestriction;
0140 };
0141 
0142 #endif // _BRep_TFace_HeaderFile