9 #ifdef USE_HUD_TextList
10 #define textString(x, y, text, digit) TextString(text, x , y ,digit)
12 #define textString(x, y, text, digit) puDrawString(guiFnt, text, x, y)
15 //========== Top of hud_card class member definitions =============
28 float max_value, // 360
54 instr_scale(x,y,width,height,
57 max_value, min_value, disp_scaling,
58 major_divs, minor_divs, modulus,
60 val_span (value_span),
62 draw_tick_bottom (tick_bottom),
63 draw_tick_top (tick_top),
64 draw_tick_right (tick_right),
65 draw_tick_left (tick_left),
66 draw_cap_bottom (cap_bottom),
67 draw_cap_top (cap_top),
68 draw_cap_right (cap_right),
69 draw_cap_left (cap_left),
70 marker_offset (mark_offset),
71 pointer (pointer_enable),
72 pointer_type (type_pointer),
73 tick_type (type_tick),
74 tick_length (length_tick),
79 half_width_units = range_to_show() / 2.0;
86 // UINT options = get_options();
87 // huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
88 // huds_right = options & HUDS_RIGHT;
89 // huds_left = options & HUDS_LEFT;
90 // huds_vert = options & HUDS_VERT;
91 // huds_notext = options & HUDS_NOTEXT;
92 // huds_top = options & HUDS_TOP;
93 // huds_bottom = options & HUDS_BOTTOM;
97 hud_card::~hud_card() { }
100 hud_card::hud_card(const hud_card & image) :
101 instr_scale((const instr_scale &) image),
102 val_span(image.val_span),
104 half_width_units (image.half_width_units),
105 draw_tick_bottom (image.draw_tick_bottom),
106 draw_tick_top (image.draw_tick_top),
107 draw_tick_right (image.draw_tick_right),
108 draw_tick_left (image.draw_tick_left),
109 draw_cap_bottom (image.draw_cap_bottom),
110 draw_cap_top (image.draw_cap_top),
111 draw_cap_right (image.draw_cap_right),
112 draw_cap_left (image.draw_cap_left),
113 marker_offset (image.marker_offset),
114 pointer (image.pointer),
115 pointer_type (image.pointer_type),
116 tick_type(image.tick_type),
117 tick_length(image.tick_length),
118 Maj_div(image.Maj_div),
119 Min_div(image.Min_div)
122 // UINT options = get_options();
123 // huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
124 // huds_right = options & HUDS_RIGHT;
125 // huds_left = options & HUDS_LEFT;
126 // huds_vert = options & HUDS_VERT;
127 // huds_notext = options & HUDS_NOTEXT;
128 // huds_top = options & HUDS_TOP;
129 // huds_bottom = options & HUDS_BOTTOM;
133 void hud_card::draw(void) // (HUD_scale * pscale)
135 float vmin = 0.0, vmax = 0.0;
140 int text_x = 0, text_y = 0;
147 int oddtype, k; //odd or even values for ticks
149 POINT mid_scr = get_centroid();
150 float cur_value = get_value();
152 if (!((int)maxValue%2))
153 oddtype = 0; //draw ticks at even values
155 oddtype = 1; //draw ticks at odd values
157 RECT scrn_rect = get_location();
158 UINT options = get_options();
160 height = scrn_rect.top + scrn_rect.bottom;
161 width = scrn_rect.left + scrn_rect.right;
163 // if type=gauge then display dial
164 if (type == "gauge") {
167 y = (float)(scrn_rect.top);
168 x = (float)(scrn_rect.left);
169 glEnable(GL_POINT_SMOOTH);
172 float incr = 360.0 / divisions;
173 for (i = 0.0; i < 360.0; i += incr) {
174 float i1 = i * SGD_DEGREES_TO_RADIANS;
175 float x1 = x + radius*cos(i1);
176 float y1 = y + radius*sin(i1);
183 glDisable(GL_POINT_SMOOTH);
186 if (data_available()) {
187 float offset = 90.0 * SGD_DEGREES_TO_RADIANS;
188 float r1 = 10.0; //size of carrot
189 float theta = get_value();
191 float theta1 = -theta*SGD_DEGREES_TO_RADIANS+offset;
192 float x1 = x+radius*cos(theta1);
193 float y1 = y+radius*sin(theta1);
194 float x2 = x1-r1*cos(theta1-30.0*SGD_DEGREES_TO_RADIANS);
195 float y2 = y1-r1*sin(theta1-30.0*SGD_DEGREES_TO_RADIANS);
196 float x3 = x1-r1*cos(theta1+30.0*SGD_DEGREES_TO_RADIANS);
197 float y3 = y1-r1*sin(theta1+30.0*SGD_DEGREES_TO_RADIANS);
200 drawOneLine(x1,y1,x2,y2);
201 drawOneLine(x1,y1,x3,y3);
202 sprintf(TextScale,"%3.1f\n",theta);
205 int l = abs((int)theta);
208 textString(x, y, TextScale, 0);
210 textString(x-1.0, y, TextScale, 0);
212 textString(x-2.0, y, TextScale, 0);
217 // if its not explicitly a gauge default to tape
219 if (pointer_type=="moving") {
225 vmin = cur_value - half_width_units; // width units == needle travel
226 vmax = cur_value + half_width_units; // or picture unit span.
232 vmin = cur_value - half_width_units; // width units == needle travel
233 vmax = cur_value + half_width_units; // or picture unit span.
238 // Draw the basic markings for the scale...
240 if (huds_vert(options)) { // Vertical scale
241 if (draw_tick_bottom) {
242 drawOneLine(scrn_rect.left, // Bottom tick bar
246 } // endif draw_tick_bottom
249 drawOneLine(scrn_rect.left, // Top tick bar
253 } // endif draw_tick_top
255 marker_xs = scrn_rect.left; // x start
256 marker_xe = width; // x extent
259 // glBegin(GL_LINES);
262 // glVertex2f(marker_xs, scrn_rect.top);
263 // glVertex2f(marker_xe, scrn_rect.top);
266 // glVertex2f(marker_xs, marker_ye);
267 // glVertex2f(marker_xe, marker_ye);
271 // We do not use else in the following so that combining the
272 // two options produces a "caged" display with double
273 // carrots. The same is done for horizontal card indicators.
275 // begin vertical/left
276 //First draw capping lines and pointers
277 if (huds_left(options)) { // Calculate x marker offset
279 if (draw_cap_right) {
280 drawOneLine(marker_xe, scrn_rect.top,
281 marker_xe, marker_ye); // Cap right side
284 marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
286 // drawOneLine(marker_xs, mid_scr.y,
287 // marker_xe, mid_scr.y + scrn_rect.right / 6);
288 // drawOneLine(marker_xs, mid_scr.y,
289 // marker_xe, mid_scr.y - scrn_rect.right / 6);
293 if (pointer_type=="moving") {
295 //Code for Moving Type Pointer
296 float ycentre, ypoint,xpoint;
298 if (cur_value > maxValue)
299 cur_value = maxValue;
300 if (cur_value < minValue)
301 cur_value = minValue;
304 ycentre = scrn_rect.top;
305 else if (maxValue + minValue == 0.0)
309 ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
311 ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
313 range = scrn_rect.bottom;
314 wth = scrn_rect.left + scrn_rect.right;
317 ypoint = ycentre + ((cur_value-1.0) * range / val_span);
319 ypoint = ycentre + (cur_value * range / val_span);
321 xpoint = wth + marker_offset;
322 drawOneLine(xpoint,ycentre,xpoint,ypoint);
323 drawOneLine(xpoint,ypoint,xpoint-marker_offset,ypoint);
324 drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint+5.0);
325 drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint-5.0);
330 fixed(marker_offset+marker_xe, text_y + scrn_rect.right / 6,
331 marker_offset+marker_xs, text_y,marker_offset+marker_xe,
332 text_y - scrn_rect.right / 6);
335 } //end vertical/left
337 // begin vertical/right
338 //First draw capping lines and pointers
339 if (huds_right(options)) { // We'll default this for now.
341 drawOneLine(scrn_rect.left, scrn_rect.top,
342 scrn_rect.left, marker_ye); // Cap left side
345 marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
347 // drawOneLine(scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
348 // marker_xe, mid_scr.y);
349 // drawOneLine(scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
350 // marker_xe, mid_scr.y);
354 if (pointer_type == "moving") {
356 //type-fixed & zoom=1, behaviour to be defined
357 // Code for Moving Type Pointer
358 float ycentre, ypoint,xpoint;
361 if (cur_value > maxValue)
362 cur_value = maxValue;
363 if (cur_value < minValue)
364 cur_value = minValue;
367 ycentre = scrn_rect.top;
368 else if (maxValue + minValue == 0.0)
372 ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
374 ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
376 range = scrn_rect.bottom;
379 ypoint = ycentre + ((cur_value-1.0) * range / val_span);
381 ypoint = ycentre + (cur_value * range / val_span);
383 xpoint = scrn_rect.left - marker_offset;
384 drawOneLine(xpoint,ycentre,xpoint,ypoint);
385 drawOneLine(xpoint,ypoint,xpoint+marker_offset,ypoint);
386 drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint+5.0);
387 drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint-5.0);
392 fixed(-marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6,
393 -marker_offset+marker_xe, text_y,-marker_offset+scrn_rect.left,
394 text_y - scrn_rect.right / 6);
397 } //end vertical/right
399 // At this point marker x_start and x_end values are transposed.
400 // To keep this from confusing things they are now interchanged.
401 if (huds_both(options)) {
402 marker_ye = marker_xs;
403 marker_xs = marker_xe;
404 marker_xe = marker_ye;
407 // Work through from bottom to top of scale. Calculating where to put
408 // minor and major ticks.
410 // draw scale or tape
412 // last = FloatToInt(vmax)+1;
413 // i = FloatToInt(vmin);
414 last = (int)vmax + 1; // N
418 zoomed_scale((int)vmin, (int)vmax);
420 for (; i < last; i++) {
428 if (condition) { // Show a tick if necessary
429 // Calculate the location of this tick
430 marker_ys = scrn_rect.top + ((i - vmin) * factor()/*+.5f*/);
431 // marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
432 // Block calculation artifact from drawing ticks below min coordinate.
433 // Calculation here accounts for text height.
435 if ((marker_ys < (scrn_rect.top + 4))
436 | (marker_ys > (height - 4))) {
442 k = i+1; //enable ticks at odd values
448 // if ((i%div_min()) == 0) {
449 if (!(k%(int)div_min())) {
450 if (((marker_ys - 5) > scrn_rect.top)
451 && ((marker_ys + 5) < (height))) {
453 //vertical/left OR vertical/right
454 if (huds_both(options)) {
455 if (tick_type=="line") {
456 if (tick_length=="variable") {
457 drawOneLine(scrn_rect.left, marker_ys,
458 marker_xs, marker_ys);
459 drawOneLine(marker_xe, marker_ys,
462 drawOneLine(scrn_rect.left, marker_ys,
463 marker_xs, marker_ys);
464 drawOneLine(marker_xe, marker_ys,
467 } else if (tick_type == "circle")
468 circles(scrn_rect.left,(float)marker_ys,3.0);
471 // if neither line nor circle draw default as line
472 drawOneLine(scrn_rect.left, marker_ys,
473 marker_xs, marker_ys);
474 drawOneLine(marker_xe, marker_ys,
477 // glBegin(GL_LINES);
478 // glVertex2f(scrn_rect.left, marker_ys);
479 // glVertex2f(marker_xs, marker_ys);
480 // glVertex2f(marker_xe, marker_ys);
481 // glVertex2f(scrn_rect.left + scrn_rect.right, marker_ys);
483 // anything other than huds_both
486 if (huds_left(options)) {
487 if (tick_type=="line") {
488 if (tick_length=="variable") {
489 drawOneLine(marker_xs + 4, marker_ys,
490 marker_xe, marker_ys);
492 drawOneLine(marker_xs , marker_ys,
493 marker_xe, marker_ys);
495 } else if (tick_type=="circle")
496 circles((float)marker_xs + 4, (float)marker_ys,3.0);
499 drawOneLine(marker_xs + 4, marker_ys,
500 marker_xe, marker_ys);
503 if (tick_type=="line") {
504 if (tick_length=="variable") {
505 drawOneLine(marker_xs, marker_ys,
506 marker_xe - 4, marker_ys);
508 drawOneLine(marker_xs, marker_ys,
509 marker_xe , marker_ys);
511 } else if (tick_type=="circle")
512 circles((float)marker_xe - 4, (float)marker_ys,3.0);
514 drawOneLine(marker_xs, marker_ys,
515 marker_xe - 4, marker_ys);
520 } //end draw minor ticks
525 if (!(k%(int)div_max())) {
527 disp_val = i % (int) modulo(); // ?????????
530 disp_val += modulo();
536 lenstr = sprintf(TextScale, "%d",
537 FloatToInt(disp_val * data_scaling()/*+.5*/));
538 // (int)(disp_val * data_scaling() +.5));
539 /* if (((marker_ys - 8) > scrn_rect.top) &&
540 ((marker_ys + 8) < (height))){ */
542 if (huds_both(options)) {
543 // drawOneLine(scrn_rect.left, marker_ys,
544 // marker_xs, marker_ys);
545 // drawOneLine(marker_xs, marker_ys,
546 // scrn_rect.left + scrn_rect.right,
548 if (tick_type == "line") {
549 glBegin(GL_LINE_STRIP);
550 glVertex2f(scrn_rect.left, marker_ys);
551 glVertex2f(marker_xs, marker_ys);
552 glVertex2f(width, marker_ys);
554 } else if (tick_type == "circle") {
555 circles(scrn_rect.left, (float)marker_ys,5.0);
557 glBegin(GL_LINE_STRIP);
558 glVertex2f(scrn_rect.left, marker_ys);
559 glVertex2f(marker_xs, marker_ys);
560 glVertex2f(width, marker_ys);
564 if (!huds_notext(options)) {
565 textString (marker_xs + 2, marker_ys,
570 /* Changes are made to draw a circle when tick_type="circle" */
571 // anything other than huds_both
572 if (tick_type=="line") {
573 drawOneLine(marker_xs, marker_ys, marker_xe, marker_ys);
574 } else if (tick_type=="circle") {
575 circles((float)marker_xs + 4, (float)marker_ys,5.0);
577 drawOneLine(marker_xs, marker_ys, marker_xe, marker_ys);
580 if (!huds_notext(options)) {
581 if (huds_left(options)) {
582 textString(marker_xs - 8 * lenstr - 2,
586 textString(marker_xe + 3 * lenstr,
590 } //End if !huds_notext
592 } // End if draw major ticks
593 } // End if major ticks
597 // End if VERTICAL SCALE TYPE (tape loop yet to be closed)
600 // Horizontal scale by default
602 if (draw_tick_left) {
603 drawOneLine(scrn_rect.left, scrn_rect.top,
604 scrn_rect.left, height);
605 } // endif draw_tick_left
607 if (draw_tick_right) {
608 drawOneLine(width, scrn_rect.top,
611 } // endif draw_tick_right
613 marker_ys = scrn_rect.top; // Starting point for
614 marker_ye = height; // tick y location calcs
616 marker_xs = scrn_rect.left + ((cur_value - vmin) * factor() /*+ .5f*/);
618 // glBegin(GL_LINES);
620 // glVertex2f(scrn_rect.left, scrn_rect.top);
621 // glVertex2f(scrn_rect.left, marker_ye);
624 // glVertex2f(marker_xe, scrn_rect.top);
625 // glVertex2f(marker_xe, marker_ye);
628 if (huds_top(options)) {
629 if (draw_cap_bottom) {
631 drawOneLine(scrn_rect.left,
638 marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
640 // drawOneLine(mid_scr.x, marker_ye,
641 // mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
642 // drawOneLine(mid_scr.x, marker_ye,
643 // mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
646 if (pointer_type == "moving") {
648 //Code for Moving Type Pointer
649 // static float xcentre,xpoint,ypoint;
651 if (cur_value > maxValue)
652 cur_value = maxValue;
653 if (cur_value < minValue)
654 cur_value = minValue;
656 float xcentre = mid_scr.x;
657 int range = scrn_rect.right;
658 float xpoint = xcentre + (cur_value * range / val_span);
659 float ypoint = scrn_rect.top - marker_offset;
660 drawOneLine(xcentre, ypoint,xpoint,ypoint);
661 drawOneLine(xpoint,ypoint,xpoint,ypoint+marker_offset);
662 drawOneLine(xpoint,ypoint+marker_offset,xpoint+5.0,ypoint+5.0);
663 drawOneLine(xpoint,ypoint+marker_offset,xpoint-5.0,ypoint+5.0);
667 fixed(marker_xs - scrn_rect.bottom / 4, scrn_rect.top,
668 marker_xs, marker_ye, marker_xs + scrn_rect.bottom / 4,scrn_rect.top);
671 } //End Horizontal scale/top
673 if (huds_bottom(options)) {
676 drawOneLine(scrn_rect.left, height,
681 marker_ys = height - scrn_rect.bottom / 2;
683 // drawOneLine(mid_scr.x + scrn_rect.bottom / 4,
684 // scrn_rect.top + scrn_rect.bottom,
685 // mid_scr.x, marker_ys);
686 // drawOneLine(mid_scr.x - scrn_rect.bottom / 4,
687 // scrn_rect.top + scrn_rect.bottom,
688 // mid_scr.x , marker_ys);
692 if (pointer_type =="moving") {
694 //Code for Moving Type Pointer
695 // static float xcentre,xpoint,ypoint;
696 // static int range,hgt;
697 if (cur_value > maxValue)
698 cur_value = maxValue;
699 if (cur_value < minValue)
700 cur_value = minValue;
702 float xcentre = mid_scr.x ;
703 int range = scrn_rect.right;
704 int hgt = scrn_rect.top + scrn_rect.bottom;
705 float xpoint = xcentre + (cur_value * range / val_span);
706 float ypoint = hgt + marker_offset;
707 drawOneLine(xcentre, ypoint,xpoint,ypoint);
708 drawOneLine(xpoint,ypoint,xpoint,ypoint-marker_offset);
709 drawOneLine(xpoint,ypoint-marker_offset,xpoint+5.0,ypoint-5.0);
710 drawOneLine(xpoint,ypoint-marker_offset,xpoint-5.0,ypoint-5.0);
713 fixed(marker_xs + scrn_rect.bottom / 4, height, marker_xs, marker_ys,
714 marker_xs - scrn_rect.bottom / 4, height);
717 } //end horizontal scale bottom
719 // if ((options & HUDS_BOTTOM) == HUDS_BOTTOM) {
720 // marker_xe = marker_ys;
721 // marker_ys = marker_ye;
722 // marker_ye = marker_xe;
725 // printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
727 // last = FloatToInt(vmax)+1;
728 // i = FloatToInt(vmin);
731 zoomed_scale((int)vmin,(int)vmax);
734 last = (int)vmax + 1;
736 for (; i < last; i++) {
737 // for (i = (int)vmin; i <= (int)vmax; i++) {
738 // printf("<*> i = %d\n", i);
745 // printf("<**> i = %d\n", i);
747 // marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
748 marker_xs = scrn_rect.left + (((i - vmin) * factor()/*+ .5f*/));
751 k = i+1; //enable ticks at odd values
756 // if ((i%(int)div_min()) == 0) {
758 if (!(k%(int)div_min())) {
759 // draw in ticks only if they aren't too close to the edge.
760 if (((marker_xs - 5) > scrn_rect.left)
761 && ((marker_xs + 5)< (scrn_rect.left + scrn_rect.right))) {
763 if (huds_both(options)) {
764 if (tick_length == "variable") {
765 drawOneLine(marker_xs, scrn_rect.top,
766 marker_xs, marker_ys - 4);
767 drawOneLine(marker_xs, marker_ye + 4,
770 drawOneLine(marker_xs, scrn_rect.top,
771 marker_xs, marker_ys);
772 drawOneLine(marker_xs, marker_ye,
775 // glBegin(GL_LINES);
776 // glVertex2f(marker_xs, scrn_rect.top);
777 // glVertex2f(marker_xs, marker_ys - 4);
778 // glVertex2f(marker_xs, marker_ye + 4);
779 // glVertex2f(marker_xs, scrn_rect.top + scrn_rect.bottom);
783 if (huds_top(options)) {
785 if (tick_length=="variable")
786 drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye-4);
788 drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
791 if (tick_length=="variable")
792 drawOneLine(marker_xs,marker_ys+4,marker_xs,marker_ye);
794 drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
797 } //end draw minor ticks
802 // printf("i = %d\n", i);
803 // if ((i%(int)div_max())==0) {
806 if (!(k%(int)div_max())) {
808 disp_val = i % (int) modulo(); // ?????????
811 disp_val += modulo();
816 // printf("disp_val = %d\n", disp_val);
817 // printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
818 lenstr = sprintf(TextScale, "%d",
819 // (int)(disp_val * data_scaling() +.5));
820 FloatToInt(disp_val * data_scaling()/*+.5*/));
822 // Draw major ticks and text only if far enough from the edge.
823 if (((marker_xs - 10)> scrn_rect.left)
824 && ((marker_xs + 10) < (scrn_rect.left + scrn_rect.right))) {
825 if (huds_both(options)) {
826 // drawOneLine(marker_xs, scrn_rect.top,
827 // marker_xs, marker_ys);
828 // drawOneLine(marker_xs, marker_ye,
829 // marker_xs, scrn_rect.top + scrn_rect.bottom);
830 glBegin(GL_LINE_STRIP);
831 glVertex2f(marker_xs, scrn_rect.top);
832 glVertex2f(marker_xs, marker_ye);
833 glVertex2f(marker_xs, height);
836 if (!huds_notext(options)) {
837 textString(marker_xs - 4 * lenstr,
838 marker_ys + 4, TextScale, 0);
841 drawOneLine(marker_xs, marker_ys, marker_xs, marker_ye);
843 if (!huds_notext(options)) {
844 if (huds_top(options)) {
845 textString(marker_xs - 4 * lenstr,
846 height - 10, TextScale, 0);
849 textString(marker_xs - 4 * lenstr,
850 scrn_rect.top, TextScale, 0);
855 } //end draw major ticks
856 } //endif major ticks
860 } //end horizontal/vertical scale
861 } // end of type tape
866 void hud_card::circles(float x,float y,float size)
868 glEnable(GL_POINT_SMOOTH);
876 glDisable(GL_POINT_SMOOTH);
880 void hud_card::fixed(float x1, float y1, float x2, float y2, float x3, float y3)
882 glBegin(GL_LINE_STRIP);
890 void hud_card::zoomed_scale(int first, int last)
892 POINT mid_scr = get_centroid();
893 RECT scrn_rect = get_location();
894 UINT options = get_options();
899 float x,y,w,h,bottom;
900 float cur_value=get_value();
901 if (cur_value > maxValue)
902 cur_value = maxValue;
903 if (cur_value < minValue)
904 cur_value = minValue;
908 while (first <= last) {
909 if ((first % (int)Maj_div) == 0) {
917 if (huds_vert(options)) {
920 w=scrn_rect.left+scrn_rect.right;
921 h=scrn_rect.top+scrn_rect.bottom;
922 bottom=scrn_rect.bottom;
924 float xstart, yfirst, ycentre, ysecond;
926 float hgt = bottom * 20.0 /100.0; // 60% of height should be zoomed
927 yfirst = mid_scr.y - hgt;
929 ysecond = mid_scr.y + hgt;
930 float range = hgt * 2;
933 float factor = range /10.0;
935 float hgt1 = bottom * 30.0 /100.0;
936 int incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ;
937 int incr = incrs / 2;
938 float factors = hgt1 / incr;
941 //this is for moving type pointer
942 static float ycent, ypoint,xpoint;
946 wth=scrn_rect.left+scrn_rect.right;
948 if (cur_value <= data[centre+1])
949 if (cur_value > data[centre]) {
950 ypoint = ycent + ((cur_value - data[centre]) * hgt/Maj_div);
953 if (cur_value >= data[centre-1])
954 if (cur_value <= data[centre]) {
955 ypoint = ycent - ((data[centre]-cur_value) * hgt/Maj_div);
958 if (cur_value < data[centre-1])
959 if (cur_value >= minValue) {
960 float diff = minValue - data[centre-1];
961 float diff1 = cur_value - data[centre-1];
962 float val = (diff1 * hgt1) / diff;
964 ypoint = ycent - hgt - val;
967 if (cur_value > data[centre+1])
968 if (cur_value <= maxValue) {
969 float diff = maxValue - data[centre+1];
970 float diff1 = cur_value - data[centre+1];
971 float val = (diff1 * hgt1) / diff;
973 ypoint = ycent + hgt + val;
976 if (huds_left(options)) {
979 drawOneLine(xstart, ycentre, xstart - 5.0, ycentre); //centre tick
981 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
983 if (!huds_notext(options)) {
984 textString (x, ycentre, TextScale, 0);
987 for (i = 1; i < 5; i++) {
990 circles(xstart-2.5,yfirst, 3.0);
991 circles(xstart-2.5,ycentre,3.0);
994 yfirst = mid_scr.y - hgt;
996 for (i = 0; i <= incr; i++) {
997 drawOneLine(xstart, yfirst, xstart - 5.0, yfirst);
998 drawOneLine(xstart,ysecond, xstart - 5.0,ysecond);
1000 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1002 if (!huds_notext(options))
1003 textString (x, yfirst, TextScale, 0);
1005 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1007 if (!huds_notext(options))
1008 textString (x, ysecond, TextScale, 0);
1015 //to draw moving type pointer for left option
1017 xpoint = wth + 10.0;
1019 if (pointer_type == "moving") {
1020 drawOneLine(xpoint,ycent,xpoint,ypoint);
1021 drawOneLine(xpoint,ypoint,xpoint-10.0,ypoint);
1022 drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint+5.0);
1023 drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint-5.0);
1031 drawOneLine(xstart, ycentre, xstart + 5.0, ycentre); //centre tick
1033 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1035 if (!huds_notext(options)) {
1036 textString (w, ycentre, TextScale, 0);
1039 for (i = 1; i < 5; i++) {
1042 circles(xstart+2.5,yfirst, 3.0);
1043 circles(xstart+2.5,ycentre,3.0);
1046 yfirst = mid_scr.y - hgt;
1048 for (i = 0; i <= incr; i++) {
1049 drawOneLine(xstart, yfirst, xstart + 5.0, yfirst);
1050 drawOneLine(xstart,ysecond, xstart + 5.0,ysecond);
1052 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1054 if (!huds_notext(options))
1055 textString(w, yfirst, TextScale, 0);
1057 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1059 if (!huds_notext(options))
1060 textString(w, ysecond, TextScale, 0);
1067 // to draw moving type pointer for right option
1069 xpoint = scrn_rect.left;
1071 if (pointer_type == "moving") {
1072 drawOneLine(xpoint,ycent,xpoint,ypoint);
1073 drawOneLine(xpoint,ypoint,xpoint+10.0,ypoint);
1074 drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint+5.0);
1075 drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint-5.0);
1078 }//end huds_right /left
1079 //end of vertical scale
1085 w=scrn_rect.left+scrn_rect.right;
1086 h=scrn_rect.top+scrn_rect.bottom;
1087 bottom=scrn_rect.right;
1089 float ystart, xfirst, xcentre, xsecond;
1091 float hgt = bottom * 20.0 /100.0; // 60% of height should be zoomed
1092 xfirst = mid_scr.x - hgt;
1093 xcentre = mid_scr.x;
1094 xsecond = mid_scr.x + hgt;
1095 float range = hgt * 2;
1098 float factor = range /10.0;
1100 float hgt1 = bottom * 30.0 /100.0;
1101 int incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ;
1102 int incr = incrs / 2;
1103 float factors = hgt1 / incr;
1106 //Code for Moving Type Pointer
1108 static float xcent,xpoint,ypoint;
1112 if (cur_value <= data[centre+1])
1113 if (cur_value > data[centre]) {
1114 xpoint = xcent + ((cur_value - data[centre]) * hgt/Maj_div);
1117 if (cur_value >= data[centre-1])
1118 if (cur_value <= data[centre]) {
1119 xpoint = xcent - ((data[centre]-cur_value) * hgt/Maj_div);
1122 if (cur_value < data[centre-1])
1123 if (cur_value >= minValue) {
1124 float diff = minValue - data[centre-1];
1125 float diff1 = cur_value - data[centre-1];
1126 float val = (diff1 * hgt1) / diff;
1128 xpoint = xcent - hgt - val;
1132 if (cur_value > data[centre+1])
1133 if (cur_value <= maxValue) {
1134 float diff = maxValue - data[centre+1];
1135 float diff1 = cur_value - data[centre+1];
1136 float val = (diff1 * hgt1) / diff;
1138 xpoint = xcent + hgt + val;
1142 if (huds_top(options)) {
1146 drawOneLine(xcentre, ystart, xcentre, ystart - 5.0); //centre tick
1148 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1150 if (!huds_notext(options)) {
1151 textString (xcentre-10.0, y, TextScale, 0);
1154 for (i = 1; i < 5; i++) {
1157 circles(xfirst, ystart-2.5, 3.0);
1158 circles(xcentre, ystart-2.5, 3.0);
1161 xfirst = mid_scr.x - hgt;
1163 for (i = 0; i <= incr; i++) {
1164 drawOneLine(xfirst, ystart, xfirst, ystart - 5.0);
1165 drawOneLine(xsecond, ystart, xsecond, ystart - 5.0);
1167 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1169 if (!huds_notext(options))
1170 textString (xfirst-10.0, y, TextScale, 0);
1172 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1174 if (!huds_notext(options))
1175 textString (xsecond-10.0, y, TextScale, 0);
1181 //this is for moving pointer for top option
1184 ypoint = scrn_rect.top + scrn_rect.bottom + 10.0;
1186 if (pointer_type == "moving") {
1187 drawOneLine(xcent, ypoint,xpoint,ypoint);
1188 drawOneLine(xpoint,ypoint,xpoint,ypoint-10.0);
1189 drawOneLine(xpoint,ypoint-10.0,xpoint+5.0,ypoint-5.0);
1190 drawOneLine(xpoint,ypoint-10.0,xpoint-5.0,ypoint-5.0);
1196 ystart = (y + h) / 2;
1198 //drawOneLine(xstart, yfirst, xstart - 5.0, yfirst);
1199 drawOneLine(xcentre, ystart, xcentre, ystart + 5.0); //centre tick
1201 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1203 if (!huds_notext(options)) {
1204 textString (xcentre-10.0, h, TextScale, 0);
1207 for (i = 1; i < 5; i++) {
1210 circles(xfirst, ystart+2.5, 3.0);
1211 circles(xcentre, ystart+2.5,3.0);
1214 xfirst = mid_scr.x - hgt;
1216 for (i = 0; i <= incr; i++) {
1217 drawOneLine(xfirst, ystart, xfirst, ystart + 5.0);
1218 drawOneLine(xsecond,ystart, xsecond,ystart + 5.0);
1220 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1222 if (!huds_notext(options))
1223 textString (xfirst-10.0,h, TextScale, 0);
1225 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1227 if (!huds_notext(options))
1228 textString (xsecond-10.0,h, TextScale, 0);
1235 //this is for movimg pointer for bottom option
1238 ypoint = scrn_rect.top - 10.0;
1239 if (pointer_type == "moving") {
1240 drawOneLine(xcent, ypoint,xpoint,ypoint);
1241 drawOneLine(xpoint,ypoint,xpoint,ypoint+10.0);
1242 drawOneLine(xpoint,ypoint+10.0,xpoint+5.0,ypoint+5.0);
1243 drawOneLine(xpoint,ypoint+10.0,xpoint-5.0,ypoint+5.0);
1245 }//end hud_top or hud_bottom
1246 } //end of horizontal/vertical scales