navit-project.org

forum for navit navigation tool
It is currently 28 Nov 2021, 23:06
View unanswered posts | View active topics


All times are UTC


Forum rules


Feel free to ask anything here related to the development process - coding, creating new features, fixing bugs and custom changes of Navit.

Note: For reporting bugs, use the bug tracker.



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: draw circle on the map when no nmea data source
PostPosted: 17 Apr 2021, 08:16 
Offline

Joined: 17 Apr 2021, 07:40
Posts: 1
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);

}


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Silver Orange 2.0.6 for IPB Designed by Skins and Hosting
Converted for phpBB3, based on Royal Blue template by BigB © 2007 2008 AEON KINGS