7fd59977 |
1 | // File: DrawTrSurf_Point.cxx |
2 | // Created: Mon Mar 28 16:24:02 1994 |
3 | // Author: Remi LEQUETTE |
4 | // <rle@zerox> |
5 | |
6 | #ifdef HAVE_CONFIG_H |
7 | # include <config.h> |
8 | #endif |
9 | |
10 | #ifdef HAVE_IOS |
11 | # include <ios> |
12 | #elif defined(HAVE_IOS_H) |
13 | # include <ios.h> |
14 | #endif |
15 | |
16 | #include <DrawTrSurf_Point.ixx> |
17 | #include <Standard_Stream.hxx> |
18 | |
19 | //======================================================================= |
20 | //function : DrawTrSurf_Point |
21 | //purpose : |
22 | //======================================================================= |
23 | |
24 | DrawTrSurf_Point::DrawTrSurf_Point(const gp_Pnt& P, |
25 | const Draw_MarkerShape Shape, |
26 | const Draw_Color& Col) : |
27 | myPoint(P), |
28 | is3D(Standard_True), |
29 | myShape(Shape), |
30 | myColor(Col) |
31 | { |
32 | } |
33 | |
34 | //======================================================================= |
35 | //function : DrawTrSurf_Point |
36 | //purpose : |
37 | //======================================================================= |
38 | |
39 | DrawTrSurf_Point::DrawTrSurf_Point(const gp_Pnt2d& P, |
40 | const Draw_MarkerShape Shape, |
41 | const Draw_Color& Col) : |
42 | myPoint(P.X(),P.Y(),0.), |
43 | is3D(Standard_False), |
44 | myShape(Shape), |
45 | myColor(Col) |
46 | { |
47 | } |
48 | |
49 | //======================================================================= |
50 | //function : Is3D |
51 | //purpose : |
52 | //======================================================================= |
53 | |
54 | Standard_Boolean DrawTrSurf_Point::Is3D() const |
55 | { |
56 | return is3D; |
57 | } |
58 | |
59 | //======================================================================= |
60 | //function : DrawOn |
61 | //purpose : |
62 | //======================================================================= |
63 | |
64 | void DrawTrSurf_Point::DrawOn(Draw_Display& dis) const |
65 | { |
66 | dis.SetColor(myColor); |
67 | if (is3D) |
68 | dis.DrawMarker(myPoint,myShape); |
69 | else |
70 | dis.DrawMarker(Point2d(),myShape); |
71 | } |
72 | |
73 | //======================================================================= |
74 | //function : Point |
75 | //purpose : |
76 | //======================================================================= |
77 | |
78 | gp_Pnt DrawTrSurf_Point::Point() const |
79 | { |
80 | return myPoint; |
81 | } |
82 | |
83 | //======================================================================= |
84 | //function : Point |
85 | //purpose : |
86 | //======================================================================= |
87 | |
88 | void DrawTrSurf_Point::Point(const gp_Pnt& P) |
89 | { |
90 | myPoint = P; |
91 | is3D = Standard_True; |
92 | } |
93 | |
94 | //======================================================================= |
95 | //function : Point2d |
96 | //purpose : |
97 | //======================================================================= |
98 | |
99 | gp_Pnt2d DrawTrSurf_Point::Point2d() const |
100 | { |
101 | return gp_Pnt2d(myPoint.X(),myPoint.Y()); |
102 | } |
103 | |
104 | //======================================================================= |
105 | //function : Point2d |
106 | //purpose : |
107 | //======================================================================= |
108 | |
109 | void DrawTrSurf_Point::Point2d(const gp_Pnt2d& P) |
110 | { |
111 | myPoint.SetCoord(P.X(),P.Y(),0); |
112 | is3D = Standard_False; |
113 | } |
114 | |
115 | //======================================================================= |
116 | //function : Color |
117 | //purpose : |
118 | //======================================================================= |
119 | |
120 | void DrawTrSurf_Point::Color(const Draw_Color& aColor) |
121 | { |
122 | myColor = aColor; |
123 | } |
124 | |
125 | //======================================================================= |
126 | //function : Color |
127 | //purpose : |
128 | //======================================================================= |
129 | |
130 | Draw_Color DrawTrSurf_Point::Color() const |
131 | { |
132 | return myColor; |
133 | } |
134 | |
135 | //======================================================================= |
136 | //function : Shape |
137 | //purpose : |
138 | //======================================================================= |
139 | |
140 | void DrawTrSurf_Point::Shape(const Draw_MarkerShape S) |
141 | { |
142 | myShape = S; |
143 | } |
144 | |
145 | //======================================================================= |
146 | //function : Shape |
147 | //purpose : |
148 | //======================================================================= |
149 | |
150 | Draw_MarkerShape DrawTrSurf_Point::Shape() const |
151 | { |
152 | return myShape; |
153 | } |
154 | |
155 | //======================================================================= |
156 | //function : Copy |
157 | //purpose : |
158 | //======================================================================= |
159 | |
160 | Handle(Draw_Drawable3D) DrawTrSurf_Point::Copy() const |
161 | { |
162 | Handle(DrawTrSurf_Point) P; |
163 | if (is3D) |
164 | P = new DrawTrSurf_Point(myPoint,myShape,myColor); |
165 | else |
166 | P = new DrawTrSurf_Point(Point2d(),myShape,myColor); |
167 | |
168 | return P; |
169 | } |
170 | |
171 | //======================================================================= |
172 | //function : Dump |
173 | //purpose : |
174 | //======================================================================= |
175 | |
176 | void DrawTrSurf_Point::Dump(Standard_OStream& S) const |
177 | { |
178 | #if defined(HAVE_IOS) && !defined(__sgi) && !defined(IRIX) |
179 | ios::fmtflags F = S.flags(); |
180 | S.setf(ios::scientific,ios::floatfield); |
181 | S.precision(15); |
182 | #else |
183 | long form = S.setf(ios::scientific); |
184 | int prec = S.precision(15); |
185 | #endif |
186 | if (is3D) |
187 | S << "Point : " << myPoint.X() << ", " << myPoint.Y() << ", " << myPoint.Z() <<endl; |
188 | else |
189 | S << "Point 2d : " << myPoint.X() << ", " << myPoint.Y() <<endl; |
190 | #if defined(HAVE_IOS) && !defined(__sgi) && !defined(IRIX) |
191 | S.setf(F); |
192 | #else |
193 | S.setf(form); |
194 | S.precision(prec); |
195 | #endif |
196 | } |
197 | |
198 | //======================================================================= |
199 | //function : Whatis |
200 | //purpose : |
201 | //======================================================================= |
202 | |
203 | void DrawTrSurf_Point::Whatis(Draw_Interpretor& S) const |
204 | { |
205 | S << "point"; |
206 | } |