0024624: Lost word in license statement in source files
[occt.git] / src / Draw / Draw_Box.cxx
1 // Created on: 1995-03-10
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1995-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 <Draw_Box.ixx>
18
19 //=======================================================================
20 //function : Draw_Box
21 //purpose  : 
22 //=======================================================================
23
24 Draw_Box::Draw_Box(const gp_Pnt& p1, const gp_Pnt& p2, const Draw_Color& col) :
25    myFirst(p1), myLast(p2),myColor(col)
26 {
27   Standard_Real t;
28   if (myLast.X() < myFirst.X()) {
29     t = myFirst.X();
30     myFirst.SetX(myLast.X());
31     myLast.SetX(t);
32   }
33   if (myLast.Y() < myFirst.Y()) {
34     t = myFirst.Y();
35     myFirst.SetY(myLast.Y());
36     myLast.SetY(t);
37   }
38   if (myLast.Z() < myFirst.Z()) {
39     t = myFirst.Z();
40     myFirst.SetZ(myLast.Z());
41     myLast.SetZ(t);
42   }
43 }
44
45 //=======================================================================
46 //function : DrawOn
47 //purpose  : 
48 //=======================================================================
49
50 void Draw_Box::DrawOn(Draw_Display& dis) const 
51 {
52   dis.SetColor(myColor);
53   gp_Pnt P = myFirst;
54
55   dis.MoveTo(P);
56   P.SetX(myLast.X());
57   dis.DrawTo(P);
58   P.SetY(myLast.Y());
59   dis.DrawTo(P);
60   P.SetZ(myLast.Z());
61   dis.DrawTo(P);
62   P.SetX(myFirst.X());
63   dis.DrawTo(P);
64   P.SetY(myFirst.Y());
65   dis.DrawTo(P);
66   P.SetZ(myFirst.Z());
67   dis.DrawTo(P);
68
69   P.SetX(myLast.X());
70   dis.MoveTo(P);
71   P.SetZ(myLast.Z());
72   dis.DrawTo(P);
73   P.SetX(myFirst.X());
74   dis.DrawTo(P);
75   
76   P.SetX(myLast.X());
77   dis.MoveTo(P);
78   P.SetY(myLast.Y());
79   dis.DrawTo(P);
80   
81   P.SetX(myFirst.X());
82   dis.MoveTo(P);
83   P.SetZ(myFirst.Z());
84   dis.DrawTo(P);
85   P.SetY(myFirst.Y());
86   dis.DrawTo(P);
87   
88   P.SetY(myLast.Y());
89   dis.MoveTo(P);
90   P.SetX(myLast.X());
91   dis.DrawTo(P);
92 }
93
94 //=======================================================================
95 //function : First
96 //purpose  : 
97 //=======================================================================
98
99 const gp_Pnt& Draw_Box::First() const 
100 {
101   return myFirst;
102 }
103
104 //=======================================================================
105 //function : First
106 //purpose  : 
107 //=======================================================================
108
109 void Draw_Box::First(const gp_Pnt& P)
110 {
111   myFirst = P;
112 }
113
114 //=======================================================================
115 //function : Last
116 //purpose  : 
117 //=======================================================================
118
119 const gp_Pnt& Draw_Box::Last() const 
120 {
121   return myLast;
122 }
123
124 //=======================================================================
125 //function : Last
126 //purpose  : 
127 //=======================================================================
128
129 void Draw_Box::Last(const gp_Pnt& P)
130 {
131   myLast = P;
132 }
133