0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / IntPatch / IntPatch_GLine.lxx
1 // Created on: 1992-04-06
2 // Created by: Jacques GOUSSARD
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 <Standard_DomainError.hxx>
18
19 #include <gp_Lin.hxx>
20 #include <gp_Circ.hxx>
21 #include <gp_Elips.hxx>
22 #include <gp_Parab.hxx>
23 #include <gp_Hypr.hxx>
24
25 #include <Precision.hxx>
26
27
28 inline void IntPatch_GLine::SetFirstPoint (const Standard_Integer IndFirst)
29 {
30   fipt = Standard_True;
31   indf = IndFirst;
32 }
33
34
35 inline void IntPatch_GLine::SetLastPoint (const Standard_Integer IndLast)
36 {
37   lapt = Standard_True;
38   indl = IndLast;
39 }
40
41
42 inline gp_Lin IntPatch_GLine::Line () const
43 {
44   if (typ != IntPatch_Lin) {throw Standard_DomainError();}
45   return gp_Lin(pos.Axis());
46 }
47
48
49 inline gp_Circ IntPatch_GLine::Circle () const
50 {
51   if (typ != IntPatch_Circle) {throw Standard_DomainError();}
52   return gp_Circ(pos,par1);
53 }
54
55
56 inline gp_Elips IntPatch_GLine::Ellipse () const
57 {
58   if (typ != IntPatch_Ellipse) {throw Standard_DomainError();}
59   return gp_Elips(pos,par1,par2);
60 }
61
62
63 inline gp_Parab IntPatch_GLine::Parabola () const
64 {
65   if (typ != IntPatch_Parabola) {throw Standard_DomainError();}
66   return gp_Parab(pos,par1);
67 }
68
69
70 inline gp_Hypr IntPatch_GLine::Hyperbola () const
71 {
72   if (typ != IntPatch_Hyperbola) {throw Standard_DomainError();}
73   return gp_Hypr(pos,par1,par2);
74 }
75
76
77 inline Standard_Boolean IntPatch_GLine::HasFirstPoint () const
78 {
79   return fipt;
80 }
81
82
83 inline Standard_Boolean IntPatch_GLine::HasLastPoint () const
84 {
85   return lapt;
86 }
87
88
89 inline const IntPatch_Point& IntPatch_GLine::FirstPoint () const
90 {
91   if (!fipt) {throw Standard_DomainError();}
92   return svtx(indf);
93 }
94
95
96 inline const IntPatch_Point& IntPatch_GLine::LastPoint () const
97 {
98   if (!lapt) {throw Standard_DomainError();}
99   return svtx(indl);
100 }
101
102
103 inline Standard_Integer IntPatch_GLine::NbVertex () const
104 {
105   return svtx.Length();
106 }
107
108
109 inline const IntPatch_Point& IntPatch_GLine::Vertex (const Standard_Integer Index) const
110 {
111   return svtx(Index);
112 }