0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / BRep / BRep_TFace.hxx
1 // Created on: 1992-05-27
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _BRep_TFace_HeaderFile
18 #define _BRep_TFace_HeaderFile
19
20 #include <Standard.hxx>
21
22 #include <Poly_ListOfTriangulation.hxx>
23 #include <TopLoc_Location.hxx>
24 #include <Standard_Real.hxx>
25 #include <TopoDS_TFace.hxx>
26 class Geom_Surface;
27 class TopoDS_TShape;
28
29 class BRep_TFace;
30 DEFINE_STANDARD_HANDLE(BRep_TFace, TopoDS_TFace)
31
32 //! The Tface from BRep  is  based  on the TFace  from
33 //! TopoDS. The TFace contains :
34 //!
35 //! * A surface, a tolerance and a Location.
36 //!
37 //! * A NaturalRestriction flag,   when this  flag  is
38 //! True the  boundary of the  face is known to be the
39 //! parametric space (Umin, UMax, VMin, VMax).
40 //!
41 //! * An optional list of triangulations. If there are any
42 //! triangulations the surface can be absent.
43 //!
44 //! The  Location is  used   for the Surface.
45 //!
46 //! The triangulation  is in the same reference system
47 //! than the TFace.     A point on mySurface must   be
48 //! transformed with myLocation,  but  not a point  on
49 //! the triangulation.
50 //!
51 //! The Surface may  be shared by different TFaces but
52 //! not the  Triangulation, because the  Triangulation
53 //! may be modified by  the edges.
54 class BRep_TFace : public TopoDS_TFace
55 {
56
57 public:
58
59   //! Creates an empty TFace.
60   Standard_EXPORT BRep_TFace();
61
62   //! Returns face surface.
63   const Handle(Geom_Surface)& Surface() const { return mySurface; }
64
65   //! Sets surface for this face.
66   void Surface (const Handle(Geom_Surface)& theSurface) { mySurface = theSurface;}
67
68   //! Returns the face location.
69   const TopLoc_Location& Location() const { return myLocation; }
70
71   //! Sets the location for this face.
72   void Location (const TopLoc_Location& theLocation) { myLocation = theLocation; }
73
74   //! Returns the face tolerance.
75   Standard_Real Tolerance() const { return myTolerance; }
76
77   //! Sets the tolerance for this face.
78   void Tolerance (const Standard_Real theTolerance) { myTolerance = theTolerance; }
79
80   //! Returns TRUE if the boundary of this face is known to be the parametric space (Umin, UMax, VMin, VMax).
81   Standard_Boolean NaturalRestriction() const { return myNaturalRestriction; }
82
83   //! Sets the flag that is TRUE if the boundary of this face is known to be the parametric space.
84   void NaturalRestriction (const Standard_Boolean theRestriction) { myNaturalRestriction = theRestriction; }
85
86   //! Returns the triangulation of this face according to the mesh purpose.
87   //! @param[in] thePurpose a mesh purpose to find appropriate triangulation (NONE by default).
88   //! @return an active triangulation in case of NONE purpose,
89   //!         the first triangulation appropriate for the input purpose,
90   //!         just the first triangulation if none matching other criteria and input purpose is AnyFallback
91   //!         or null handle if there is no any suitable triangulation.
92   Standard_EXPORT const Handle(Poly_Triangulation)& Triangulation (const Poly_MeshPurpose thePurpose = Poly_MeshPurpose_NONE) const;
93
94   //! Sets input triangulation for this face.
95   //! @param theTriangulation [in] triangulation to be set
96   //! @param theToReset [in] flag to reset triangulations list to new list with only one input triangulation.
97   //! If theTriangulation is NULL internal list of triangulations will be cleared and active triangulation will be nullified.
98   //! If theToReset is TRUE internal list of triangulations will be reset
99   //! to new list with only one input triangulation that will be active.
100   //! Else if input triangulation is contained in internal triangulations list it will be made active,
101   //!      else the active triangulation will be replaced to input one.
102   Standard_EXPORT void Triangulation (const Handle(Poly_Triangulation)& theTriangulation, const Standard_Boolean theToReset = true);
103
104   //! Returns a copy  of the  TShape  with no sub-shapes.
105   //! The new Face has no triangulation.
106   Standard_EXPORT virtual Handle(TopoDS_TShape) EmptyCopy() const Standard_OVERRIDE;
107
108   //! Dumps the content of me into the stream
109   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
110
111 public:
112
113   //! Returns the list of available face triangulations.
114   const Poly_ListOfTriangulation& Triangulations() const { return myTriangulations; }
115
116   //! Sets input list of triangulations and currently active triangulation for this face.
117   //! If list is empty internal list of triangulations will be cleared and active triangulation will be nullified.
118   //! Else this list will be saved and the input active triangulation be saved as active.
119   //! Use NULL active triangulation to set the first triangulation in list as active.
120   //! Note: the method throws exception if there is any NULL triangulation in input list or
121   //!       if this list doesn't contain input active triangulation.
122   Standard_EXPORT void Triangulations (const Poly_ListOfTriangulation& theTriangulations, const Handle(Poly_Triangulation)& theActiveTriangulation);
123
124   //! Returns number of available face triangulations.
125   Standard_Integer NbTriangulations() const { return myTriangulations.Size(); }
126
127   //! Returns current active triangulation.
128   const Handle(Poly_Triangulation)& ActiveTriangulation() const { return myActiveTriangulation; }
129
130   DEFINE_STANDARD_RTTIEXT(BRep_TFace,TopoDS_TFace)
131
132 private:
133
134   Poly_ListOfTriangulation myTriangulations;
135   Handle(Poly_Triangulation) myActiveTriangulation;
136   Handle(Geom_Surface) mySurface;
137   TopLoc_Location myLocation;
138   Standard_Real myTolerance;
139   Standard_Boolean myNaturalRestriction;
140 };
141
142 #endif // _BRep_TFace_HeaderFile