| 1 | // Created on: 1992-05-27 |
| 2 | // Created by: Laurent BUCHARD |
| 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 | #include <StdFail_NotDone.hxx> |
| 18 | #include <Standard_OutOfRange.hxx> |
| 19 | |
| 20 | |
| 21 | inline Standard_Boolean IntRes2d_Intersection::IsDone() const { |
| 22 | return done; |
| 23 | } |
| 24 | |
| 25 | //---------------------------------------------------------------------- |
| 26 | inline IntRes2d_Intersection::IntRes2d_Intersection() { |
| 27 | done=reverse=Standard_False; |
| 28 | } |
| 29 | //---------------------------------------------------------------------- |
| 30 | inline IntRes2d_Intersection::IntRes2d_Intersection(const IntRes2d_Intersection& Other) { |
| 31 | done=reverse=Standard_False; |
| 32 | lpnt = Other.lpnt; |
| 33 | lseg = Other.lseg; |
| 34 | } |
| 35 | //---------------------------------------------------------------------- |
| 36 | inline Standard_Boolean IntRes2d_Intersection::IsEmpty() const { |
| 37 | if (!done) {StdFail_NotDone::Raise();} |
| 38 | return ((lpnt.Length() == 0) && (lseg.Length() == 0)); |
| 39 | } |
| 40 | //---------------------------------------------------------------------- |
| 41 | inline Standard_Integer IntRes2d_Intersection::NbPoints() const { |
| 42 | if (!done) {StdFail_NotDone::Raise();} |
| 43 | return lpnt.Length(); |
| 44 | } |
| 45 | //---------------------------------------------------------------------- |
| 46 | inline const IntRes2d_IntersectionPoint& |
| 47 | IntRes2d_Intersection::Point( const Standard_Integer N) const { |
| 48 | if (!done) {StdFail_NotDone::Raise();} |
| 49 | return lpnt(N); |
| 50 | } |
| 51 | //---------------------------------------------------------------------- |
| 52 | inline Standard_Integer IntRes2d_Intersection::NbSegments() const { |
| 53 | if (!done) {StdFail_NotDone::Raise();} |
| 54 | return lseg.Length(); |
| 55 | } |
| 56 | //---------------------------------------------------------------------- |
| 57 | inline const IntRes2d_IntersectionSegment& |
| 58 | IntRes2d_Intersection::Segment(const Standard_Integer N) const { |
| 59 | if (!done) {StdFail_NotDone::Raise();} |
| 60 | return lseg(N); |
| 61 | } |
| 62 | //---------------------------------------------------------------------- |
| 63 | inline void IntRes2d_Intersection::Append(const IntRes2d_IntersectionSegment& Seg) { |
| 64 | lseg.Append(Seg); |
| 65 | } |
| 66 | //---------------------------------------------------------------------- |
| 67 | inline void IntRes2d_Intersection::Append(const IntRes2d_IntersectionPoint& Pnt) { |
| 68 | lpnt.Append(Pnt); |
| 69 | } |
| 70 | //---------------------------------------------------------------------- |
| 71 | inline void IntRes2d_Intersection::ResetFields() { |
| 72 | if(done) { |
| 73 | lseg.Clear(); |
| 74 | lpnt.Clear(); |
| 75 | done=Standard_False; |
| 76 | } |
| 77 | } |
| 78 | //---------------------------------------------------------------------- |
| 79 | inline void IntRes2d_Intersection::SetReversedParameters(const Standard_Boolean flag) { |
| 80 | reverse=flag; |
| 81 | } |
| 82 | //---------------------------------------------------------------------- |
| 83 | inline Standard_Boolean IntRes2d_Intersection::ReversedParameters() const { |
| 84 | return(reverse); |
| 85 | } |