0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / IntRes2d / IntRes2d_IntersectionSegment.lxx
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
7fd59977 15#include <Standard_DomainError.hxx>
16
17inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment (
18 const IntRes2d_IntersectionPoint& P1,
19 const IntRes2d_IntersectionPoint& P2,
20 const Standard_Boolean Oppos,
21 const Standard_Boolean ReverseFlag):
22
23 oppos(Oppos),
24 first(Standard_True),
25 last(Standard_True),
26 ptfirst(P1),
27 ptlast(P2)
28{
29 if(ReverseFlag) {
30 if(Oppos) {
31 ptfirst= P2;
32 ptlast = P1;
33 }
34 }
35}
36
37inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment (
38 const IntRes2d_IntersectionPoint& P,
39 const Standard_Boolean First,
40 const Standard_Boolean Oppos,
41 const Standard_Boolean ReverseFlag):
42
43 oppos(Oppos),
44 ptfirst(),
45 ptlast()
46 {
47 if(ReverseFlag && Oppos) {
48 if (First) {
49 first=Standard_False; last=Standard_True; ptlast=P;
50 }
51 else {
52 first=Standard_True; last=Standard_False; ptfirst=P;
53 }
54 }
55 else {
56 if (First) {
57 first=Standard_True; last=Standard_False; ptfirst=P;
58 }
59 else {
60 first=Standard_False; last=Standard_True; ptlast=P;
61 }
62 }
63 }
64
65inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment (
66 const Standard_Boolean Oppos):
67 oppos(Oppos),
68 first(Standard_False),
69 last(Standard_False),
70 ptfirst(),
71 ptlast()
72{ }
73
74inline Standard_Boolean IntRes2d_IntersectionSegment::IsOpposite () const {
75 return oppos;
76}
77
78inline Standard_Boolean IntRes2d_IntersectionSegment::HasFirstPoint () const {
79 return first;
80}
81
82inline Standard_Boolean IntRes2d_IntersectionSegment::HasLastPoint () const {
83 return last;
84}
85
86inline const IntRes2d_IntersectionPoint&
87 IntRes2d_IntersectionSegment::FirstPoint () const {
88
89 if (!first) { Standard_DomainError::Raise(); }
90 return ptfirst;
91}
92
93
94inline const IntRes2d_IntersectionPoint&
95 IntRes2d_IntersectionSegment::LastPoint () const {
96
97 if (!last) { Standard_DomainError::Raise();}
98 return ptlast;
99}
100
101