9 #ifdef USE_HUD_TextList
10 #define textString( x , y, text, digit) TextString( text, x , y ,digit ) //suma
12 #define textString( x , y, text, digit ) puDrawString ( guiFnt, text, x, y ); //suma
15 //========== Top of hud_card class member definitions =============
30 float max_value, // 360
50 string type_tick,//hud
51 string length_tick,//hud
57 instr_scale( x,y,width,height,
60 max_value, min_value, disp_scaling,
61 major_divs, minor_divs, modulus,
63 val_span ( value_span),
65 draw_tick_bottom (tick_bottom),
66 draw_tick_top (tick_top),
67 draw_tick_right (tick_right),
68 draw_tick_left (tick_left),
69 draw_cap_bottom (cap_bottom),
70 draw_cap_top (cap_top),
71 draw_cap_right (cap_right),
72 draw_cap_left (cap_left),
73 marker_offset (mark_offset),
74 pointer (pointer_enable),
75 pointer_type (type_pointer),
76 tick_type (type_tick), //hud
77 tick_length (length_tick), //hud
78 Maj_div (major_divs), //suma
79 Min_div (minor_divs) //suma
82 half_width_units = range_to_show() / 2.0;
84 maxValue=max_value; //suma
85 minValue=min_value; //suma
86 divisions=divs; //suma
89 // UINT options = get_options();
90 // huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
91 // huds_right = options & HUDS_RIGHT;
92 // huds_left = options & HUDS_LEFT;
93 // huds_vert = options & HUDS_VERT;
94 // huds_notext = options & HUDS_NOTEXT;
95 // huds_top = options & HUDS_TOP;
96 // huds_bottom = options & HUDS_BOTTOM;
103 hud_card( const hud_card & image):
104 instr_scale( (const instr_scale & ) image),
105 val_span( image.val_span),
107 half_width_units (image.half_width_units),
108 draw_tick_bottom (image.draw_tick_bottom),
109 draw_tick_top (image.draw_tick_top),
110 draw_tick_right (image.draw_tick_right),
111 draw_tick_left (image.draw_tick_left),
112 draw_cap_bottom (image.draw_cap_bottom),
113 draw_cap_top (image.draw_cap_top),
114 draw_cap_right (image.draw_cap_right),
115 draw_cap_left (image.draw_cap_left),
116 marker_offset (image.marker_offset),
117 pointer (image.pointer),
118 pointer_type (image.pointer_type),
119 tick_type(image.tick_type), //hud
120 tick_length(image.tick_length), //hud
121 Maj_div(image.Maj_div), //suma
122 Min_div(image.Min_div)//suma
125 // UINT options = get_options();
126 // huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
127 // huds_right = options & HUDS_RIGHT;
128 // huds_left = options & HUDS_LEFT;
129 // huds_vert = options & HUDS_VERT;
130 // huds_notext = options & HUDS_NOTEXT;
131 // huds_top = options & HUDS_TOP;
132 // huds_bottom = options & HUDS_BOTTOM;
135 hud_card & hud_card ::
136 operator = (const hud_card & rhs )
138 if( !( this == &rhs)){
139 instr_scale::operator = (rhs);
140 val_span = rhs.val_span;
141 half_width_units = rhs.half_width_units;
142 draw_tick_bottom = rhs.draw_tick_bottom;
143 draw_tick_top = rhs.draw_tick_top;
144 draw_tick_right = rhs.draw_tick_right;
145 draw_tick_left = rhs.draw_tick_left;
146 draw_cap_bottom = rhs.draw_cap_bottom;
147 draw_cap_top = rhs.draw_cap_top;
148 draw_cap_right = rhs.draw_cap_right;
149 draw_cap_left = rhs.draw_cap_left;
150 marker_offset = rhs.marker_offset;
152 pointer = rhs.pointer;
153 pointer_type = rhs.pointer_type;
154 tick_type = rhs.tick_type;
155 tick_length = rhs.tick_length;
156 Maj_div = rhs.Maj_div; //suma
157 Min_div = rhs.Min_div; //suma
165 draw( void ) // (HUD_scale * pscale )
168 float vmin = 0.0, vmax = 0.0;
173 int text_x = 0, text_y = 0;
180 int oddtype, k; //odd or even values for ticks
182 POINT mid_scr = get_centroid();
183 float cur_value = get_value();
185 if (!((int)maxValue%2) )
186 oddtype =0; //draw ticks at even values
188 oddtype = 1;//draw ticks at odd values
190 RECT scrn_rect = get_location();
191 UINT options = get_options();
193 height = scrn_rect.top + scrn_rect.bottom;
194 width = scrn_rect.left + scrn_rect.right;
197 // if type=gauge then display dial
201 y=(float)(scrn_rect.top);
202 x=(float)(scrn_rect.left);
203 glEnable(GL_POINT_SMOOTH);
206 float incr= 360.0/divisions;
207 for(i=0.0;i<360.0;i+=incr) {
208 float i1=i*SGD_DEGREES_TO_RADIANS;
209 float x1=x+radius*cos(i1);
210 float y1=y+radius*sin(i1);
217 glDisable(GL_POINT_SMOOTH);
220 if(data_available()) {
221 float offset = 90.0*SGD_DEGREES_TO_RADIANS;
222 float r1=10.0; //size of carrot
223 float theta= get_value();
225 float theta1= -theta*SGD_DEGREES_TO_RADIANS+offset;
226 float x1=x+radius*cos(theta1);
227 float y1=y+radius*sin(theta1);
228 float x2=x1-r1*cos(theta1-30.0*SGD_DEGREES_TO_RADIANS);
229 float y2=y1-r1*sin(theta1-30.0*SGD_DEGREES_TO_RADIANS);
230 float x3=x1-r1*cos(theta1+30.0*SGD_DEGREES_TO_RADIANS);
231 float y3=y1-r1*sin(theta1+30.0*SGD_DEGREES_TO_RADIANS);
234 drawOneLine(x1,y1,x2,y2);
235 drawOneLine(x1,y1,x3,y3);
236 sprintf(TextScale,"%3.1f\n",theta);
239 int l = abs((int)theta);
242 textString (x,y,TextScale,0 );
244 textString (x-1.0,y,TextScale,0 );
246 textString (x-2.0,y,TextScale,0 );
253 // if its not explicitly a gauge default to tape
255 if(pointer_type=="moving") {
260 vmin = cur_value - half_width_units; // width units == needle travel
261 vmax = cur_value + half_width_units; // or picture unit span.
266 vmin = cur_value - half_width_units; // width units == needle travel
267 vmax = cur_value + half_width_units; // or picture unit span.
272 // Draw the basic markings for the scale...
274 if( huds_vert(options) ) { // Vertical scale
275 if (draw_tick_bottom) {
276 drawOneLine( scrn_rect.left, // Bottom tick bar
280 } // endif draw_tick_bottom
282 drawOneLine( scrn_rect.left, // Top tick bar
286 } // endif draw_tick_top
288 marker_xs = scrn_rect.left; // x start
289 marker_xe = width; // x extent
292 // glBegin(GL_LINES);
295 // glVertex2f( marker_xs, scrn_rect.top);
296 // glVertex2f( marker_xe, scrn_rect.top);
299 // glVertex2f( marker_xs, marker_ye);
300 // glVertex2f( marker_xe, marker_ye );
304 // We do not use else in the following so that combining the
305 // two options produces a "caged" display with double
306 // carrots. The same is done for horizontal card indicators.
308 // begin vertical/left
309 //First draw capping lines and pointers
310 if( huds_left(options) ) { // Calculate x marker offset
312 if (draw_cap_right) {
314 drawOneLine( marker_xe, scrn_rect.top,
315 marker_xe, marker_ye); // Cap right side
318 marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
320 // drawOneLine( marker_xs, mid_scr.y,
321 // marker_xe, mid_scr.y + scrn_rect.right / 6);
322 // drawOneLine( marker_xs, mid_scr.y,
323 // marker_xe, mid_scr.y - scrn_rect.right / 6);
327 if(pointer_type=="moving") {
329 //Code for Moving Type Pointer included by suma.
330 float ycentre, ypoint,xpoint;
332 if(cur_value > maxValue) cur_value = maxValue;
333 if(cur_value < minValue) cur_value = minValue;
335 ycentre = scrn_rect.top;
336 else if (maxValue + minValue == 0.0)
340 ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
342 ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
343 range = scrn_rect.bottom;
344 wth = scrn_rect.left + scrn_rect.right;
346 ypoint = ycentre + ((cur_value-1.0) * range / val_span);
348 ypoint = ycentre + (cur_value * range / val_span);
349 xpoint = wth + marker_offset;
350 drawOneLine(xpoint,ycentre,xpoint,ypoint);
351 drawOneLine(xpoint,ypoint,xpoint-marker_offset,ypoint);
352 drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint+5.0);
353 drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint-5.0);
357 fixed(marker_offset+marker_xe, text_y + scrn_rect.right / 6,
358 marker_offset+marker_xs, text_y,marker_offset+marker_xe,
359 text_y - scrn_rect.right / 6);
363 } //end vertical/left
365 // begin vertical/right
366 //First draw capping lines and pointers
367 if( huds_right(options) ) { // We'll default this for now.
369 drawOneLine( scrn_rect.left, scrn_rect.top,
370 scrn_rect.left, marker_ye ); // Cap left side
373 marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
375 // drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
376 // marker_xe, mid_scr.y );
377 // drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
378 // marker_xe, mid_scr.y);
382 if(pointer_type=="moving") {
384 //type-fixed & zoom=1, behaviour to be defined
385 // Code for Moving Type Pointer included by suma.
386 float ycentre, ypoint,xpoint;
389 if(cur_value > maxValue)
390 cur_value = maxValue;
391 if(cur_value < minValue)
392 cur_value = minValue;
395 ycentre = scrn_rect.top;
396 else if (maxValue + minValue == 0.0)
400 ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
402 ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
403 range = scrn_rect.bottom;
406 ypoint = ycentre + ((cur_value-1.0) * range / val_span);
408 ypoint = ycentre + (cur_value * range / val_span);
409 xpoint = scrn_rect.left - marker_offset;
410 drawOneLine(xpoint,ycentre,xpoint,ypoint);
411 drawOneLine(xpoint,ypoint,xpoint+marker_offset,ypoint);
412 drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint+5.0);
413 drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint-5.0);
417 fixed( -marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6,
418 -marker_offset+marker_xe, text_y,-marker_offset+scrn_rect.left,
419 text_y - scrn_rect.right / 6);
422 } //end vertical/right
424 // At this point marker x_start and x_end values are transposed.
425 // To keep this from confusing things they are now interchanged.
426 if(huds_both(options)) {
427 marker_ye = marker_xs;
428 marker_xs = marker_xe;
429 marker_xe = marker_ye;
432 // Work through from bottom to top of scale. Calculating where to put
433 // minor and major ticks.
435 // draw scale or tape
437 // last = FloatToInt(vmax)+1;
438 // i = FloatToInt(vmin);
439 last = (int)vmax + 1; // N
443 zoomed_scale((int)vmin,(int)vmax); //suma
445 for( ; i <last ; i++ ) {
453 if( condition ) { // Show a tick if necessary
454 // Calculate the location of this tick
455 marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
456 // marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
457 // Block calculation artifact from drawing ticks below min coordinate.
458 // Calculation here accounts for text height.
460 if(( marker_ys < (scrn_rect.top + 4)) |
461 ( marker_ys > (height - 4)))
468 k = i+1; //enable ticks at odd values
474 // if( (i%div_min()) == 0) {
475 if( !(k%(int)div_min())) {
476 if((( marker_ys - 5) > scrn_rect.top ) &&
477 (( marker_ys + 5) < (height))) {
479 //vertical/left OR vertical/right
480 if( huds_both(options) ) {
481 if(tick_type=="line") {
482 if(tick_length=="variable") {
483 drawOneLine( scrn_rect.left, marker_ys,
484 marker_xs, marker_ys );
485 drawOneLine( marker_xe, marker_ys,
488 drawOneLine( scrn_rect.left, marker_ys,
489 marker_xs, marker_ys );
490 drawOneLine( marker_xe, marker_ys,
493 } else if(tick_type=="circle") // begin suma this func. is written below
494 circles(scrn_rect.left,(float)marker_ys,3.0); //end suma
497 // if neither line nor circle draw default as line
498 drawOneLine( scrn_rect.left, marker_ys,
499 marker_xs, marker_ys );
500 drawOneLine( marker_xe, marker_ys,
503 // glBegin(GL_LINES);
504 // glVertex2f( scrn_rect.left, marker_ys );
505 // glVertex2f( marker_xs, marker_ys );
506 // glVertex2f( marker_xe, marker_ys);
507 // glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
509 // anything other than huds_both
511 if( huds_left(options) ) {
512 if(tick_type=="line") {
513 if(tick_length=="variable") {
514 drawOneLine( marker_xs + 4, marker_ys,
515 marker_xe, marker_ys );
517 drawOneLine( marker_xs , marker_ys,
518 marker_xe, marker_ys );
520 } else if(tick_type=="circle") // begin suma
521 circles((float)marker_xs + 4, (float)marker_ys,3.0); //end suma
524 drawOneLine( marker_xs + 4, marker_ys,
525 marker_xe, marker_ys );
528 if(tick_type=="line") {
529 if(tick_length=="variable") {
530 drawOneLine( marker_xs, marker_ys,
531 marker_xe - 4, marker_ys );
533 drawOneLine( marker_xs, marker_ys,
534 marker_xe , marker_ys );
536 } else if(tick_type=="circle") //begin suma
537 circles((float)marker_xe - 4, (float)marker_ys,3.0); //end suma
539 drawOneLine( marker_xs, marker_ys,
540 marker_xe - 4, marker_ys );
545 } //end draw minor ticks
551 if( !(k%(int)div_max()) ) {
553 disp_val = i % (int) modulo(); // ?????????
556 disp_val += modulo();
562 lenstr = sprintf( TextScale, "%d",
563 FloatToInt(disp_val * data_scaling()/*+.5*/));
564 // (int)(disp_val * data_scaling() +.5));
565 /* if(( (marker_ys - 8 ) > scrn_rect.top ) &&
566 ( (marker_ys + 8) < (height))){ */ //suma
568 if( huds_both(options) ) {
569 // drawOneLine( scrn_rect.left, marker_ys,
570 // marker_xs, marker_ys);
571 // drawOneLine( marker_xs, marker_ys,
572 // scrn_rect.left + scrn_rect.right,
574 if(tick_type=="line") {
575 glBegin(GL_LINE_STRIP);
576 glVertex2f( scrn_rect.left, marker_ys );
577 glVertex2f( marker_xs, marker_ys);
578 glVertex2f( width, marker_ys);
580 } else if(tick_type=="circle") //begin suma
581 circles(scrn_rect.left, (float)marker_ys,5.0); //end suma
583 glBegin(GL_LINE_STRIP);
584 glVertex2f( scrn_rect.left, marker_ys );
585 glVertex2f( marker_xs, marker_ys);
586 glVertex2f( width, marker_ys);
590 if( !huds_notext(options)) {
591 textString ( marker_xs + 2, marker_ys,
596 /* Changes are made to draw a circle when tick_type="circle" */
597 // anything other than huds_both
598 if(tick_type=="line") {
599 drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
600 } else if(tick_type=="circle")
601 circles((float)marker_xs + 4, (float)marker_ys,5.0);//end suma
603 drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
605 if( !huds_notext(options) ) {
606 if( huds_left(options) ) {
607 textString( marker_xs - 8 * lenstr - 2,
611 textString( marker_xe + 3 * lenstr,
615 } //End if !huds_notext
617 } // End if draw major ticks
618 } // End if major ticks
622 // End if VERTICAL SCALE TYPE (tape loop yet to be closed)
624 // Horizontal scale by default
626 if (draw_tick_left) {
627 drawOneLine( scrn_rect.left, scrn_rect.top,
628 scrn_rect.left, height);
629 } // endif draw_tick_left
631 if (draw_tick_right) {
632 drawOneLine( width, scrn_rect.top,
635 } // endif draw_tick_right
637 marker_ys = scrn_rect.top; // Starting point for
638 marker_ye = height; // tick y location calcs
640 marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
643 // glBegin(GL_LINES);
645 // glVertex2f( scrn_rect.left, scrn_rect.top);
646 // glVertex2f( scrn_rect.left, marker_ye);
649 // glVertex2f( marker_xe, scrn_rect.top);
650 // glVertex2f( marker_xe, marker_ye );
653 if( huds_top(options) ) {
654 if (draw_cap_bottom) {
656 drawOneLine( scrn_rect.left,
663 marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
665 // drawOneLine( mid_scr.x, marker_ye,
666 // mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
667 // drawOneLine( mid_scr.x, marker_ye,
668 // mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
671 if(pointer_type=="moving") {
673 //Code for Moving Type Pointer included by suma.
674 // static float xcentre,xpoint,ypoint;
676 if(cur_value > maxValue) cur_value = maxValue;
677 if(cur_value < minValue) cur_value = minValue;
678 float xcentre = mid_scr.x;
679 int range = scrn_rect.right;
680 float xpoint = xcentre + (cur_value * range / val_span);
681 float ypoint = scrn_rect.top - marker_offset;
682 drawOneLine(xcentre, ypoint,xpoint,ypoint);
683 drawOneLine(xpoint,ypoint,xpoint,ypoint+marker_offset);
684 drawOneLine(xpoint,ypoint+marker_offset,xpoint+5.0,ypoint+5.0);
685 drawOneLine(xpoint,ypoint+marker_offset,xpoint-5.0,ypoint+5.0);
689 fixed( marker_xs - scrn_rect.bottom / 4, scrn_rect.top,
690 marker_xs, marker_ye, marker_xs + scrn_rect.bottom / 4,scrn_rect.top);
693 } //End Horizontal scale/top
695 if( huds_bottom(options) ) {
698 drawOneLine( scrn_rect.left, height,
703 marker_ys = height - scrn_rect.bottom / 2;
705 // drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
706 // scrn_rect.top + scrn_rect.bottom,
707 // mid_scr.x, marker_ys );
708 // drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
709 // scrn_rect.top + scrn_rect.bottom,
710 // mid_scr.x , marker_ys );
714 if(pointer_type=="moving") {
716 //Code for Moving Type Pointer included by suma.
717 // static float xcentre,xpoint,ypoint;
718 // static int range,hgt;
719 if(cur_value > maxValue) cur_value = maxValue;
720 if(cur_value < minValue) cur_value = minValue;
721 float xcentre = mid_scr.x ;
722 int range = scrn_rect.right;
723 int hgt = scrn_rect.top + scrn_rect.bottom;
724 float xpoint = xcentre + (cur_value * range / val_span);
725 float ypoint = hgt + marker_offset;
726 drawOneLine(xcentre, ypoint,xpoint,ypoint);
727 drawOneLine(xpoint,ypoint,xpoint,ypoint-marker_offset);
728 drawOneLine(xpoint,ypoint-marker_offset,xpoint+5.0,ypoint-5.0);
729 drawOneLine(xpoint,ypoint-marker_offset,xpoint-5.0,ypoint-5.0);
732 fixed( marker_xs + scrn_rect.bottom / 4, height, marker_xs, marker_ys,
733 marker_xs - scrn_rect.bottom / 4, height);
736 } //end horizontal scale bottom
738 // if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
739 // marker_xe = marker_ys;
740 // marker_ys = marker_ye;
741 // marker_ye = marker_xe;
744 // printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
746 // last = FloatToInt(vmax)+1;
747 // i = FloatToInt(vmin);
750 zoomed_scale((int)vmin,(int)vmax); //suma
753 last = (int)vmax + 1;
755 for(; i <last ; i++ ) {
756 // for( i = (int)vmin; i <= (int)vmax; i++ ) {
757 // printf("<*> i = %d\n", i);
764 // printf("<**> i = %d\n", i);
766 // marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
767 marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
770 k = i+1; //enable ticks at odd values
775 // if( (i%(int)div_min()) == 0 ) {
777 if( !(k%(int)div_min() )) {
778 // draw in ticks only if they aren't too close to the edge.
779 if((( marker_xs - 5) > scrn_rect.left ) &&
780 (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
782 if( huds_both(options) ) {
783 if(tick_length=="variable") {
784 drawOneLine( marker_xs, scrn_rect.top,
785 marker_xs, marker_ys - 4);
786 drawOneLine( marker_xs, marker_ye + 4,
789 drawOneLine( marker_xs, scrn_rect.top,
790 marker_xs, marker_ys);
791 drawOneLine( marker_xs, marker_ye,
794 // glBegin(GL_LINES);
795 // glVertex2f( marker_xs, scrn_rect.top);
796 // glVertex2f( marker_xs, marker_ys - 4);
797 // glVertex2f( marker_xs, marker_ye + 4);
798 // glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
801 if( huds_top(options)) {
803 if(tick_length=="variable")
804 drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye-4);
806 drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
808 if(tick_length=="variable")
809 drawOneLine(marker_xs,marker_ys+4,marker_xs,marker_ye);
811 drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
814 } //end draw minor ticks
818 // printf("i = %d\n", i);
819 // if( (i%(int)div_max())==0 ) {
821 if( !(k%(int)div_max()) ) {
823 disp_val = i % (int) modulo(); // ?????????
826 disp_val += modulo();
831 // printf("disp_val = %d\n", disp_val);
832 // printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
833 lenstr = sprintf( TextScale, "%d",
834 // (int)(disp_val * data_scaling() +.5));
835 FloatToInt(disp_val * data_scaling()/*+.5*/));
836 // Draw major ticks and text only if far enough from the edge.
837 if(( (marker_xs - 10)> scrn_rect.left ) &&
838 ( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
839 if( huds_both(options) ) {
840 // drawOneLine( marker_xs, scrn_rect.top,
841 // marker_xs, marker_ys);
842 // drawOneLine( marker_xs, marker_ye,
843 // marker_xs, scrn_rect.top + scrn_rect.bottom);
844 glBegin(GL_LINE_STRIP);
845 glVertex2f( marker_xs, scrn_rect.top);
846 glVertex2f( marker_xs, marker_ye);
847 glVertex2f( marker_xs, height);
849 if( !huds_notext(options) ) {
850 textString ( marker_xs - 4 * lenstr,
852 TextScale, 0 ); //suma
855 drawOneLine( marker_xs, marker_ys,
856 marker_xs, marker_ye );
857 if( !huds_notext(options)) {
858 if( huds_top(options) ) {
859 textString ( marker_xs - 4 * lenstr,
861 TextScale, 0 ); //suma
863 textString( marker_xs - 4 * lenstr,
865 TextScale, 0 ); //suma
870 } //end draw major ticks
871 } //endif major ticks
875 } //end horizontal/vertical scale
876 } // end of type tape
883 circles(float x,float y,float size)
885 glEnable(GL_POINT_SMOOTH);
893 glDisable(GL_POINT_SMOOTH);
899 fixed(float x1, float y1, float x2, float y2, float x3, float y3)
901 glBegin(GL_LINE_STRIP);
910 zoomed_scale(int first, int last)
913 POINT mid_scr = get_centroid();
914 RECT scrn_rect = get_location();
915 UINT options = get_options();
920 float x,y,w,h,bottom;
921 float cur_value=get_value();
922 if(cur_value > maxValue) cur_value = maxValue;
923 if(cur_value < minValue) cur_value = minValue;
927 while(first <= last) {
928 if((first % (int)Maj_div) == 0) {
937 if( huds_vert(options) ) {
941 w=scrn_rect.left+scrn_rect.right;
942 h=scrn_rect.top+scrn_rect.bottom;
943 bottom=scrn_rect.bottom;
945 float xstart, yfirst, ycentre, ysecond;
947 float hgt = bottom * 20.0 /100.0; // 60% of height should be zoomed
948 yfirst = mid_scr.y - hgt;
950 ysecond = mid_scr.y + hgt;
951 float range = hgt * 2;
954 float factor = range /10.0;
956 float hgt1 = bottom * 30.0 /100.0;
957 int incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ;
958 int incr = incrs / 2;
959 float factors = hgt1 / incr;
964 //this is for moving type pointer
965 static float ycent, ypoint,xpoint;
969 wth=scrn_rect.left+scrn_rect.right;
971 if(cur_value <= data[centre+1])
972 if(cur_value > data[centre]) {
973 ypoint = ycent + ((cur_value - data[centre]) * hgt/Maj_div);
976 if(cur_value >= data[centre-1])
977 if(cur_value <= data[centre]) {
978 ypoint = ycent - ((data[centre]-cur_value) * hgt/Maj_div);
981 if(cur_value < data[centre-1])
982 if(cur_value >= minValue) {
983 float diff = minValue - data[centre-1];
984 float diff1 = cur_value - data[centre-1];
985 float val = (diff1 * hgt1) / diff;
987 ypoint = ycent - hgt - val;
991 if(cur_value > data[centre+1])
992 if(cur_value <= maxValue) {
993 float diff = maxValue - data[centre+1];
994 float diff1 = cur_value - data[centre+1];
995 float val = (diff1 * hgt1) / diff;
997 ypoint = ycent + hgt + val;
1000 if(huds_left(options)) {
1003 drawOneLine( xstart, ycentre, xstart - 5.0, ycentre); //centre tick
1005 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1007 if( !huds_notext(options)) {
1008 textString (x, ycentre, TextScale, 0 );
1014 circles(xstart-2.5,yfirst, 3.0);
1015 circles(xstart-2.5,ycentre,3.0);
1018 yfirst = mid_scr.y - hgt;
1020 for(i=0;i<=incr;i++) {
1021 drawOneLine( xstart, yfirst, xstart - 5.0, yfirst);
1022 drawOneLine( xstart,ysecond, xstart - 5.0,ysecond);
1024 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1026 if( !huds_notext(options))
1027 textString (x, yfirst, TextScale, 0 );
1029 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1031 if( !huds_notext(options))
1032 textString (x, ysecond, TextScale, 0 );
1039 //to draw moving type pointer for left option
1041 xpoint = wth + 10.0;
1043 if(pointer_type == "moving") {
1044 drawOneLine(xpoint,ycent,xpoint,ypoint);
1045 drawOneLine(xpoint,ypoint,xpoint-10.0,ypoint);
1046 drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint+5.0);
1047 drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint-5.0);
1055 drawOneLine( xstart, ycentre, xstart + 5.0, ycentre); //centre tick
1057 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1059 if( !huds_notext(options)) {
1060 textString (w, ycentre, TextScale, 0 );
1066 circles(xstart+2.5,yfirst, 3.0);
1067 circles(xstart+2.5,ycentre,3.0);
1070 yfirst = mid_scr.y - hgt;
1072 for(i=0;i<=incr;i++) {
1073 drawOneLine( xstart, yfirst, xstart + 5.0, yfirst);
1074 drawOneLine( xstart,ysecond, xstart + 5.0,ysecond);
1076 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1078 if( !huds_notext(options))
1079 textString (w, yfirst, TextScale, 0 );
1081 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1083 if( !huds_notext(options))
1084 textString (w, ysecond, TextScale, 0 );
1091 // to draw moving type pointer for right option
1093 xpoint = scrn_rect.left;
1095 if(pointer_type == "moving") {
1096 drawOneLine(xpoint,ycent,xpoint,ypoint);
1097 drawOneLine(xpoint,ypoint,xpoint+10.0,ypoint);
1098 drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint+5.0);
1099 drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint-5.0);
1102 }//end huds_right /left
1103 //end of vertical scale
1108 w=scrn_rect.left+scrn_rect.right;
1109 h=scrn_rect.top+scrn_rect.bottom;
1110 bottom=scrn_rect.right;
1112 float ystart, xfirst, xcentre, xsecond;
1114 float hgt = bottom * 20.0 /100.0; // 60% of height should be zoomed
1115 xfirst = mid_scr.x - hgt;
1116 xcentre = mid_scr.x;
1117 xsecond = mid_scr.x + hgt;
1118 float range = hgt * 2;
1121 float factor = range /10.0;
1123 float hgt1 = bottom * 30.0 /100.0;
1124 int incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ;
1125 int incr = incrs / 2;
1126 float factors = hgt1 / incr;
1129 //Code for Moving Type Pointer
1131 static float xcent,xpoint,ypoint;
1135 if(cur_value <= data[centre+1])
1136 if(cur_value > data[centre]) {
1137 xpoint = xcent + ((cur_value - data[centre]) * hgt/Maj_div);
1140 if(cur_value >= data[centre-1])
1141 if(cur_value <= data[centre]) {
1142 xpoint = xcent - ((data[centre]-cur_value) * hgt/Maj_div);
1145 if(cur_value < data[centre-1])
1146 if(cur_value >= minValue) {
1147 float diff = minValue - data[centre-1];
1148 float diff1 = cur_value - data[centre-1];
1149 float val = (diff1 * hgt1) / diff;
1151 xpoint = xcent - hgt - val;
1155 if(cur_value > data[centre+1])
1156 if(cur_value <= maxValue) {
1157 float diff = maxValue - data[centre+1];
1158 float diff1 = cur_value - data[centre+1];
1159 float val = (diff1 * hgt1) / diff;
1161 xpoint = xcent + hgt + val;
1165 if(huds_top(options)) {
1169 drawOneLine( xcentre, ystart, xcentre, ystart - 5.0); //centre tick
1171 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1173 if( !huds_notext(options)) {
1174 textString (xcentre-10.0, y, TextScale, 0 );
1180 circles(xfirst, ystart-2.5, 3.0);
1181 circles(xcentre, ystart-2.5, 3.0);
1184 xfirst = mid_scr.x - hgt;
1186 for(i=0;i<=incr;i++) {
1187 drawOneLine( xfirst, ystart, xfirst, ystart - 5.0);
1188 drawOneLine( xsecond, ystart, xsecond, ystart - 5.0);
1190 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1192 if( !huds_notext(options))
1193 textString (xfirst-10.0, y, TextScale, 0 );
1195 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1197 if( !huds_notext(options))
1198 textString (xsecond-10.0, y, TextScale, 0 );
1205 //this is for moving pointer for top option
1208 ypoint = scrn_rect.top + scrn_rect.bottom + 10.0;
1210 if(pointer_type == "moving") {
1211 drawOneLine(xcent, ypoint,xpoint,ypoint);
1212 drawOneLine(xpoint,ypoint,xpoint,ypoint-10.0);
1213 drawOneLine(xpoint,ypoint-10.0,xpoint+5.0,ypoint-5.0);
1214 drawOneLine(xpoint,ypoint-10.0,xpoint-5.0,ypoint-5.0);
1221 //drawOneLine( xstart, yfirst, xstart - 5.0, yfirst );
1222 drawOneLine( xcentre, ystart, xcentre, ystart + 5.0); //centre tick
1224 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1226 if( !huds_notext(options)) {
1227 textString (xcentre-10.0, h, TextScale, 0 );
1233 circles(xfirst, ystart+2.5, 3.0);
1234 circles(xcentre, ystart+2.5,3.0);
1237 xfirst = mid_scr.x - hgt;
1239 for(i=0;i<=incr;i++) {
1240 drawOneLine( xfirst, ystart, xfirst, ystart + 5.0);
1241 drawOneLine( xsecond,ystart, xsecond,ystart + 5.0);
1243 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1245 if( !huds_notext(options))
1246 textString (xfirst-10.0,h, TextScale, 0 );
1248 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1250 if( !huds_notext(options))
1251 textString (xsecond-10.0,h, TextScale, 0 );
1258 //this is for movimg pointer for bottom option
1261 ypoint = scrn_rect.top - 10.0;
1262 if(pointer_type == "moving") {
1263 drawOneLine(xcent, ypoint,xpoint,ypoint);
1264 drawOneLine(xpoint,ypoint,xpoint,ypoint+10.0);
1265 drawOneLine(xpoint,ypoint+10.0,xpoint+5.0,ypoint+5.0);
1266 drawOneLine(xpoint,ypoint+10.0,xpoint-5.0,ypoint+5.0);
1271 }//end hud_top or hud_bottom
1273 } //end of horizontal/vertical scales