4 #ifdef USE_HUD_TextList
5 #define textString( x , y, text, font,digit) TextString( text, x , y ,digit ) //suma
7 #define textString( x , y, text, font,digit ) puDrawString ( guiFnt, text, x, y ); //suma
10 //========== Top of hud_card class member definitions =============
26 float max_value, // 360
46 string type_tick,//hud
47 string length_tick,//hud
53 instr_scale( x,y,width,height,
56 max_value, min_value, disp_scaling,
57 major_divs, minor_divs, modulus,
59 val_span ( value_span),
61 draw_tick_bottom (tick_bottom),
62 draw_tick_top (tick_top),
63 draw_tick_right (tick_right),
64 draw_tick_left (tick_left),
65 draw_cap_bottom (cap_bottom),
66 draw_cap_top (cap_top),
67 draw_cap_right (cap_right),
68 draw_cap_left (cap_left),
69 marker_offset (mark_offset),
70 pointer (pointer_enable),
71 pointer_type (type_pointer),
72 tick_type (type_tick), //hud
73 tick_length (length_tick), //hud
74 Maj_div (major_divs), //suma
75 Min_div (minor_divs) //suma
78 half_width_units = range_to_show() / 2.0;
80 maxValue=max_value; //suma
81 minValue=min_value; //suma
82 divisions=divs; //suma
85 // UINT options = get_options();
86 // huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
87 // huds_right = options & HUDS_RIGHT;
88 // huds_left = options & HUDS_LEFT;
89 // huds_vert = options & HUDS_VERT;
90 // huds_notext = options & HUDS_NOTEXT;
91 // huds_top = options & HUDS_TOP;
92 // huds_bottom = options & HUDS_BOTTOM;
99 hud_card( const hud_card & image):
100 instr_scale( (const instr_scale & ) image),
101 val_span( image.val_span),
103 half_width_units (image.half_width_units),
104 draw_tick_bottom (image.draw_tick_bottom),
105 draw_tick_top (image.draw_tick_top),
106 draw_tick_right (image.draw_tick_right),
107 draw_tick_left (image.draw_tick_left),
108 draw_cap_bottom (image.draw_cap_bottom),
109 draw_cap_top (image.draw_cap_top),
110 draw_cap_right (image.draw_cap_right),
111 draw_cap_left (image.draw_cap_left),
112 marker_offset (image.marker_offset),
113 pointer (image.pointer),
114 pointer_type (image.pointer_type),
115 tick_type(image.tick_type), //hud
116 tick_length(image.tick_length), //hud
117 Maj_div(image.Maj_div), //suma
118 Min_div(image.Min_div)//suma
121 // UINT options = get_options();
122 // huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
123 // huds_right = options & HUDS_RIGHT;
124 // huds_left = options & HUDS_LEFT;
125 // huds_vert = options & HUDS_VERT;
126 // huds_notext = options & HUDS_NOTEXT;
127 // huds_top = options & HUDS_TOP;
128 // huds_bottom = options & HUDS_BOTTOM;
131 hud_card & hud_card ::
132 operator = (const hud_card & rhs )
134 if( !( this == &rhs)){
135 instr_scale::operator = (rhs);
136 val_span = rhs.val_span;
137 half_width_units = rhs.half_width_units;
138 draw_tick_bottom = rhs.draw_tick_bottom;
139 draw_tick_top = rhs.draw_tick_top;
140 draw_tick_right = rhs.draw_tick_right;
141 draw_tick_left = rhs.draw_tick_left;
142 draw_cap_bottom = rhs.draw_cap_bottom;
143 draw_cap_top = rhs.draw_cap_top;
144 draw_cap_right = rhs.draw_cap_right;
145 draw_cap_left = rhs.draw_cap_left;
146 marker_offset = rhs.marker_offset;
148 pointer = rhs.pointer;
149 pointer_type = rhs.pointer_type;
150 tick_type = rhs.tick_type;
151 tick_length = rhs.tick_length;
152 Maj_div = rhs.Maj_div; //suma
153 Min_div = rhs.Min_div; //suma
161 draw( void ) // (HUD_scale * pscale )
164 float vmin = 0.0, vmax = 0.0;
169 int text_x = 0, text_y = 0;
176 int oddtype, k; //odd or even values for ticks
178 POINT mid_scr = get_centroid();
179 float cur_value = get_value();
181 if (!((int)maxValue%2) )
182 oddtype =0; //draw ticks at even values
184 oddtype = 1;//draw ticks at odd values
186 RECT scrn_rect = get_location();
187 UINT options = get_options();
189 height = scrn_rect.top + scrn_rect.bottom;
190 width = scrn_rect.left + scrn_rect.right;
193 // if type=gauge then display dial
198 y=(float)(scrn_rect.top);
199 x=(float)(scrn_rect.left);
200 glEnable(GL_POINT_SMOOTH);
203 float incr= 360.0/divisions;
204 for(i=0.0;i<360.0;i+=incr) {
205 float i1=i*SGD_DEGREES_TO_RADIANS;
206 float x1=x+radius*cos(i1);
207 float y1=y+radius*sin(i1);
214 glDisable(GL_POINT_SMOOTH);
217 if(data_available()) {
218 float offset = 90.0*SGD_DEGREES_TO_RADIANS;
219 float r1=10.0; //size of carrot
220 float theta= get_value();
222 float theta1= -theta*SGD_DEGREES_TO_RADIANS+offset;
223 float x1=x+radius*cos(theta1);
224 float y1=y+radius*sin(theta1);
225 float x2=x1-r1*cos(theta1-30.0*SGD_DEGREES_TO_RADIANS);
226 float y2=y1-r1*sin(theta1-30.0*SGD_DEGREES_TO_RADIANS);
227 float x3=x1-r1*cos(theta1+30.0*SGD_DEGREES_TO_RADIANS);
228 float y3=y1-r1*sin(theta1+30.0*SGD_DEGREES_TO_RADIANS);
231 drawOneLine(x1,y1,x2,y2);
232 drawOneLine(x1,y1,x3,y3);
233 sprintf(TextScale,"%3.1f\n",theta);
236 int l= abs((int)theta);
238 textString (x,y,TextScale,GLUT_BITMAP_8_BY_13,0 );
239 if((l>=10) && (l<=99))
240 textString (x-1.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 );
241 if((l>=100) && (l<=359))
242 textString (x-2.0,y,TextScale,GLUT_BITMAP_8_BY_13,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 static float ycentre, ypoint,xpoint;
326 static int range,wth;
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 static float ycentre, ypoint,xpoint;
382 static int range,wth;
383 if(cur_value > maxValue) cur_value = maxValue;
384 if(cur_value < minValue) cur_value = minValue;
386 ycentre = scrn_rect.top;
387 else if (maxValue + minValue == 0.0)
391 ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
393 ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
394 range = scrn_rect.bottom;
396 ypoint = ycentre + ((cur_value-1.0) * range / val_span);
398 ypoint = ycentre + (cur_value * range / val_span);
399 xpoint = scrn_rect.left - marker_offset;
400 drawOneLine(xpoint,ycentre,xpoint,ypoint);
401 drawOneLine(xpoint,ypoint,xpoint+marker_offset,ypoint);
402 drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint+5.0);
403 drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint-5.0);
407 fixed( -marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6,
408 -marker_offset+marker_xe, text_y,-marker_offset+scrn_rect.left,
409 text_y - scrn_rect.right / 6);
412 } //end vertical/right
414 // At this point marker x_start and x_end values are transposed.
415 // To keep this from confusing things they are now interchanged.
416 if(huds_both(options)) {
417 marker_ye = marker_xs;
418 marker_xs = marker_xe;
419 marker_xe = marker_ye;
422 // Work through from bottom to top of scale. Calculating where to put
423 // minor and major ticks.
425 // draw scale or tape
427 last = FloatToInt(vmax)+1;
428 i = FloatToInt(vmin);
431 zoomed_scale(vmin,vmax); //suma
433 for( ; i <last ; i++ ) {
441 if( condition ) { // Show a tick if necessary
442 // Calculate the location of this tick
443 marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
444 // marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
445 // Block calculation artifact from drawing ticks below min coordinate.
446 // Calculation here accounts for text height.
448 /* if(( marker_ys < (scrn_rect.top + 4)) |
449 ( marker_ys > (height - 4)))
456 k = i+1; //enable ticks at odd values
462 // if( (i%div_min()) == 0) {
463 if( !(k%(int)div_min())) {
464 /* if((( marker_ys - 5) > scrn_rect.top ) &&
465 (( marker_ys + 5) < (height))){ */
467 //vertical/left OR vertical/right
468 if( huds_both(options) ) {
469 if(tick_type=="line") {
470 if(tick_length=="variable") {
471 drawOneLine( scrn_rect.left, marker_ys,
472 marker_xs, marker_ys );
473 drawOneLine( marker_xe, marker_ys,
476 drawOneLine( scrn_rect.left, marker_ys,
477 marker_xs, marker_ys );
478 drawOneLine( marker_xe, marker_ys,
481 } else if(tick_type=="circle") // begin suma this func. is written below
482 circles(scrn_rect.left,(float)marker_ys,3.0); //end suma
485 // if neither line nor circle draw default as line
486 drawOneLine( scrn_rect.left, marker_ys,
487 marker_xs, marker_ys );
488 drawOneLine( marker_xe, marker_ys,
491 // glBegin(GL_LINES);
492 // glVertex2f( scrn_rect.left, marker_ys );
493 // glVertex2f( marker_xs, marker_ys );
494 // glVertex2f( marker_xe, marker_ys);
495 // glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
497 // anything other than huds_both
499 if( huds_left(options) ) {
500 if(tick_type=="line") {
501 if(tick_length=="variable") {
502 drawOneLine( marker_xs + 4, marker_ys,
503 marker_xe, marker_ys );
505 drawOneLine( marker_xs , marker_ys,
506 marker_xe, marker_ys );
508 } else if(tick_type=="circle") // begin suma
509 circles((float)marker_xs + 4, (float)marker_ys,3.0); //end suma
512 drawOneLine( marker_xs + 4, marker_ys,
513 marker_xe, marker_ys );
516 if(tick_type=="line") {
517 if(tick_length=="variable") {
518 drawOneLine( marker_xs, marker_ys,
519 marker_xe - 4, marker_ys );
521 drawOneLine( marker_xs, marker_ys,
522 marker_xe , marker_ys );
524 } else if(tick_type=="circle") //begin suma
525 circles((float)marker_xe - 4, (float)marker_ys,3.0); //end suma
527 drawOneLine( marker_xs, marker_ys,
528 marker_xe - 4, marker_ys );
532 } //end draw minor ticks
538 if( !(k%(int)div_max()) ) {
540 disp_val = i % (int) modulo(); // ?????????
543 disp_val += modulo();
549 lenstr = sprintf( TextScale, "%d",
550 FloatToInt(disp_val * data_scaling()/*+.5*/));
551 // (int)(disp_val * data_scaling() +.5));
552 /* if(( (marker_ys - 8 ) > scrn_rect.top ) &&
553 ( (marker_ys + 8) < (height))){ */ //suma
555 if( huds_both(options) ) {
556 // drawOneLine( scrn_rect.left, marker_ys,
557 // marker_xs, marker_ys);
558 // drawOneLine( marker_xs, marker_ys,
559 // scrn_rect.left + scrn_rect.right,
561 if(tick_type=="line") {
562 glBegin(GL_LINE_STRIP);
563 glVertex2f( scrn_rect.left, marker_ys );
564 glVertex2f( marker_xs, marker_ys);
565 glVertex2f( width, marker_ys);
567 } else if(tick_type=="circle") //begin suma
568 circles(scrn_rect.left, (float)marker_ys,5.0); //end suma
570 glBegin(GL_LINE_STRIP);
571 glVertex2f( scrn_rect.left, marker_ys );
572 glVertex2f( marker_xs, marker_ys);
573 glVertex2f( width, marker_ys);
577 if( !huds_notext(options)) {
578 textString ( marker_xs + 2, marker_ys,
579 TextScale, GLUT_BITMAP_8_BY_13,0 );
583 /* Changes are made to draw a circle when tick_type="circle" */
584 // anything other than huds_both
585 if(tick_type=="line") {
586 drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
587 } else if(tick_type=="circle")
588 circles((float)marker_xs + 4, (float)marker_ys,5.0);//end suma
590 drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
592 if( !huds_notext(options) ) {
593 if( huds_left(options) ) {
594 textString( marker_xs - 8 * lenstr - 2,
596 TextScale, GLUT_BITMAP_8_BY_13,0 );
598 textString( marker_xe + 3 * lenstr,
600 TextScale, GLUT_BITMAP_8_BY_13,0 );
602 } //End if !huds_notext
604 } // End if draw major ticks
605 } // End if major ticks
609 // End if VERTICAL SCALE TYPE (tape loop yet to be closed)
611 // Horizontal scale by default
613 if (draw_tick_left) {
614 drawOneLine( scrn_rect.left, scrn_rect.top,
615 scrn_rect.left, height);
616 } // endif draw_tick_left
618 if (draw_tick_right) {
619 drawOneLine( width, scrn_rect.top,
622 } // endif draw_tick_right
624 marker_ys = scrn_rect.top; // Starting point for
625 marker_ye = height; // tick y location calcs
627 marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
630 // glBegin(GL_LINES);
632 // glVertex2f( scrn_rect.left, scrn_rect.top);
633 // glVertex2f( scrn_rect.left, marker_ye);
636 // glVertex2f( marker_xe, scrn_rect.top);
637 // glVertex2f( marker_xe, marker_ye );
640 if( huds_top(options) ) {
641 if (draw_cap_bottom) {
643 drawOneLine( scrn_rect.left,
650 marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
652 // drawOneLine( mid_scr.x, marker_ye,
653 // mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
654 // drawOneLine( mid_scr.x, marker_ye,
655 // mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
658 if(pointer_type=="moving") {
660 //Code for Moving Type Pointer included by suma.
661 static float xcentre,xpoint,ypoint;
663 if(cur_value > maxValue) cur_value = maxValue;
664 if(cur_value < minValue) cur_value = minValue;
666 range = scrn_rect.right;
667 xpoint = xcentre + (cur_value * range / val_span);
668 ypoint = scrn_rect.top - marker_offset;
669 drawOneLine(xcentre, ypoint,xpoint,ypoint);
670 drawOneLine(xpoint,ypoint,xpoint,ypoint+marker_offset);
671 drawOneLine(xpoint,ypoint+marker_offset,xpoint+5.0,ypoint+5.0);
672 drawOneLine(xpoint,ypoint+marker_offset,xpoint-5.0,ypoint+5.0);
676 fixed( marker_xs - scrn_rect.bottom / 4, scrn_rect.top,
677 marker_xs, marker_ye, marker_xs + scrn_rect.bottom / 4,scrn_rect.top);
680 } //End Horizontal scale/top
682 if( huds_bottom(options) ) {
685 drawOneLine( scrn_rect.left, height,
690 marker_ys = height - scrn_rect.bottom / 2;
692 // drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
693 // scrn_rect.top + scrn_rect.bottom,
694 // mid_scr.x, marker_ys );
695 // drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
696 // scrn_rect.top + scrn_rect.bottom,
697 // mid_scr.x , marker_ys );
701 if(pointer_type=="moving") {
703 //Code for Moving Type Pointer included by suma.
704 static float xcentre,xpoint,ypoint;
705 static int range,hgt;
706 if(cur_value > maxValue) cur_value = maxValue;
707 if(cur_value < minValue) cur_value = minValue;
708 xcentre = mid_scr.x ;
709 range = scrn_rect.right;
710 hgt = scrn_rect.top + scrn_rect.bottom;
711 xpoint = xcentre + (cur_value * range / val_span);
712 ypoint = hgt + marker_offset;
713 drawOneLine(xcentre, ypoint,xpoint,ypoint);
714 drawOneLine(xpoint,ypoint,xpoint,ypoint-marker_offset);
715 drawOneLine(xpoint,ypoint-marker_offset,xpoint+5.0,ypoint-5.0);
716 drawOneLine(xpoint,ypoint-marker_offset,xpoint-5.0,ypoint-5.0);
719 fixed( marker_xs + scrn_rect.bottom / 4, height, marker_xs, marker_ys,
720 marker_xs - scrn_rect.bottom / 4, height);
723 } //end horizontal scale bottom
725 // if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
726 // marker_xe = marker_ys;
727 // marker_ys = marker_ye;
728 // marker_ye = marker_xe;
731 // printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
733 // last = FloatToInt(vmax)+1;
734 // i = FloatToInt(vmin);
737 zoomed_scale(vmin,vmax); //suma
740 last = (int)vmax + 1;
742 for(; i <last ; i++ ) {
743 // for( i = (int)vmin; i <= (int)vmax; i++ ) {
744 // printf("<*> i = %d\n", i);
751 // printf("<**> i = %d\n", i);
753 // marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
754 marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
757 k = i+1; //enable ticks at odd values
762 // if( (i%(int)div_min()) == 0 ) {
764 if( !(k%(int)div_min() )) {
765 // draw in ticks only if they aren't too close to the edge.
766 /*if((( marker_xs - 5) > scrn_rect.left ) &&
767 (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){ */ //suma
769 if( huds_both(options) ) {
770 if(tick_length=="variable") {
771 drawOneLine( marker_xs, scrn_rect.top,
772 marker_xs, marker_ys - 4);
773 drawOneLine( marker_xs, marker_ye + 4,
776 drawOneLine( marker_xs, scrn_rect.top,
777 marker_xs, marker_ys);
778 drawOneLine( marker_xs, marker_ye,
781 // glBegin(GL_LINES);
782 // glVertex2f( marker_xs, scrn_rect.top);
783 // glVertex2f( marker_xs, marker_ys - 4);
784 // glVertex2f( marker_xs, marker_ye + 4);
785 // glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
788 if( huds_top(options)) {
790 if(tick_length=="variable")
791 drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye-4);
793 drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
795 if(tick_length=="variable")
796 drawOneLine(marker_xs,marker_ys+4,marker_xs,marker_ye);
798 drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
800 } //end draw minor ticks
804 // printf("i = %d\n", i);
805 // if( (i%(int)div_max())==0 ) {
807 if( !(k%(int)div_max()) ) {
809 disp_val = i % (int) modulo(); // ?????????
812 disp_val += modulo();
817 // printf("disp_val = %d\n", disp_val);
818 // printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
819 lenstr = sprintf( TextScale, "%d",
820 // (int)(disp_val * data_scaling() +.5));
821 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))){*/ //suma
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);
835 if( !huds_notext(options) ) {
836 textString ( marker_xs - 4 * lenstr,
838 TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma
841 drawOneLine( marker_xs, marker_ys,
842 marker_xs, marker_ye );
843 if( !huds_notext(options)) {
844 if( huds_top(options) ) {
845 textString ( marker_xs - 4 * lenstr,
847 TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma
849 textString( marker_xs - 4 * lenstr,
851 TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma
855 } //end draw major ticks
856 } //endif major ticks
860 } //end horizontal/vertical scale
861 } // end of type tape
868 circles(float x,float y,float size)
870 glEnable(GL_POINT_SMOOTH);
878 glDisable(GL_POINT_SMOOTH);
884 fixed(float x1, float y1, float x2, float y2, float x3, float y3)
886 glBegin(GL_LINE_STRIP);
895 zoomed_scale(int first, int last)
898 POINT mid_scr = get_centroid();
899 RECT scrn_rect = get_location();
900 UINT options = get_options();
905 float x,y,w,h,bottom;
906 float cur_value=get_value();
907 if(cur_value > maxValue) cur_value = maxValue;
908 if(cur_value < minValue) cur_value = minValue;
912 while(first <= last) {
913 if((first % (int)Maj_div) == 0) {
922 if( huds_vert(options) ) {
926 w=scrn_rect.left+scrn_rect.right;
927 h=scrn_rect.top+scrn_rect.bottom;
928 bottom=scrn_rect.bottom;
930 float xstart, yfirst, ycentre, ysecond;
932 float hgt = bottom * 20.0 /100.0; // 60% of height should be zoomed
933 yfirst = mid_scr.y - hgt;
935 ysecond = mid_scr.y + hgt;
936 float range = hgt * 2;
939 float factor = range /10.0;
941 float hgt1 = bottom * 30.0 /100.0;
942 int incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ;
943 int incr = incrs / 2;
944 float factors = hgt1 / incr;
949 //this is for moving type pointer
950 static float ycent, ypoint,xpoint;
954 wth=scrn_rect.left+scrn_rect.right;
956 if(cur_value <= data[centre+1])
957 if(cur_value > data[centre]) {
958 ypoint = ycent + ((cur_value - data[centre]) * hgt/Maj_div);
961 if(cur_value >= data[centre-1])
962 if(cur_value <= data[centre]) {
963 ypoint = ycent - ((data[centre]-cur_value) * hgt/Maj_div);
966 if(cur_value < data[centre-1])
967 if(cur_value >= minValue) {
968 float diff = minValue - data[centre-1];
969 float diff1 = cur_value - data[centre-1];
970 float val = (diff1 * hgt1) / diff;
972 ypoint = ycent - hgt - val;
976 if(cur_value > data[centre+1])
977 if(cur_value <= maxValue) {
978 float diff = maxValue - data[centre+1];
979 float diff1 = cur_value - data[centre+1];
980 float val = (diff1 * hgt1) / diff;
982 ypoint = ycent + hgt + val;
985 if(huds_left(options)) {
988 drawOneLine( xstart, ycentre, xstart - 5.0, ycentre); //centre tick
990 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
992 if( !huds_notext(options)) {
993 textString (x, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 );
999 circles(xstart-2.5,yfirst, 3.0);
1000 circles(xstart-2.5,ycentre,3.0);
1003 yfirst = mid_scr.y - hgt;
1005 for(i=0;i<=incr;i++) {
1006 drawOneLine( xstart, yfirst, xstart - 5.0, yfirst);
1007 drawOneLine( xstart,ysecond, xstart - 5.0,ysecond);
1009 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1011 if( !huds_notext(options))
1012 textString (x, yfirst, TextScale, GLUT_BITMAP_8_BY_13,0 );
1014 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1016 if( !huds_notext(options))
1017 textString (x, ysecond, TextScale, GLUT_BITMAP_8_BY_13,0 );
1024 //to draw moving type pointer for left option
1026 xpoint = wth + 10.0;
1028 if(pointer_type == "moving") {
1029 drawOneLine(xpoint,ycent,xpoint,ypoint);
1030 drawOneLine(xpoint,ypoint,xpoint-10.0,ypoint);
1031 drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint+5.0);
1032 drawOneLine(xpoint-10.0,ypoint,xpoint-5.0,ypoint-5.0);
1040 drawOneLine( xstart, ycentre, xstart + 5.0, ycentre); //centre tick
1042 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1044 if( !huds_notext(options)) {
1045 textString (w, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 );
1051 circles(xstart+2.5,yfirst, 3.0);
1052 circles(xstart+2.5,ycentre,3.0);
1055 yfirst = mid_scr.y - hgt;
1057 for(i=0;i<=incr;i++) {
1058 drawOneLine( xstart, yfirst, xstart + 5.0, yfirst);
1059 drawOneLine( xstart,ysecond, xstart + 5.0,ysecond);
1061 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1063 if( !huds_notext(options))
1064 textString (w, yfirst, TextScale, GLUT_BITMAP_8_BY_13,0 );
1066 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1068 if( !huds_notext(options))
1069 textString (w, ysecond, TextScale, GLUT_BITMAP_8_BY_13,0 );
1076 // to draw moving type pointer for right option
1078 xpoint = scrn_rect.left;
1080 if(pointer_type == "moving") {
1081 drawOneLine(xpoint,ycent,xpoint,ypoint);
1082 drawOneLine(xpoint,ypoint,xpoint+10.0,ypoint);
1083 drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint+5.0);
1084 drawOneLine(xpoint+10.0,ypoint,xpoint+5.0,ypoint-5.0);
1087 }//end huds_right /left
1088 //end of vertical scale
1093 w=scrn_rect.left+scrn_rect.right;
1094 h=scrn_rect.top+scrn_rect.bottom;
1095 bottom=scrn_rect.right;
1097 float ystart, xfirst, xcentre, xsecond;
1099 float hgt = bottom * 20.0 /100.0; // 60% of height should be zoomed
1100 xfirst = mid_scr.x - hgt;
1101 xcentre = mid_scr.x;
1102 xsecond = mid_scr.x + hgt;
1103 float range = hgt * 2;
1106 float factor = range /10.0;
1108 float hgt1 = bottom * 30.0 /100.0;
1109 int incrs = ((int)val_span - (Maj_div * 2)) / Maj_div ;
1110 int incr = incrs / 2;
1111 float factors = hgt1 / incr;
1114 //Code for Moving Type Pointer
1116 static float xcent,xpoint,ypoint;
1120 if(cur_value <= data[centre+1])
1121 if(cur_value > data[centre]) {
1122 xpoint = xcent + ((cur_value - data[centre]) * hgt/Maj_div);
1125 if(cur_value >= data[centre-1])
1126 if(cur_value <= data[centre]) {
1127 xpoint = xcent - ((data[centre]-cur_value) * hgt/Maj_div);
1130 if(cur_value < data[centre-1])
1131 if(cur_value >= minValue) {
1132 float diff = minValue - data[centre-1];
1133 float diff1 = cur_value - data[centre-1];
1134 float val = (diff1 * hgt1) / diff;
1136 xpoint = xcent - hgt - val;
1140 if(cur_value > data[centre+1])
1141 if(cur_value <= maxValue) {
1142 float diff = maxValue - data[centre+1];
1143 float diff1 = cur_value - data[centre+1];
1144 float val = (diff1 * hgt1) / diff;
1146 xpoint = xcent + hgt + val;
1150 if(huds_top(options)) {
1154 drawOneLine( xcentre, ystart, xcentre, ystart - 5.0); //centre tick
1156 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1158 if( !huds_notext(options)) {
1159 textString (xcentre-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
1165 circles(xfirst, ystart-2.5, 3.0);
1166 circles(xcentre, ystart-2.5, 3.0);
1169 xfirst = mid_scr.x - hgt;
1171 for(i=0;i<=incr;i++) {
1172 drawOneLine( xfirst, ystart, xfirst, ystart - 5.0);
1173 drawOneLine( xsecond, ystart, xsecond, ystart - 5.0);
1175 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1177 if( !huds_notext(options))
1178 textString (xfirst-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
1180 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1182 if( !huds_notext(options))
1183 textString (xsecond-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
1190 //this is for moving pointer for top option
1193 ypoint = scrn_rect.top + scrn_rect.bottom + 10.0;
1195 if(pointer_type == "moving") {
1196 drawOneLine(xcent, ypoint,xpoint,ypoint);
1197 drawOneLine(xpoint,ypoint,xpoint,ypoint-10.0);
1198 drawOneLine(xpoint,ypoint-10.0,xpoint+5.0,ypoint-5.0);
1199 drawOneLine(xpoint,ypoint-10.0,xpoint-5.0,ypoint-5.0);
1206 //drawOneLine( xstart, yfirst, xstart - 5.0, yfirst );
1207 drawOneLine( xcentre, ystart, xcentre, ystart + 5.0); //centre tick
1209 sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
1211 if( !huds_notext(options)) {
1212 textString (xcentre-10.0, h, TextScale, GLUT_BITMAP_8_BY_13,0 );
1218 circles(xfirst, ystart+2.5, 3.0);
1219 circles(xcentre, ystart+2.5,3.0);
1222 xfirst = mid_scr.x - hgt;
1224 for(i=0;i<=incr;i++) {
1225 drawOneLine( xfirst, ystart, xfirst, ystart + 5.0);
1226 drawOneLine( xsecond,ystart, xsecond,ystart + 5.0);
1228 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
1230 if( !huds_notext(options))
1231 textString (xfirst-10.0,h, TextScale, GLUT_BITMAP_8_BY_13,0 );
1233 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
1235 if( !huds_notext(options))
1236 textString (xsecond-10.0,h, TextScale, GLUT_BITMAP_8_BY_13,0 );
1243 //this is for movimg pointer for bottom option
1246 ypoint = scrn_rect.top - 10.0;
1247 if(pointer_type == "moving") {
1248 drawOneLine(xcent, ypoint,xpoint,ypoint);
1249 drawOneLine(xpoint,ypoint,xpoint,ypoint+10.0);
1250 drawOneLine(xpoint,ypoint+10.0,xpoint+5.0,ypoint+5.0);
1251 drawOneLine(xpoint,ypoint+10.0,xpoint-5.0,ypoint+5.0);
1256 }//end hud_top or hud_bottom
1258 } //end of horizontal/vertical scales