@@ -218,22 +218,22 @@ private void btn_calc_wind_Click(object sender, EventArgs e)
218
218
//Draw the crosswind and headwind arrows
219
219
if ( StarboardFlag ) //starboard side
220
220
{
221
- PaintWindComponent_kts ( CrosswindMultiplier , 180 , 20 , 130 , 20 ,
221
+ PaintDataOnToRunwayGraphics ( CrosswindMultiplier , 180 , 20 , 130 , 20 ,
222
222
RunwayGraphic , Math . Round ( crosswind3 , 0 ) + "kts" , new Font ( "Arial" , 12 ) ,
223
223
Color . Yellow , 80 , 10 ) ;
224
224
225
- PaintWindComponent_kts ( HeadwindMultiplier , 180 , 20 , 180 , 60 ,
225
+ PaintDataOnToRunwayGraphics ( HeadwindMultiplier , 180 , 20 , 180 , 60 ,
226
226
RunwayGraphic , Math . Round ( headwind , 0 ) + "kts" , new Font ( "Arial" , 12 ) ,
227
227
Color . Yellow , 130 , 65 ) ;
228
228
229
229
}
230
230
else //port side
231
231
{
232
- PaintWindComponent_kts ( CrosswindMultiplier , 15 , 20 , 65 , 20 ,
232
+ PaintDataOnToRunwayGraphics ( CrosswindMultiplier , 15 , 20 , 65 , 20 ,
233
233
RunwayGraphic , Math . Round ( crosswind3 , 0 ) + "kts" , new Font ( "Arial" , 12 ) ,
234
234
Color . Yellow , 68 , 10 ) ;
235
235
236
- PaintWindComponent_kts ( HeadwindMultiplier , 15 , 20 , 15 , 60 ,
236
+ PaintDataOnToRunwayGraphics ( HeadwindMultiplier , 15 , 20 , 15 , 60 ,
237
237
RunwayGraphic , Math . Round ( headwind , 0 ) + "kts" , new Font ( "Arial" , 12 ) ,
238
238
Color . Yellow , 5 , 65 ) ;
239
239
}
@@ -253,13 +253,19 @@ private void btn_calc_wind_Click(object sender, EventArgs e)
253
253
RunwayGraphic . DrawString ( RunwayToUse , new Font ( "Arial" , 50 ) , new SolidBrush ( Color . White ) , new Point ( 40 , 120 ) ) ;
254
254
}
255
255
256
- PaintWindComponent_kts ( HeadwindMultiplier , 180 , 20 , 130 , 20 ,
257
- RunwayGraphic , Math . Round ( headwind , 0 ) + "kts" , new Font ( "Arial" , 12 ) ,
258
- Color . Yellow , 160 , 65 ) ;
259
-
260
- PaintWindComponent_kts ( HeadwindMultiplier , 180 , 20 , 180 , 60 ,
261
- RunwayGraphic , Math . Round ( headwind , 0 ) + "kts" , new Font ( "Arial" , 12 ) ,
262
- Color . Yellow , 160 , 65 ) ;
256
+ //Draw wind arrows.
257
+ if ( ( ! PaintDataOnToRunwayGraphics ( HeadwindMultiplier , 180 , 20 , 130 , 20 ,
258
+ RunwayGraphic , Math . Round ( headwind , 0 ) + "kts" , new Font ( "Arial" , 12 ) ,
259
+ Color . Yellow , 160 , 65 ) ) ||
260
+ ( ! PaintDataOnToRunwayGraphics ( HeadwindMultiplier , 180 , 20 , 180 , 60 ,
261
+ RunwayGraphic , Math . Round ( headwind , 0 ) + "kts" , new Font ( "Arial" , 12 ) ,
262
+ Color . Yellow , 160 , 65 ) ) )
263
+ {
264
+ MsgBox . Show ( "Unable to draw the data, Please check data" , "Error" , MessageBoxButtons . OK ,
265
+ MessageBoxIcon . Error ) ;
266
+ return ;
267
+ }
268
+
263
269
}
264
270
else
265
271
{
@@ -275,7 +281,7 @@ private void btn_calc_wind_Click(object sender, EventArgs e)
275
281
}
276
282
277
283
278
- private bool PaintWindComponent_kts ( double myLineWidthMultiplier , int myCrossWindLineStartX , int myCrossWindLineStartY , int myCrossWindLineEndX , int myCrossWindLineEndY ,
284
+ private bool PaintDataOnToRunwayGraphics ( double myLineWidthMultiplier , int myCrossWindLineStartX , int myCrossWindLineStartY , int myCrossWindLineEndX , int myCrossWindLineEndY ,
279
285
Graphics myRunwayGraphic , string myRunwayNumber , Font myFont ,
280
286
Color myColor , int myCrossWindDataStringXCoOrd , int myCrossWindDataStringYCoOrd )
281
287
{
0 commit comments