0023024: Update headers of OCCT files
[occt.git] / src / IntRes2d / IntRes2d_IntersectionSegment.lxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 //
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
8 //
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 //
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
18
19 #include <Standard_DomainError.hxx>
20
21 inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment (
22          const IntRes2d_IntersectionPoint& P1, 
23          const IntRes2d_IntersectionPoint& P2,
24          const Standard_Boolean Oppos,
25          const Standard_Boolean ReverseFlag):
26
27   oppos(Oppos),
28   first(Standard_True),
29   last(Standard_True),
30   ptfirst(P1),
31   ptlast(P2)
32
33   if(ReverseFlag) {
34     if(Oppos) {
35       ptfirst= P2;
36       ptlast = P1;
37     }
38   }
39 }
40
41 inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment (
42          const IntRes2d_IntersectionPoint& P, 
43          const Standard_Boolean First,
44          const Standard_Boolean Oppos,
45          const Standard_Boolean ReverseFlag):
46
47   oppos(Oppos),
48   ptfirst(),
49   ptlast()
50     {
51       if(ReverseFlag && Oppos) {
52         if (First) {
53           first=Standard_False; last=Standard_True; ptlast=P;
54         }
55         else {
56           first=Standard_True; last=Standard_False; ptfirst=P;
57         }
58       }
59       else {
60         if (First) {
61           first=Standard_True; last=Standard_False; ptfirst=P;
62         }
63         else {
64           first=Standard_False; last=Standard_True; ptlast=P;
65         }
66       }
67     }
68
69 inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment (
70                                             const Standard_Boolean Oppos):
71   oppos(Oppos),
72   first(Standard_False),
73   last(Standard_False),
74   ptfirst(),
75   ptlast()
76 { }
77
78 inline Standard_Boolean IntRes2d_IntersectionSegment::IsOpposite () const {
79   return oppos;
80 }
81
82 inline Standard_Boolean IntRes2d_IntersectionSegment::HasFirstPoint () const {
83   return first; 
84 }
85
86 inline Standard_Boolean IntRes2d_IntersectionSegment::HasLastPoint () const {
87   return last;
88 }
89
90 inline const IntRes2d_IntersectionPoint& 
91         IntRes2d_IntersectionSegment::FirstPoint () const {
92
93   if (!first) { Standard_DomainError::Raise(); }
94   return ptfirst;
95 }
96
97
98 inline const IntRes2d_IntersectionPoint&
99         IntRes2d_IntersectionSegment::LastPoint () const {
100
101   if (!last) { Standard_DomainError::Raise();}
102   return ptlast;
103 }
104
105