Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:18:40

0001 // Created on: 1993-01-26
0002 // Created by: Jean-Louis FRENKEL
0003 // Copyright (c) 1993-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 _StdPrs_ToolRFace_HeaderFile
0018 #define _StdPrs_ToolRFace_HeaderFile
0019 
0020 #include <BRepAdaptor_Surface.hxx>
0021 #include <Geom2dAdaptor_Curve.hxx>
0022 #include <TopAbs_Orientation.hxx>
0023 #include <TopExp_Explorer.hxx>
0024 #include <TopoDS_Face.hxx>
0025 
0026 class TopoDS_Edge;
0027 
0028 //! Iterator over 2D curves restricting a face (skipping internal/external edges).
0029 //! In addition, the algorithm skips NULL curves - IsInvalidGeometry() can be checked if this should
0030 //! be handled within algorithm.
0031 class StdPrs_ToolRFace
0032 {
0033 public:
0034   DEFINE_STANDARD_ALLOC
0035 
0036   //! Empty constructor.
0037   Standard_EXPORT StdPrs_ToolRFace();
0038 
0039   //! Constructor with initialization.
0040   Standard_EXPORT StdPrs_ToolRFace(const occ::handle<BRepAdaptor_Surface>& aSurface);
0041 
0042   //! Return TRUE indicating that iterator looks only for oriented edges.
0043   bool IsOriented() const { return true; }
0044 
0045   //! Move iterator to the first element.
0046   void Init()
0047   {
0048     myExplorer.Init(myFace, TopAbs_EDGE);
0049     next();
0050   }
0051 
0052   //! Return TRUE if iterator points to the curve.
0053   bool More() const { return myExplorer.More(); }
0054 
0055   //! Go to the next curve in the face.
0056   void Next()
0057   {
0058     myExplorer.Next();
0059     next();
0060   }
0061 
0062   //! Return current curve.
0063   const Adaptor2d_Curve2d& Value() const { return myCurve; }
0064 
0065   //! Return current edge.
0066   Standard_EXPORT const TopoDS_Edge& Edge() const;
0067 
0068   //! Return current edge orientation.
0069   TopAbs_Orientation Orientation() const { return myExplorer.Current().Orientation(); }
0070 
0071   //! Return TRUE if NULL curves have been skipped.
0072   bool IsInvalidGeometry() const { return myHasNullCurves; }
0073 
0074 private:
0075   //! Find nearest valid item for the iterator.
0076   Standard_EXPORT void next();
0077 
0078 private:
0079   TopoDS_Face         myFace;
0080   TopExp_Explorer     myExplorer;
0081   Geom2dAdaptor_Curve myCurve;
0082   bool                myHasNullCurves;
0083 };
0084 
0085 #endif // _StdPrs_ToolRFace_HeaderFile