0030686: Visualization, SelectMgr_ViewerSelector - sorting issues of transformation...
[occt.git] / src / StdPrs / StdPrs_ToolRFace.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
4ba5491a 15#include <StdPrs_ToolRFace.hxx>
42cf5bc1 16
17#include <Adaptor2d_Curve2d.hxx>
7fd59977 18#include <BRep_Tool.hxx>
42cf5bc1 19#include <BRepAdaptor_HSurface.hxx>
7fd59977 20#include <TopoDS.hxx>
7fd59977 21
7fd59977 22//=======================================================================
23//function : StdPrs_ToolRFace
4ba5491a 24//purpose :
7fd59977 25//=======================================================================
7fd59977 26StdPrs_ToolRFace::StdPrs_ToolRFace()
4ba5491a 27: myHasNullCurves (Standard_False)
7fd59977 28{
29}
30
31//=======================================================================
32//function : StdPrs_ToolRFace
4ba5491a 33//purpose :
7fd59977 34//=======================================================================
4ba5491a 35StdPrs_ToolRFace::StdPrs_ToolRFace (const Handle(BRepAdaptor_HSurface)& theSurface)
36: myFace (theSurface->ChangeSurface().Face()),
37 myHasNullCurves (Standard_False)
7fd59977 38{
39 myFace.Orientation(TopAbs_FORWARD);
40}
41
42//=======================================================================
4ba5491a 43//function : next
44//purpose :
7fd59977 45//=======================================================================
4ba5491a 46void StdPrs_ToolRFace::next()
7fd59977 47{
4ba5491a 48 Standard_Real aParamU1, aParamU2;
49 for (; myExplorer.More(); myExplorer.Next())
50 {
7fd59977 51 // skip INTERNAL and EXTERNAL edges
4ba5491a 52 if (myExplorer.Current().Orientation() != TopAbs_FORWARD
53 && myExplorer.Current().Orientation() != TopAbs_REVERSED)
54 {
55 continue;
7fd59977 56 }
7fd59977 57
4ba5491a 58 if (Handle(Geom2d_Curve) aCurve = BRep_Tool::CurveOnSurface (TopoDS::Edge (myExplorer.Current()), myFace, aParamU1, aParamU2))
59 {
60 myCurve.Load (aCurve, aParamU1, aParamU2);
61 return;
62 }
63 else
64 {
65 myHasNullCurves = Standard_True;
66 }
67 }
7fd59977 68
4ba5491a 69 myCurve.Reset();
7fd59977 70}