… | |
… | |
47 | |
47 | |
48 | #include <stdlib.h> |
48 | #include <stdlib.h> |
49 | #include <glib.h> |
49 | #include <glib.h> |
50 | #include <stdio.h> |
50 | #include <stdio.h> |
51 | #include <math.h> |
51 | #include <math.h> |
|
|
52 | #include <zlib.h> |
52 | #include "config.h" |
53 | #include "config.h" |
53 | #include "debug.h" |
54 | #include "debug.h" |
54 | #include "string.h" |
55 | #include "string.h" |
55 | #include "draw_info.h" |
56 | #include "draw_info.h" |
56 | #include "point.h" |
57 | #include "point.h" |
… | |
… | |
231 | }; |
232 | }; |
232 | |
233 | |
233 | static void draw_circle(struct point *pnt, int diameter, int scale, int start, int len, struct point *res, int *pos, int dir); |
234 | static void draw_circle(struct point *pnt, int diameter, int scale, int start, int len, struct point *res, int *pos, int dir); |
234 | static void graphics_process_selection(struct graphics *gra, struct displaylist *dl); |
235 | static void graphics_process_selection(struct graphics *gra, struct displaylist *dl); |
235 | static void graphics_gc_init(struct graphics *this_); |
236 | static void graphics_gc_init(struct graphics *this_); |
|
|
237 | static void graphics_draw_polygon_clipped(struct graphics *gra, struct graphics_gc *gc, struct point *pin, int count_in); |
|
|
238 | |
|
|
239 | |
|
|
240 | // ------------- TILES ------------- |
|
|
241 | // ------------- TILES ------------- |
|
|
242 | // ------------- TILES ------------- |
|
|
243 | #include "mvt_tiles.h"; |
|
|
244 | // ------------- TILES ------------- |
|
|
245 | // ------------- TILES ------------- |
|
|
246 | // ------------- TILES ------------- |
|
|
247 | |
|
|
248 | |
236 | |
249 | |
237 | static void clear_hash(struct displaylist *dl) |
250 | static void clear_hash(struct displaylist *dl) |
238 | { |
251 | { |
239 | int i; |
252 | int i; |
240 | for (i = 0; i < HASH_SIZE_GRAPHICS_; i++) |
253 | for (i = 0; i < HASH_SIZE_GRAPHICS_; i++) |
… | |
… | |
4054 | #endif |
4067 | #endif |
4055 | |
4068 | |
4056 | // reset value; --> not sure here, maybe it should NOT be reset here!!!??? |
4069 | // reset value; --> not sure here, maybe it should NOT be reset here!!!??? |
4057 | // cancel_drawing_global = 0; |
4070 | // cancel_drawing_global = 0; |
4058 | |
4071 | |
|
|
4072 | |
|
|
4073 | |
|
|
4074 | |
|
|
4075 | |
|
|
4076 | |
|
|
4077 | |
|
|
4078 | // stop drawing is requested |
|
|
4079 | if (cancel_drawing_global != 1) |
|
|
4080 | { |
|
|
4081 | |
|
|
4082 | if ((display_list->order >= ORDER_USE_PRERENDERED_MAP) || (global_show_maps_debug_view)) // ==5 , (4,3,2,1,0)--> no vector map |
|
|
4083 | { |
|
|
4084 | // MAPNIK -- MVT -- |
|
|
4085 | // MAPNIK -- MVT -- |
|
|
4086 | // MAPNIK -- MVT -- |
|
|
4087 | int screen_width, screen_height; |
|
|
4088 | struct coord c_screen; |
|
|
4089 | struct point p_screen; |
|
|
4090 | struct coord_geo g_screen_lt; |
|
|
4091 | struct coord_geo g_screen_rt; |
|
|
4092 | struct coord_geo g_screen_rb; |
|
|
4093 | |
|
|
4094 | transform_get_size(global_navit->trans, &screen_width, &screen_height); |
|
|
4095 | // dbg(0, "transform_get_size:w=%d h=%d\n", screen_width, screen_height); |
|
|
4096 | // dbg(0, "navit_maps_dir=%s\n", navit_maps_dir); |
|
|
4097 | |
|
|
4098 | p_screen.x = 0; |
|
|
4099 | p_screen.y = 0; |
|
|
4100 | transform_reverse(global_navit->trans, &p_screen, &c_screen); |
|
|
4101 | transform_to_geo(projection_mg, &c_screen, &g_screen_lt); |
|
|
4102 | |
|
|
4103 | p_screen.x = screen_width; |
|
|
4104 | p_screen.y = 0; |
|
|
4105 | transform_reverse(global_navit->trans, &p_screen, &c_screen); |
|
|
4106 | transform_to_geo(projection_mg, &c_screen, &g_screen_rt); |
|
|
4107 | |
|
|
4108 | p_screen.x = screen_width; |
|
|
4109 | p_screen.y = screen_height; |
|
|
4110 | transform_reverse(global_navit->trans, &p_screen, &c_screen); |
|
|
4111 | transform_to_geo(projection_mg, &c_screen, &g_screen_rb); |
|
|
4112 | |
|
|
4113 | // dbg(0, "bbox=%f %f %f %f %f %f\n", g_screen_lt.lat, g_screen_lt.lng, g_screen_rt.lat, g_screen_rt.lng, g_screen_rb.lat, g_screen_rb.lng); |
|
|
4114 | |
|
|
4115 | |
|
|
4116 | if ((display_list->order > 5) || (global_show_maps_debug_view)) |
|
|
4117 | { |
|
|
4118 | loop_mapnik_tiles(g_screen_lt.lat, g_screen_lt.lng, g_screen_rt.lat, g_screen_rt.lng, g_screen_rb.lat, g_screen_rb.lng, 12, navit_maps_dir, display_list); |
|
|
4119 | } |
|
|
4120 | /* |
|
|
4121 | else if (display_list->order > 4) |
|
|
4122 | { |
|
|
4123 | loop_mapnik_tiles(g_screen_lt.lat, g_screen_lt.lng, g_screen_rt.lat, g_screen_rt.lng, g_screen_rb.lat, g_screen_rb.lng, 6, navit_maps_dir, display_list); |
|
|
4124 | } |
|
|
4125 | else |
|
|
4126 | { |
|
|
4127 | loop_mapnik_tiles(g_screen_lt.lat, g_screen_lt.lng, g_screen_rt.lat, g_screen_rt.lng, g_screen_rb.lat, g_screen_rb.lng, 2, navit_maps_dir, display_list); |
|
|
4128 | } |
|
|
4129 | */ |
|
|
4130 | // MAPNIK -- MVT -- |
|
|
4131 | // MAPNIK -- MVT -- |
|
|
4132 | // MAPNIK -- MVT -- |
|
|
4133 | } |
|
|
4134 | } |
|
|
4135 | |
|
|
4136 | |
|
|
4137 | |
|
|
4138 | |
|
|
4139 | |
|
|
4140 | |
4059 | lays = l->layers; |
4141 | lays = l->layers; |
4060 | while (lays) |
4142 | while (lays) |
4061 | { |
4143 | { |
4062 | // stop drawing is requested |
4144 | // stop drawing is requested |
4063 | if (cancel_drawing_global == 1) |
4145 | if (cancel_drawing_global == 1) |
… | |
… | |
4066 | } |
4148 | } |
4067 | |
4149 | |
4068 | lay = lays->data; |
4150 | lay = lays->data; |
4069 | if (lay->active) |
4151 | if (lay->active) |
4070 | { |
4152 | { |
|
|
4153 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4154 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4155 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4156 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4157 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4158 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4159 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4160 | //ZZZZZZZZZZZZZZZZZZZZZ// |
4071 | xdisplay_draw_layer(display_list, gra, lay, order); |
4161 | xdisplay_draw_layer(display_list, gra, lay, order); |
|
|
4162 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4163 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4164 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4165 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4166 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4167 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4168 | //ZZZZZZZZZZZZZZZZZZZZZ// |
|
|
4169 | //ZZZZZZZZZZZZZZZZZZZZZ// |
4072 | } |
4170 | } |
4073 | lays = g_list_next(lays); |
4171 | lays = g_list_next(lays); |
4074 | } |
4172 | } |
|
|
4173 | |
|
|
4174 | |
4075 | |
4175 | |
4076 | // reset value; |
4176 | // reset value; |
4077 | // cancel_drawing_global = 0; |
4177 | // cancel_drawing_global = 0; |
4078 | |
4178 | |
4079 | // dummy "start" signal ------------------------------------------ |
4179 | // dummy "start" signal ------------------------------------------ |
… | |
… | |
4320 | { |
4420 | { |
4321 | // on high detail -> dont draw bordermap anymore. it sometimes causes heavy slowdowns!! |
4421 | // on high detail -> dont draw bordermap anymore. it sometimes causes heavy slowdowns!! |
4322 | mapset_need_draw = 0; |
4422 | mapset_need_draw = 0; |
4323 | } |
4423 | } |
4324 | } |
4424 | } |
|
|
4425 | |
|
|
4426 | /* |
4325 | else if (strncmp("_ms_sdcard_map:/sdcard/zanavi/maps/coastline.bin", map_name_attr.u.str, 48) == 0) |
4427 | else if (strncmp("_ms_sdcard_map:/sdcard/zanavi/maps/coastline.bin", map_name_attr.u.str, 48) == 0) |
4326 | { |
4428 | { |
4327 | if (draw_tile_map == 1) |
4429 | if (draw_tile_map == 1) |
4328 | { |
4430 | { |
4329 | // if its the countryborder map |
4431 | // if its the countryborder map |
4330 | mapset_need_draw = 0; |
4432 | mapset_need_draw = 0; |
4331 | } |
4433 | } |
4332 | } |
4434 | } |
|
|
4435 | */ |
|
|
4436 | |
|
|
4437 | |
4333 | #if 0 |
4438 | #if 0 |
4334 | else if (strncmp("_ms_sdcard_map:-special-:worldmap6.txt", map_name_attr.u.str, 38) == 0) |
4439 | else if (strncmp("_ms_sdcard_map:-special-:worldmap6.txt", map_name_attr.u.str, 38) == 0) |
4335 | { |
4440 | { |
4336 | // if its a worldmapX.txt |
4441 | // if its a worldmapX.txt |
4337 | if (draw_vector_map == 1) |
4442 | if (draw_vector_map == 1) |