Пример #1
0
void CarGPS::draw()
{
   logger->log(DEBUG, "CarGPS::draw", "start");

   struct gpf_data data;

   if (sensor->is_connected()) {
      sensor->get_data(&data);

      if (display_type == SENSOR_READOUT)
         draw_readout(&data);
      else
         draw_map(&data);

      return;
   } 

   // sensor is not connected
   draw_string(0, 0, width, height-100, gdTrueColor(250,250,250), 
      conf->get_value("font"), 18, "GPS Receiver not connected");
   gdImageCopy(img, graphic, 0, img->sy - graphic->sy, 0, 0, graphic->sx, 
      graphic->sy);
   update();

   logger->log(DEBUG, "CarGPS::draw", "end");
}
void Sliderule :: draw_readouts (wxDC & dc) {
	Rule * rule = root;
	while (rule != NULL) {
		Scale * scale = rule -> root;
		while (! rule -> channel && scale != NULL) {
			if (scale -> inactive) {scale = scale -> next; continue;}
			int scale_y = (rule -> stator ? rule -> y : 0) + scale -> y;
			wxFont f = dc . GetFont ();
			f . SetPointSize (scale -> height / 2);
			dc . SetFont (f);
			double value = scale -> getValue (cursor_location - rule -> slide / (double) scale_length);
			if ((draw_digital_readouts_on_stator_left && rule -> stator) || (draw_digital_readouts_on_slide_left && ! rule -> stator))
				draw_readout (dc, value, x + 12 + (int) rule -> slide, scale_y, scale -> reversed ? & scale -> red_marking_colour : & scale -> marking_colour);
			if ((draw_digital_readouts_on_stator_right && rule -> stator) || (draw_digital_readouts_on_slide_right && ! rule -> stator))
				draw_readout (dc, value, x - 100 + (int) rule -> slide + scale_length * (1.0 + 2.0 * marginal_factor), scale_y, scale -> reversed ? & scale -> red_marking_colour : & scale -> marking_colour);
			if (draw_digital_readouts_on_main_hairline) {
				draw_readout (dc, value, x + 4 + (int) ((cursor_location + marginal_factor) * (double) scale_length), scale_y, & hairline_colour);
			}
			if (draw_digital_readouts_on_multi_hairlines) {
				double shift = cursor_location - rule -> slide / (double) scale_length;
				s_hairline . draw_readout (dc, scale_y, scale -> getValue (shift + s_hairline . location), & multi_hairlines_colour, & rule_colour);
				if (display_metric_hp) {
					metric_hp_hairline . draw_readout (dc, scale_y, scale -> getValue (shift + metric_hp_hairline . location), & multi_hairlines_colour, & rule_colour);
					metric_kw_hairline . draw_readout (dc, scale_y, scale -> getValue (shift + metric_kw_hairline . location), & multi_hairlines_colour, & rule_colour);
				}
				if (display_mechanical_hp) {
					mechanical_hp_hairline . draw_readout (dc, scale_y, scale -> getValue (shift + mechanical_hp_hairline . location), & multi_hairlines_colour, & rule_colour);
					mechanical_kw_hairline . draw_readout (dc, scale_y, scale -> getValue (shift + mechanical_kw_hairline . location), & multi_hairlines_colour, & rule_colour);
				}
				d_hairline . draw_readout (dc, scale_y, scale -> getValue (shift + d_hairline . location), & multi_hairlines_colour, & rule_colour);
				hairline_360 . draw_readout (dc, scale_y, scale -> getValue (shift + hairline_360 . location), & multi_hairlines_colour, & rule_colour);
				hairline_36010 . draw_readout (dc, scale_y, scale -> getValue (shift + hairline_36010 . location), & multi_hairlines_colour, & rule_colour);
				hairline_360st . draw_readout (dc, scale_y, scale -> getValue (shift + hairline_360st . location), & multi_hairlines_colour, & rule_colour);
				for (int ind = 0; ind < number_of_extra_hairlines; ind++) extra_hairlines [ind] -> draw_readout (dc, scale_y, scale -> getValue (shift + extra_hairlines [ind] -> location), & multi_hairlines_colour, & rule_colour);
			}
			scale = scale -> next;
		}
		rule = rule -> next;
	}
}