b311480e |
1 | // Created on: 1991-04-25 |
2 | // Created by: Arnaud BOUZY |
3 | // Copyright (c) 1991-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | #include <Draw_Segment2D.ixx> |
23 | |
24 | //======================================================================= |
25 | //function : Draw_Segment2D |
26 | //purpose : |
27 | //======================================================================= |
28 | |
29 | Draw_Segment2D::Draw_Segment2D(const gp_Pnt2d& p1, |
30 | const gp_Pnt2d& p2, |
31 | const Draw_Color& col) : |
32 | myFirst(p1), |
33 | myLast(p2), |
34 | myColor(col) |
35 | { |
36 | } |
37 | |
38 | |
39 | //======================================================================= |
40 | //function : DrawOn |
41 | //purpose : |
42 | //======================================================================= |
43 | |
44 | void Draw_Segment2D::DrawOn(Draw_Display& dis)const |
45 | { |
46 | dis.SetColor(myColor); |
47 | dis.Draw(myFirst,myLast); |
48 | } |
49 | |
50 | |
51 | //======================================================================= |
52 | //function : First |
53 | //purpose : |
54 | //======================================================================= |
55 | |
56 | const gp_Pnt2d& Draw_Segment2D::First() const |
57 | { |
58 | return myFirst; |
59 | } |
60 | |
61 | |
62 | //======================================================================= |
63 | //function : First |
64 | //purpose : |
65 | //======================================================================= |
66 | |
67 | void Draw_Segment2D::First(const gp_Pnt2d& P) |
68 | { |
69 | myFirst = P; |
70 | } |
71 | |
72 | |
73 | //======================================================================= |
74 | //function : Last |
75 | //purpose : |
76 | //======================================================================= |
77 | |
78 | const gp_Pnt2d& Draw_Segment2D::Last() const |
79 | { |
80 | return myLast; |
81 | } |
82 | |
83 | |
84 | //======================================================================= |
85 | //function : Last |
86 | //purpose : |
87 | //======================================================================= |
88 | |
89 | void Draw_Segment2D::Last(const gp_Pnt2d& P) |
90 | { |
91 | myLast = P; |
92 | } |
93 | |
94 | //======================================================================= |
95 | //function : Whatis |
96 | //purpose : |
97 | //======================================================================= |
98 | |
99 | void Draw_Segment2D::Whatis(Draw_Interpretor& S) const |
100 | { |
101 | S << "segment 2d"; |
102 | } |
103 | |
104 | //======================================================================= |
105 | //function : Dump |
106 | //purpose : |
107 | //======================================================================= |
108 | |
109 | void Draw_Segment2D::Dump(Standard_OStream& S) const |
110 | { |
111 | S << setw(17) << myFirst.X() << " " << setw(17) << myFirst.Y() << " - " |
112 | << setw(17) << myLast.X() << " " << setw(17) << myLast.Y() << "\n"; |
113 | } |