navit-project.org http://forum/ |
|
draw circle on the map when no nmea data source http://forum/viewtopic.php?f=14&t=780 |
Page 1 of 1 |
Author: | saritz [ 17 Apr 2021, 08:16 ] |
Post subject: | draw circle on the map when no nmea data source |
Hi, I'm trying to draw circles on the map when there is no nmea data (using file as a source of vehicle). I succeeded to draw the vehicle position by calling "navit_vehicle_draw(this_, nv, NULL);" at "navit.c::navit_vehicle_update_position()" but I would like to draw additional points. It seems that I miss a certain initialization that does not occur on offline mode (when there is no nmea data). What am I missing? Bellow is more details of the code I added. Can you please help. Thanks, Sarit. Code: navit.c::navit_vehicle_update_position(struct navit *this_, struct navit_vehicle *nv).... transform(this_->trans_cursor, pro, &(this_->draw_route_circles.p1)/*p1_coord*/, &p_1, 1, 0, 0, NULL); transform(this_->trans_cursor, pro, &(this_->draw_route_circles.pi)/*pi_coord*/, &p_i, 1, 0, 0, NULL); transform(this_->trans_cursor, pro, &(this_->draw_route_circles.pi1)/*pi1_coord*/, &p_i1, 1, 0, 0, NULL); dbg(lvl_error, "p_1(%d, %d), p_i(%d, %d), p_i1(%d, %d)", p_1.x, p_1.y, p_i.x, p_i.y, p_i1.x, p_i1.y); //graphics_draw_mode(this_->gra, draw_mode_begin); graphics_draw_circle(this_->gra, this_->draw_route_circles.osd_color_pink, &p_1, this_->draw_route_circles.width); graphics_draw_circle(this_->gra, this_->draw_route_circles.osd_color_red, &p_i, this_->draw_route_circles.width); graphics_draw_circle(this_->gra, this_->draw_route_circles.osd_color_blue, &p_i1, this_->draw_route_circles.width); graphics_draw_mode(this_->gra, draw_mode_end);[/code] Added to struct navit: Code: struct circle_draw draw_route_circles; Code: struct circle_draw {
struct color red_color; //= {0xffff,0,0,0xffff}; struct color blue_color;// = {0,0,0xffff,0xffff}; struct color pink_color; int width;// =10; struct graphics_gc *osd_color_red;// = NULL; struct graphics_gc *osd_color_blue;//= NULL; struct graphics_gc *osd_color_pink;//= NULL; struct coord_geo p1_geo;//pink struct coord_geo pi_geo;//red struct coord_geo pi1_geo;//blue struct coord p1;//pink struct coord pi;//red struct coord pi1;//blue }; void initCirclePoints(struct navit * this_) //called during navit_init { this_->draw_route_circles.red_color.r = 0xffff; this_->draw_route_circles.red_color.g = 0; this_->draw_route_circles.red_color.b = 0; this_->draw_route_circles.red_color.a = 0xffff; //this_->draw_route_circles.blue_color = {0,0,0xffff,0xffff}; this_->draw_route_circles.blue_color.r = 0; this_->draw_route_circles.blue_color.g = 0; this_->draw_route_circles.blue_color.b = 0xffff; this_->draw_route_circles.blue_color.a = 0xffff; this_->draw_route_circles.pink_color.r = 0x00fc; this_->draw_route_circles.pink_color.g = 0x0003; this_->draw_route_circles.pink_color.b = 0x00c2; this_->draw_route_circles.pink_color.a = 0xffff; this_->draw_route_circles.width =10; this_->draw_route_circles.osd_color_red =graphics_gc_new(this_->gra); graphics_gc_set_foreground(this_->draw_route_circles.osd_color_red, &this_->draw_route_circles.red_color); graphics_gc_set_linewidth(this_->draw_route_circles.osd_color_red, this_->draw_route_circles.width); //struct graphics_gc *circle_draw.osd_color2; this_->draw_route_circles.osd_color_blue = graphics_gc_new(this_->gra); graphics_gc_set_foreground(this_->draw_route_circles.osd_color_blue, &this_->draw_route_circles.blue_color); graphics_gc_set_linewidth(this_->draw_route_circles.osd_color_blue, this_->draw_route_circles.width); this_->draw_route_circles.osd_color_pink = graphics_gc_new(this_->gra); graphics_gc_set_foreground(this_->draw_route_circles.osd_color_pink, &this_->draw_route_circles.pink_color); graphics_gc_set_linewidth(this_->draw_route_circles.osd_color_pink, this_->draw_route_circles.width); } void destroyCirclePoints(struct navit * this_)//called on navit_detroy { graphics_gc_destroy(this_->draw_route_circles.osd_color_red); graphics_gc_destroy(this_->draw_route_circles.osd_color_blue); graphics_gc_destroy(this_->draw_route_circles.osd_color_pink); } |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |