4 #ifdef USE_HUD_TextList
5 #define textString( x , y, text, digit) TextString( text, x , y ,digit ) //suma
7 #define textString( x , y, text, digit ) puDrawString ( guiFnt, text, x, y ); //suma
10 //========== Top of hud_card class member definitions =============
25 float max_value, // 360
45 string type_tick,//hud
46 string length_tick,//hud
52 instr_scale( x,y,width,height,
55 max_value, min_value, disp_scaling,
56 major_divs, minor_divs, modulus,
58 val_span ( value_span),
60 draw_tick_bottom (tick_bottom),
61 draw_tick_top (tick_top),
62 draw_tick_right (tick_right),
63 draw_tick_left (tick_left),
64 draw_cap_bottom (cap_bottom),
65 draw_cap_top (cap_top),
66 draw_cap_right (cap_right),
67 draw_cap_left (cap_left),
68 marker_offset (mark_offset),
69 pointer (pointer_enable),
70 pointer_type (type_pointer),
71 tick_type (type_tick), //hud
72 tick_length (length_tick), //hud
73 Maj_div (major_divs), //suma
74 Min_div (minor_divs) //suma
77 half_width_units = range_to_show() / 2.0;
79 maxValue=max_value; //suma
80 minValue=min_value; //suma
81 divisions=divs; //suma
84 // UINT options = get_options();
85 // huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
86 // huds_right = options & HUDS_RIGHT;
87 // huds_left = options & HUDS_LEFT;
88 // huds_vert = options & HUDS_VERT;
89 // huds_notext = options & HUDS_NOTEXT;
90 // huds_top = options & HUDS_TOP;
91 // huds_bottom = options & HUDS_BOTTOM;
98 hud_card( const hud_card & image):
99 instr_scale( (const instr_scale & ) image),
100 val_span( image.val_span),
102 half_width_units (image.half_width_units),
103 draw_tick_bottom (image.draw_tick_bottom),
104 draw_tick_top (image.draw_tick_top),
105 draw_tick_right (image.draw_tick_right),
106 draw_tick_left (image.draw_tick_left),
107 draw_cap_bottom (image.draw_cap_bottom),
108 draw_cap_top (image.draw_cap_top),
109 draw_cap_right (image.draw_cap_right),
110 draw_cap_left (image.draw_cap_left),
111 marker_offset (image.marker_offset),
112 pointer (image.pointer),
113 pointer_type (image.pointer_type),
114 tick_type(image.tick_type), //hud
115 tick_length(image.tick_length), //hud
116 Maj_div(image.Maj_div), //suma
117 Min_div(image.Min_div)//suma
120 // UINT options = get_options();
121 // huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
122 // huds_right = options & HUDS_RIGHT;
123 // huds_left = options & HUDS_LEFT;
124 // huds_vert = options & HUDS_VERT;
125 // huds_notext = options & HUDS_NOTEXT;
126 // huds_top = options & HUDS_TOP;
127 // huds_bottom = options & HUDS_BOTTOM;
130 hud_card & hud_card ::
131 operator = (const hud_card & rhs )
133 if( !( this == &rhs)){
134 instr_scale::operator = (rhs);
135 val_span = rhs.val_span;
136 half_width_units = rhs.half_width_units;
137 draw_tick_bottom = rhs.draw_tick_bottom;
138 draw_tick_top = rhs.draw_tick_top;
139 draw_tick_right = rhs.draw_tick_right;
140 draw_tick_left = rhs.draw_tick_left;
141 draw_cap_bottom = rhs.draw_cap_bottom;
142 draw_cap_top = rhs.draw_cap_top;
143 draw_cap_right = rhs.draw_cap_right;
144 draw_cap_left = rhs.draw_cap_left;
145 marker_offset = rhs.marker_offset;
147 pointer = rhs.pointer;
148 pointer_type = rhs.pointer_type;
149 tick_type = rhs.tick_type;
150 tick_length = rhs.tick_length;
151 Maj_div = rhs.Maj_div; //suma
152 Min_div = rhs.Min_div; //suma
160 draw( void ) // (HUD_scale * pscale )
163 float vmin = 0.0, vmax = 0.0;
168 int text_x = 0, text_y = 0;
175 int oddtype, k; //odd or even values for ticks
177 POINT mid_scr = get_centroid();
178 float cur_value = get_value();
180 if (!((int)maxValue%2) )
181 oddtype =0; //draw ticks at even values
183 oddtype = 1;//draw ticks at odd values
185 RECT scrn_rect = get_location();
186 UINT options = get_options();
188 height = scrn_rect.top + scrn_rect.bottom;
189 width = scrn_rect.left + scrn_rect.right;
192 // if type=gauge then display dial
196 y=(float)(scrn_rect.top);
197 x=(float)(scrn_rect.left);
198 glEnable(GL_POINT_SMOOTH);
201 float incr= 360.0/divisions;
202 for(i=0.0;i<360.0;i+=incr) {
203 float i1=i*SGD_DEGREES_TO_RADIANS;
204 float x1=x+radius*cos(i1);
205 float y1=y+radius*sin(i1);
212 glDisable(GL_POINT_SMOOTH);
215 if(data_available()) {
216 float offset = 90.0*SGD_DEGREES_TO_RADIANS;
217 float r1=10.0; //size of carrot
218 float theta= get_value();
220 float theta1= -theta*SGD_DEGREES_TO_RADIANS+offset;
221 float x1=x+radius*cos(theta1);
222 float y1=y+radius*sin(theta1);
223 float x2=x1-r1*cos(theta1-30.0*SGD_DEGREES_TO_RADIANS);
224 float y2=y1-r1*sin(theta1-30.0*SGD_DEGREES_TO_RADIANS);
225 float x3=x1-r1*cos(theta1+30.0*SGD_DEGREES_TO_RADIANS);
226 float y3=y1-r1*sin(theta1+30.0*SGD_DEGREES_TO_RADIANS);
229 drawOneLine(x1,y1,x2,y2);
230 drawOneLine(x1,y1,x3,y3);
231 sprintf(TextScale,"%3.1f\n",theta);
234 int l = abs((int)theta);
237 textString (x,y,TextScale,0 );
239 textString (x-1.0,y,TextScale,0 );
241 textString (x-2.0,y,TextScale,0 );
248 // if its not explicitly a gauge default to tape
250 if(pointer_type=="moving") {
255 vmin = cur_value - half_width_units; // width units == needle travel
256 vmax = cur_value + half_width_units; // or picture unit span.
261 vmin = cur_value - half_width_units; // width units == needle travel
262 vmax = cur_value + half_width_units; // or picture unit span.
267 // Draw the basic markings for the scale...
269 if( huds_vert(options) ) { // Vertical scale
270 if (draw_tick_bottom) {
271 drawOneLine( scrn_rect.left, // Bottom tick bar
275 } // endif draw_tick_bottom
277 drawOneLine( scrn_rect.left, // Top tick bar
281 } // endif draw_tick_top
283 marker_xs = scrn_rect.left; // x start
284 marker_xe = width; // x extent
287 // glBegin(GL_LINES);
290 // glVertex2f( marker_xs, scrn_rect.top);
291 // glVertex2f( marker_xe, scrn_rect.top);
294 // glVertex2f( marker_xs, marker_ye);
295 // glVertex2f( marker_xe, marker_ye );
299 // We do not use else in the following so that combining the
300 // two options produces a "caged" display with double
301 // carrots. The same is done for horizontal card indicators.
303 // begin vertical/left
304 //First draw capping lines and pointers
305 if( huds_left(options) ) { // Calculate x marker offset
307 if (draw_cap_right) {
309 drawOneLine( marker_xe, scrn_rect.top,
310 marker_xe, marker_ye); // Cap right side
313 marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
315 // drawOneLine( marker_xs, mid_scr.y,
316 // marker_xe, mid_scr.y + scrn_rect.right / 6);
317 // drawOneLine( marker_xs, mid_scr.y,
318 // marker_xe, mid_scr.y - scrn_rect.right / 6);
322 if(pointer_type=="moving") {
324 //Code for Moving Type Pointer included by suma.
325 float ycentre, ypoint,xpoint;
327 if(cur_value > maxValue) cur_value = maxValue;
328 if(cur_value < minValue) cur_value = minValue;
330 ycentre = scrn_rect.top;
331 else if (maxValue + minValue == 0.0)
335 ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
337 ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
338 range = scrn_rect.bottom;
339 wth = scrn_rect.left + scrn_rect.right;
341 ypoint = ycentre + ((cur_value-1.0) * range / val_span);
343 ypoint = ycentre + (cur_value * range / val_span);
344 xpoint = wth + marker_offset;
345 drawOneLine(xpoint,ycentre,xpoint,ypoint);
346 drawOneLine(xpoint,ypoint,xpoint-marker_offset,ypoint);
347 drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint+5.0);
348 drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint-5.0);
352 fixed(marker_offset+marker_xe, text_y + scrn_rect.right / 6,
353 marker_offset+marker_xs, text_y,marker_offset+marker_xe,
354 text_y - scrn_rect.right / 6);
358 } //end vertical/left
360 // begin vertical/right
361 //First draw capping lines and pointers
362 if( huds_right(options) ) { // We'll default this for now.
364 drawOneLine( scrn_rect.left, scrn_rect.top,
365 scrn_rect.left, marker_ye ); // Cap left side
368 marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
370 // drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
371 // marker_xe, mid_scr.y );
372 // drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
373 // marker_xe, mid_scr.y);
377 if(pointer_type=="moving") {
379 //type-fixed & zoom=1, behaviour to be defined
380 // Code for Moving Type Pointer included by suma.
381 float ycentre, ypoint,xpoint;
384 if(cur_value > maxValue)
385 cur_value = maxValue;
386 if(cur_value < minValue)
387 cur_value = minValue;
390 ycentre = scrn_rect.top;
391 else if (maxValue + minValue == 0.0)
395 ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
397 ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
398 range = scrn_rect.bottom;
401 ypoint = ycentre + ((cur_value-1.0) * range / val_span);
403 ypoint = ycentre + (cur_value * range / val_span);
404 xpoint = scrn_rect.left - marker_offset;
405 drawOneLine(xpoint,ycentre,xpoint,ypoint);
406 drawOneLine(xpoint,ypoint,xpoint+marker_offset,ypoint);
407 drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint+5.0);
408 drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint-5.0);
412 fixed( -marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6,
413 -marker_offset+marker_xe, text_y,-marker_offset+scrn_rect.left,
414 text_y - scrn_rect.right / 6);
417 } //end vertical/right
419 // At this point marker x_start and x_end values are transposed.
420 // To keep this from confusing things they are now interchanged.
421 if(huds_both(options)) {
422 marker_ye = marker_xs;
423 marker_xs = marker_xe;
424 marker_xe = marker_ye;
427 // Work through from bottom to top of scale. Calculating where to put
428 // minor and major ticks.
430 // draw scale or tape
432 // last = FloatToInt(vmax)+1;
433 // i = FloatToInt(vmin);
434 last = (int)vmax + 1; // N
438 zoomed_scale((int)vmin,(int)vmax); //suma
440 for( ; i <last ; i++ ) {
448 if( condition ) { // Show a tick if necessary
449 // Calculate the location of this tick
450 marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
451 // marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
452 // Block calculation artifact from drawing ticks below min coordinate.
453 // Calculation here accounts for text height.
455 if(( marker_ys < (scrn_rect.top + 4)) |
456 ( marker_ys > (height - 4)))
463 k = i+1; //enable ticks at odd values
469 // if( (i%div_min()) == 0) {
470 if( !(k%(int)div_min())) {
471 if((( marker_ys - 5) > scrn_rect.top ) &&
472 (( marker_ys + 5) < (height))) {
474 //vertical/left OR vertical/right
475 if( huds_both(options) ) {
476 if(tick_type=="line") {
477 if(tick_length=="variable") {
478 drawOneLine( scrn_rect.left, marker_ys,
479 marker_xs, marker_ys );
480 drawOneLine( marker_xe, marker_ys,
483 drawOneLine( scrn_rect.left, marker_ys,
484 marker_xs, marker_ys );
485 drawOneLine( marker_xe, marker_ys,
488 } else if(tick_type=="circle") // begin suma this func. is written below
489 circles(scrn_rect.left,(float)marker_ys,3.0); //end suma
492 // if neither line nor circle draw default as line
493 drawOneLine( scrn_rect.left, marker_ys,
494 marker_xs, marker_ys );
495 drawOneLine( marker_xe, marker_ys,
498 // glBegin(GL_LINES);
499 // glVertex2f( scrn_rect.left, marker_ys );
500 // glVertex2f( marker_xs, marker_ys );
501 // glVertex2f( marker_xe, marker_ys);
502 // glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
504 // anything other than huds_both
506 if( huds_left(options) ) {
507 if(tick_type=="line") {
508 if(tick_length=="variable") {
509 drawOneLine( marker_xs + 4, marker_ys,
510 marker_xe, marker_ys );
512 drawOneLine( marker_xs , marker_ys,
513 marker_xe, marker_ys );
515 } else if(tick_type=="circle") // begin suma
516 circles((float)marker_xs + 4, (float)marker_ys,3.0); //end suma
519 drawOneLine( marker_xs + 4, marker_ys,
520 marker_xe, marker_ys );
523 if(tick_type=="line") {
524 if(tick_length=="variable") {
525 drawOneLine( marker_xs, marker_ys,
526 marker_xe - 4, marker_ys );
528 drawOneLine( marker_xs, marker_ys,
529 marker_xe , marker_ys );
531 } else if(tick_type=="circle") //begin suma
532 circles((float)marker_xe - 4, (float)marker_ys,3.0); //end suma
534 drawOneLine( marker_xs, marker_ys,
535 marker_xe - 4, marker_ys );
540 } //end draw minor ticks
546 if( !(k%(int)div_max()) ) {
548 disp_val = i % (int) modulo(); // ?????????
551 disp_val += modulo();
557 lenstr = sprintf( TextScale, "%d",
558 FloatToInt(disp_val * data_scaling()/*+.5*/));
559 // (int)(disp_val * data_scaling() +.5));
560 /* if(( (marker_ys - 8 ) > scrn_rect.top ) &&
561 ( (marker_ys + 8) < (height))){ */ //suma
563 if( huds_both(options) ) {
564 // drawOneLine( scrn_rect.left, marker_ys,
565 // marker_xs, marker_ys);
566 // drawOneLine( marker_xs, marker_ys,
567 // scrn_rect.left + scrn_rect.right,
569 if(tick_type=="line") {
570 glBegin(GL_LINE_STRIP);
571 glVertex2f( scrn_rect.left, marker_ys );
572 glVertex2f( marker_xs, marker_ys);
573 glVertex2f( width, marker_ys);
575 } else if(tick_type=="circle") //begin suma
576 circles(scrn_rect.left, (float)marker_ys,5.0); //end suma
578 glBegin(GL_LINE_STRIP);
579 glVertex2f( scrn_rect.left, marker_ys );
580 glVertex2f( marker_xs, marker_ys);
581 glVertex2f( width, marker_ys);
585 if( !huds_notext(options)) {
586 textString ( marker_xs + 2, marker_ys,
591 /* Changes are made to draw a circle when tick_type="circle" */
592 // anything other than huds_both
593 if(tick_type=="line") {
594 drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
595 } else if(tick_type=="circle")
596 circles((float)marker_xs + 4, (float)marker_ys,5.0);//end suma
598 drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
600 if( !huds_notext(options) ) {
601 if( huds_left(options) ) {
602 textString( marker_xs - 8 * lenstr - 2,
606 textString( marker_xe + 3 * lenstr,
610 } //End if !huds_notext
612 } // End if draw major ticks
613 } // End if major ticks
617 // End if VERTICAL SCALE TYPE (tape loop yet to be closed)
619 // Horizontal scale by default
621 if (draw_tick_left) {
622 drawOneLine( scrn_rect.left, scrn_rect.top,
623 scrn_rect.left, height);
624 } // endif draw_tick_left
626 if (draw_tick_right) {
627 drawOneLine( width, scrn_rect.top,
630 } // endif draw_tick_right
632 marker_ys = scrn_rect.top; // Starting point for
633 marker_ye = height; // tick y location calcs
635 marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
638 // glBegin(GL_LINES);
640 // glVertex2f( scrn_rect.left, scrn_rect.top);
641 // glVertex2f( scrn_rect.left, marker_ye);
644 // glVertex2f( marker_xe, scrn_rect.top);
645 // glVertex2f( marker_xe, marker_ye );
648 if( huds_top(options) ) {
649 if (draw_cap_bottom) {
651 drawOneLine( scrn_rect.left,
658 marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
660 // drawOneLine( mid_scr.x, marker_ye,
661 // mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
662 // drawOneLine( mid_scr.x, marker_ye,
663 // mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
666 if(pointer_type=="moving") {
668 //Code for Moving Type Pointer included by suma.
669 // static float xcentre,xpoint,ypoint;
671 if(cur_value > maxValue) cur_value = maxValue;
672 if(cur_value < minValue) cur_value = minValue;
673 float xcentre = mid_scr.x;
674 int range = scrn_rect.right;
675 float xpoint = xcentre + (cur_value * range / val_span);
676 float ypoint = scrn_rect.top - marker_offset;
677 drawOneLine(xcentre, ypoint,xpoint,ypoint);
678 drawOneLine(xpoint,ypoint,xpoint,ypoint+marker_offset);
679 drawOneLine(xpoint,ypoint+marker_offset,xpoint+5.0,ypoint+5.0);
680 drawOneLine(xpoint,ypoint+marker_offset,xpoint-5.0,ypoint+5.0);
684 fixed( marker_xs - scrn_rect.bottom / 4, scrn_rect.top,
685 marker_xs, marker_ye, marker_xs + scrn_rect.bottom / 4,scrn_rect.top);
688 } //End Horizontal scale/top
690 if( huds_bottom(options) ) {
693 drawOneLine( scrn_rect.left, height,
698 marker_ys = height - scrn_rect.bottom / 2;
700 // drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
701 // scrn_rect.top + scrn_rect.bottom,
702 // mid_scr.x, marker_ys );
703 // drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
704 // scrn_rect.top + scrn_rect.bottom,
705 // mid_scr.x , marker_ys );
709 if(pointer_type=="moving") {
711 //Code for Moving Type Pointer included by suma.
712 // static float xcentre,xpoint,ypoint;
713 // static int range,hgt;
714 if(cur_value > maxValue) cur_value = maxValue;
715 if(cur_value < minValue) cur_value = minValue;
716 float xcentre = mid_scr.x ;
717 int range = scrn_rect.right;
718 int hgt = scrn_rect.top + scrn_rect.bottom;
719 float xpoint = xcentre + (cur_value * range / val_span);
720 float ypoint = hgt + marker_offset;
721 drawOneLine(xcentre, ypoint,xpoint,ypoint);
722 drawOneLine(xpoint,ypoint,xpoint,ypoint-marker_offset);
723 drawOneLine(xpoint,ypoint-marker_offset,xpoint+5.0,ypoint-5.0);
724 drawOneLine(xpoint,ypoint-marker_offset,xpoint-5.0,ypoint-5.0);
727 fixed( marker_xs + scrn_rect.bottom / 4, height, marker_xs, marker_ys,
728 marker_xs - scrn_rect.bottom / 4, height);
731 } //end horizontal scale bottom
733 // if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
734 // marker_xe = marker_ys;
735 // marker_ys = marker_ye;
736 // marker_ye = marker_xe;
739 // printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
741 // last = FloatToInt(vmax)+1;
742 // i = FloatToInt(vmin);
745 zoomed_scale((int)vmin,(int)vmax); //suma
748 last = (int)vmax + 1;
750 for(; i <last ; i++ ) {
751 // for( i = (int)vmin; i <= (int)vmax; i++ ) {
752 // printf("<*> i = %d\n", i);
759 // printf("<**> i = %d\n", i);
761 // marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
762 marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
765 k = i+1; //enable ticks at odd values
770 // if( (i%(int)div_min()) == 0 ) {
772 if( !(k%(int)div_min() )) {
773 // draw in ticks only if they aren't too close to the edge.
774 if((( marker_xs - 5) > scrn_rect.left ) &&
775 (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
777 if( huds_both(options) ) {
778 if(tick_length=="variable") {
779 drawOneLine( marker_xs, scrn_rect.top,
780 marker_xs, marker_ys - 4);
781 drawOneLine( marker_xs, marker_ye + 4,
784 drawOneLine( marker_xs, scrn_rect.top,
785 marker_xs, marker_ys);
786 drawOneLine( marker_xs, marker_ye,
789 // glBegin(GL_LINES);
790 // glVertex2f( marker_xs, scrn_rect.top);
791 // glVertex2f( marker_xs, marker_ys - 4);
792 // glVertex2f( marker_xs, marker_ye + 4);
793 // glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
796 if( huds_top(options)) {
798 if(tick_length=="variable")
799 drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye-4);
801 drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
803 if(tick_length=="variable")
804 drawOneLine(marker_xs,marker_ys+4,marker_xs,marker_ye);
806 drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
809 } //end draw minor ticks
813 // printf("i = %d\n", i);
814 // if( (i%(int)div_max())==0 ) {
816 if( !(k%(int)div_max()) ) {
818 disp_val = i % (int) modulo(); // ?????????
821 disp_val += modulo();
826 // printf("disp_val = %d\n", disp_val);
827 // printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
828 lenstr = sprintf( TextScale, "%d",
829 // (int)(disp_val * data_scaling() +.5));
830 FloatToInt(disp_val * data_scaling()/*+.5*/));
831 // Draw major ticks and text only if far enough from the edge.
832 if(( (marker_xs - 10)> scrn_rect.left ) &&
833 ( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
834 if( huds_both(options) ) {
835 // drawOneLine( marker_xs, scrn_rect.top,
836 // marker_xs, marker_ys);
837 // drawOneLine( marker_xs, marker_ye,
838 // marker_xs, scrn_rect.top + scrn_rect.bottom);
839 glBegin(GL_LINE_STRIP);
840 glVertex2f( marker_xs, scrn_rect.top);
841 glVertex2f( marker_xs, marker_ye);
842 glVertex2f( marker_xs, height);
844 if( !huds_notext(options) ) {
845 textString ( marker_xs - 4 * lenstr,
847 TextScale, 0 ); //suma
850 drawOneLine( marker_xs, marker_ys,
851 marker_xs, marker_ye );
852 if( !huds_notext(options)) {
853 if( huds_top(options) ) {
854 textString ( marker_xs - 4 * lenstr,
856 TextScale, 0 ); //suma
858 textString( marker_xs - 4 * lenstr,
860 TextScale, 0 ); //suma
865 } //end draw major ticks
866 } //endif major ticks
870 } //end horizontal/vertical scale
871 } // end of type tape
878 circles(float x,float y,float size)
880 glEnable(GL_POINT_SMOOTH);
888 glDisable(GL_POINT_SMOOTH);
894 fixed(float x1, float y1, float x2, float y2, float x3, float y3)
896 glBegin(GL_LINE_STRIP);
905 zoomed_scale(int first, int last)
908 POINT mid_scr = get_centroid();
909 RECT scrn_rect = get_location();
910 UINT options = get_options();
915 float x,y,w,h,bottom;
916 float cur_value=get_value();
917 if(cur_value > maxValue) cur_value = maxValue;
918 if(cur_value < minValue) cur_value = minValue;
922 while(first <= last) {
923 if((first % (int)Maj_div) == 0) {
932 if( huds_vert(options) ) {
936 w=scrn_rect.left+scrn_rect.right;
937 h=scrn_rect.top+scrn_rect.bottom;
938 bottom=scrn_rect.bottom;
940 float xstart, yfirst, ycentre, ysecond;
942 float hgt = bottom * 20.0 /100.0; // 60% of height should be zoomed
943 yfirst = mid_scr.y - hgt;
945 ysecond = mid_scr.y + hgt;
946 float range = hgt * 2;
949 float factor = range /10.0;
951 float hgt1 = bottom * 30.0 /100.0;
952 int incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ;
953 int incr = incrs / 2;
954 float factors = hgt1 / incr;
959 //this is for moving type pointer
960 static float ycent, ypoint,xpoint;
964 wth=scrn_rect.left+scrn_rect.right;
966 if(cur_value <= data[centre+1])
967 if(cur_value > data[centre]) {
968 ypoint = ycent + ((cur_value - data[centre]) * hgt/Maj_div);
971 if(cur_value >= data[centre-1])
972 if(cur_value <= data[centre]) {
973 ypoint = ycent - ((data[centre]-cur_value) * hgt/Maj_div);
976 if(cur_value < data[centre-1])
977 if(cur_value >= minValue) {
978 float diff = minValue - data[centre-1];
979 float diff1 = cur_value - data[centre-1];
980 float val = (diff1 * hgt1) / diff;
982 ypoint = ycent - hgt - val;
986 if(cur_value > data[centre+1])
987 if(cur_value <= maxValue) {
988 float diff = maxValue - data[centre+1];
989 float diff1 = cur_value - data[centre+1];
990 float val = (diff1 * hgt1) / diff;
992 ypoint = ycent + hgt + val;
995 if(huds_left(options)) {
998 drawOneLine( xstart, ycentre, xstart - 5.0, ycentre); //centre tick
1000 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1002 if( !huds_notext(options)) {
1003 textString (x, ycentre, TextScale, 0 );
1009 circles(xstart-2.5,yfirst, 3.0);
1010 circles(xstart-2.5,ycentre,3.0);
1013 yfirst = mid_scr.y - hgt;
1015 for(i=0;i<=incr;i++) {
1016 drawOneLine( xstart, yfirst, xstart - 5.0, yfirst);
1017 drawOneLine( xstart,ysecond, xstart - 5.0,ysecond);
1019 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1021 if( !huds_notext(options))
1022 textString (x, yfirst, TextScale, 0 );
1024 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1026 if( !huds_notext(options))
1027 textString (x, ysecond, TextScale, 0 );
1034 //to draw moving type pointer for left option
1036 xpoint = wth + 10.0;
1038 if(pointer_type == "moving") {
1039 drawOneLine(xpoint,ycent,xpoint,ypoint);
1040 drawOneLine(xpoint,ypoint,xpoint-10.0,ypoint);
1041 drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint+5.0);
1042 drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint-5.0);
1050 drawOneLine( xstart, ycentre, xstart + 5.0, ycentre); //centre tick
1052 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1054 if( !huds_notext(options)) {
1055 textString (w, ycentre, TextScale, 0 );
1061 circles(xstart+2.5,yfirst, 3.0);
1062 circles(xstart+2.5,ycentre,3.0);
1065 yfirst = mid_scr.y - hgt;
1067 for(i=0;i<=incr;i++) {
1068 drawOneLine( xstart, yfirst, xstart + 5.0, yfirst);
1069 drawOneLine( xstart,ysecond, xstart + 5.0,ysecond);
1071 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1073 if( !huds_notext(options))
1074 textString (w, yfirst, TextScale, 0 );
1076 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1078 if( !huds_notext(options))
1079 textString (w, ysecond, TextScale, 0 );
1086 // to draw moving type pointer for right option
1088 xpoint = scrn_rect.left;
1090 if(pointer_type == "moving") {
1091 drawOneLine(xpoint,ycent,xpoint,ypoint);
1092 drawOneLine(xpoint,ypoint,xpoint+10.0,ypoint);
1093 drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint+5.0);
1094 drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint-5.0);
1097 }//end huds_right /left
1098 //end of vertical scale
1103 w=scrn_rect.left+scrn_rect.right;
1104 h=scrn_rect.top+scrn_rect.bottom;
1105 bottom=scrn_rect.right;
1107 float ystart, xfirst, xcentre, xsecond;
1109 float hgt = bottom * 20.0 /100.0; // 60% of height should be zoomed
1110 xfirst = mid_scr.x - hgt;
1111 xcentre = mid_scr.x;
1112 xsecond = mid_scr.x + hgt;
1113 float range = hgt * 2;
1116 float factor = range /10.0;
1118 float hgt1 = bottom * 30.0 /100.0;
1119 int incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ;
1120 int incr = incrs / 2;
1121 float factors = hgt1 / incr;
1124 //Code for Moving Type Pointer
1126 static float xcent,xpoint,ypoint;
1130 if(cur_value <= data[centre+1])
1131 if(cur_value > data[centre]) {
1132 xpoint = xcent + ((cur_value - data[centre]) * hgt/Maj_div);
1135 if(cur_value >= data[centre-1])
1136 if(cur_value <= data[centre]) {
1137 xpoint = xcent - ((data[centre]-cur_value) * hgt/Maj_div);
1140 if(cur_value < data[centre-1])
1141 if(cur_value >= minValue) {
1142 float diff = minValue - data[centre-1];
1143 float diff1 = cur_value - data[centre-1];
1144 float val = (diff1 * hgt1) / diff;
1146 xpoint = xcent - hgt - val;
1150 if(cur_value > data[centre+1])
1151 if(cur_value <= maxValue) {
1152 float diff = maxValue - data[centre+1];
1153 float diff1 = cur_value - data[centre+1];
1154 float val = (diff1 * hgt1) / diff;
1156 xpoint = xcent + hgt + val;
1160 if(huds_top(options)) {
1164 drawOneLine( xcentre, ystart, xcentre, ystart - 5.0); //centre tick
1166 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1168 if( !huds_notext(options)) {
1169 textString (xcentre-10.0, y, TextScale, 0 );
1175 circles(xfirst, ystart-2.5, 3.0);
1176 circles(xcentre, ystart-2.5, 3.0);
1179 xfirst = mid_scr.x - hgt;
1181 for(i=0;i<=incr;i++) {
1182 drawOneLine( xfirst, ystart, xfirst, ystart - 5.0);
1183 drawOneLine( xsecond, ystart, xsecond, ystart - 5.0);
1185 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1187 if( !huds_notext(options))
1188 textString (xfirst-10.0, y, TextScale, 0 );
1190 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1192 if( !huds_notext(options))
1193 textString (xsecond-10.0, y, TextScale, 0 );
1200 //this is for moving pointer for top option
1203 ypoint = scrn_rect.top + scrn_rect.bottom + 10.0;
1205 if(pointer_type == "moving") {
1206 drawOneLine(xcent, ypoint,xpoint,ypoint);
1207 drawOneLine(xpoint,ypoint,xpoint,ypoint-10.0);
1208 drawOneLine(xpoint,ypoint-10.0,xpoint+5.0,ypoint-5.0);
1209 drawOneLine(xpoint,ypoint-10.0,xpoint-5.0,ypoint-5.0);
1216 //drawOneLine( xstart, yfirst, xstart - 5.0, yfirst );
1217 drawOneLine( xcentre, ystart, xcentre, ystart + 5.0); //centre tick
1219 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1221 if( !huds_notext(options)) {
1222 textString (xcentre-10.0, h, TextScale, 0 );
1228 circles(xfirst, ystart+2.5, 3.0);
1229 circles(xcentre, ystart+2.5,3.0);
1232 xfirst = mid_scr.x - hgt;
1234 for(i=0;i<=incr;i++) {
1235 drawOneLine( xfirst, ystart, xfirst, ystart + 5.0);
1236 drawOneLine( xsecond,ystart, xsecond,ystart + 5.0);
1238 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1240 if( !huds_notext(options))
1241 textString (xfirst-10.0,h, TextScale, 0 );
1243 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1245 if( !huds_notext(options))
1246 textString (xsecond-10.0,h, TextScale, 0 );
1253 //this is for movimg pointer for bottom option
1256 ypoint = scrn_rect.top - 10.0;
1257 if(pointer_type == "moving") {
1258 drawOneLine(xcent, ypoint,xpoint,ypoint);
1259 drawOneLine(xpoint,ypoint,xpoint,ypoint+10.0);
1260 drawOneLine(xpoint,ypoint+10.0,xpoint+5.0,ypoint+5.0);
1261 drawOneLine(xpoint,ypoint+10.0,xpoint-5.0,ypoint+5.0);
1266 }//end hud_top or hud_bottom
1268 } //end of horizontal/vertical scales