Back to home page

EIC code displayed by LXR

 
 

    


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

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 be handled within algorithm.
0030 class StdPrs_ToolRFace 
0031 {
0032 public:
0033 
0034   DEFINE_STANDARD_ALLOC
0035 
0036   //! Empty constructor.
0037   Standard_EXPORT StdPrs_ToolRFace();
0038 
0039   //! Constructor with initialization.
0040   Standard_EXPORT StdPrs_ToolRFace(const Handle(BRepAdaptor_Surface)& aSurface);
0041   
0042   //! Return TRUE indicating that iterator looks only for oriented edges.
0043   Standard_Boolean IsOriented() const { return Standard_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   Standard_Boolean 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   Standard_Boolean IsInvalidGeometry() const { return myHasNullCurves; }
0073 
0074 private:
0075 
0076   //! Find nearest valid item for the iterator.
0077   Standard_EXPORT void next();
0078 
0079 private:
0080 
0081   TopoDS_Face myFace;
0082   TopExp_Explorer myExplorer;
0083   Geom2dAdaptor_Curve myCurve;
0084   Standard_Boolean myHasNullCurves;
0085 
0086 };
0087 
0088 #endif // _StdPrs_ToolRFace_HeaderFile