You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
(59) |
Sep
(43) |
Oct
(95) |
Nov
(135) |
Dec
(108) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(229) |
Feb
(141) |
Mar
(59) |
Apr
(70) |
May
(64) |
Jun
(87) |
Jul
(57) |
Aug
(108) |
Sep
(74) |
Oct
(203) |
Nov
(141) |
Dec
(108) |
2009 |
Jan
(114) |
Feb
(91) |
Mar
(101) |
Apr
(69) |
May
(54) |
Jun
(82) |
Jul
(49) |
Aug
(109) |
Sep
(81) |
Oct
(93) |
Nov
(100) |
Dec
(79) |
2010 |
Jan
(46) |
Feb
(36) |
Mar
(135) |
Apr
(103) |
May
(116) |
Jun
(130) |
Jul
(52) |
Aug
(31) |
Sep
(46) |
Oct
(48) |
Nov
(98) |
Dec
(110) |
2011 |
Jan
(234) |
Feb
(184) |
Mar
(150) |
Apr
(43) |
May
(53) |
Jun
(52) |
Jul
(112) |
Aug
(72) |
Sep
(79) |
Oct
(23) |
Nov
(6) |
Dec
(30) |
2012 |
Jan
(39) |
Feb
(37) |
Mar
(49) |
Apr
(60) |
May
(63) |
Jun
(38) |
Jul
(33) |
Aug
(24) |
Sep
(20) |
Oct
(14) |
Nov
(23) |
Dec
(50) |
2013 |
Jan
(30) |
Feb
(32) |
Mar
(27) |
Apr
(41) |
May
(59) |
Jun
(21) |
Jul
(10) |
Aug
(73) |
Sep
(23) |
Oct
(60) |
Nov
(14) |
Dec
(15) |
2014 |
Jan
(4) |
Feb
(8) |
Mar
(11) |
Apr
(6) |
May
(27) |
Jun
(4) |
Jul
(29) |
Aug
(62) |
Sep
(11) |
Oct
(17) |
Nov
(58) |
Dec
(9) |
2015 |
Jan
(23) |
Feb
(3) |
Mar
(26) |
Apr
(47) |
May
(8) |
Jun
(28) |
Jul
(10) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Alexander A. <za...@us...> - 2007-11-23 13:03:07
|
Update of /cvsroot/navit/navit/src/data/mg In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14513/data/mg Modified Files: poly.c Log Message: 0x16 is a building Index: poly.c =================================================================== RCS file: /cvsroot/navit/navit/src/data/mg/poly.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** poly.c 23 Nov 2007 12:30:40 -0000 1.7 --- poly.c 23 Nov 2007 13:03:10 -0000 1.8 *************** *** 129,133 **** break; case 0x16: ! item->type=type_place_poly; break; case 0x17: --- 129,133 ---- break; case 0x16: ! item->type=type_building_poly; break; case 0x17: |
From: Alexander A. <za...@us...> - 2007-11-23 12:51:53
|
Update of /cvsroot/navit/navit/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv562 Modified Files: item_def.h Log Message: Define some m&g polygons Index: item_def.h =================================================================== RCS file: /cvsroot/navit/navit/src/item_def.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** item_def.h 13 Nov 2007 20:39:57 -0000 1.11 --- item_def.h 23 Nov 2007 12:30:39 -0000 1.12 *************** *** 266,267 **** --- 266,268 ---- ITEM(building_poly) ITEM(place_poly) + ITEM(station_poly) |
From: Alexander A. <za...@us...> - 2007-11-23 12:51:32
|
Update of /cvsroot/navit/navit/src/data/mg In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv562/data/mg Modified Files: poly.c Log Message: Define some m&g polygons Index: poly.c =================================================================== RCS file: /cvsroot/navit/navit/src/data/mg/poly.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** poly.c 28 Aug 2007 20:09:29 -0000 1.6 --- poly.c 23 Nov 2007 12:30:40 -0000 1.7 *************** *** 128,131 **** --- 128,140 ---- item->type=type_cemetery_poly; break; + case 0x16: + item->type=type_place_poly; + break; + case 0x17: + item->type=type_museum_poly; + break; + case 0x19: + item->type=type_place_poly; + break; case 0x1b: item->type=type_commercial_center; *************** *** 134,137 **** --- 143,150 ---- item->type=type_industry_poly; break; + case 0x23: + /* FIXME: what is this ?*/ + item->type=type_place_poly; + break; case 0x24: item->type=type_parking_lot_poly; *************** *** 140,143 **** --- 153,159 ---- item->type=type_airport_poly; break; + case 0x29: + item->type=type_station_poly; + break; case 0x2d: item->type=type_hospital_poly; *************** *** 149,152 **** --- 165,171 ---- item->type=type_university; break; + case 0x30: + item->type=type_university; + break; case 0x32: item->type=type_park_poly; *************** *** 173,176 **** --- 192,199 ---- item->type=type_water_line; break; + case 0xc3: + /* FIXME: what is this ?*/ + item->type=type_border_state; + break; case 0xc6: item->type=type_border_country; |
From: Alexander A. <za...@us...> - 2007-11-23 10:43:19
|
Update of /cvsroot/navit/navit/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15262 Modified Files: transform.c route.c Log Message: Avoid division for scale==1, check for failed allocations in route code Index: route.c =================================================================== RCS file: /cvsroot/navit/navit/src/route.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** route.c 22 Nov 2007 19:37:26 -0000 1.24 --- route.c 23 Nov 2007 10:43:14 -0000 1.25 *************** *** 154,157 **** --- 154,161 ---- { struct route *this=g_new0(struct route, 1); + if (!this) { + printf("%s:Out of memory\n", __FUNCTION__); + return NULL; + } this->ms=ms; return this; *************** *** 245,248 **** --- 249,256 ---- c=tracking_get_pos(tracking); ret=g_new0(struct route_info, 1); + if (!ret) { + printf("%s:Out of memory\n", __FUNCTION__); + return; + } if (this->pos) route_info_free(this->pos); *************** *** 269,272 **** --- 277,284 ---- int dx,dy,sx=1,sy=1,d,m; struct map_selection *sel=g_new(struct map_selection, 1); + if (!sel) { + printf("%s:Out of memory\n", __FUNCTION__); + return sel; + } sel->order[layer_town]=0; sel->order[layer_poly]=0; *************** *** 378,381 **** --- 390,397 ---- printf("p (0x%x,0x%x)\n", f->x, f->y); p=g_new(struct route_graph_point,1); + if (!p) { + printf("%s:Out of memory\n", __FUNCTION__); + return p; + } p->hash_next=this->hash[hashval]; this->hash[hashval]=p; *************** *** 414,417 **** --- 430,437 ---- struct route_graph_segment *s; s = calloc(1, sizeof(*s)); + if (!s) { + printf("%s:Out of memory\n", __FUNCTION__); + return; + } s->start=start; s->start_next=start->start; *************** *** 473,476 **** --- 493,500 ---- ccnt = get_item_seg_coords(&rgs->item, ca, 2047, rgs); segment= calloc(1, sizeof(*segment) + sizeof(struct coord) * ccnt); + if (!segment) { + printf("%s:Out of memory\n", __FUNCTION__); + return; + } memcpy(segment->c, ca, ccnt * sizeof(struct coord)); segment->ncoords = ccnt; *************** *** 501,505 **** ret=g_new(struct route_path_handle, 1); ! ret->s=this->path2->path; return ret; --- 525,532 ---- ret=g_new(struct route_path_handle, 1); ! if (!ret) { ! printf("%s:Out of memory\n", __FUNCTION__); ! return ret; ! } ret->s=this->path2->path; return ret; *************** *** 573,576 **** --- 600,607 ---- ret=g_new0(struct route_path_coord_handle, 1); + if (!ret) { + printf("%s:Out of memory\n", __FUNCTION__); + return ret; + } ret->route=this; ret->ri=route_info_open(route_get_pos(this), route_get_dst(this), 0); *************** *** 937,940 **** --- 968,975 ---- } ret=g_new0(struct route_path, 1); + if (!ret) { + printf("%s:Out of memory\n", __FUNCTION__); + return ret; + } ret->path_hash=item_hash_new(); dbg(1,"dir=%d\n", pos->dir); *************** *** 1007,1010 **** --- 1042,1049 ---- struct item *item; + if (!ret) { + printf("%s:Out of memory\n", __FUNCTION__); + return ret; + } sel=route_calc_selection(c1, c2); h=mapset_open(ms); *************** *** 1124,1127 **** --- 1163,1170 ---- } ret=g_new(struct route_info, 1); + if (!ret) { + printf("%s:Out of memory\n", __FUNCTION__); + return ret; + } ret->c=c; ret->lp=lp; *************** *** 1133,1138 **** } else street_data_free(sd); ! } else ! while (item_coord_get(item, &sc[0], 1)); } map_rect_destroy(mr); --- 1176,1180 ---- } else street_data_free(sd); ! } } map_rect_destroy(mr); *************** *** 1200,1206 **** { struct route_info_handle *ret=g_new0(struct route_info_handle, 1); - struct route_info *curr; dbg(2,"enter start=%p end=%p dir=%d\n", start, end, dir); ret->start=start; ret->end=end; --- 1242,1251 ---- { struct route_info_handle *ret=g_new0(struct route_info_handle, 1); struct route_info *curr; dbg(2,"enter start=%p end=%p dir=%d\n", start, end, dir); + if (!ret) { + printf("%s:Out of memory\n", __FUNCTION__); + return ret; + } ret->start=start; ret->end=end; Index: transform.c =================================================================== RCS file: /cvsroot/navit/navit/src/transform.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** transform.c 22 Nov 2007 19:37:27 -0000 1.10 --- transform.c 23 Nov 2007 10:43:14 -0000 1.11 *************** *** 171,180 **** yc=yc*16; #ifndef AVOID_FLOAT ! if (t->scale) { xc=xc/(double)(t->scale); yc=yc/(double)(t->scale); } #else ! if (t->scale) { xc=xc/t->scale; yc=yc/t->scale; --- 171,180 ---- yc=yc*16; #ifndef AVOID_FLOAT ! if (t->scale!=1) { xc=xc/(double)(t->scale); yc=yc/(double)(t->scale); } #else ! if (t->scale!=1) { xc=xc/t->scale; yc=yc/t->scale; |
From: Martin S. <mar...@us...> - 2007-11-23 09:04:21
|
Update of /cvsroot/navit/navit/src/maps In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv3704 Modified Files: Makefile.am Log Message: Fixed a bug in map processing Index: Makefile.am =================================================================== RCS file: /cvsroot/navit/navit/src/maps/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile.am 13 Nov 2007 20:40:18 -0000 1.3 --- Makefile.am 23 Nov 2007 09:04:23 -0000 1.4 *************** *** 14,18 **** $(SAMPLE_MAP).bin: $(SAMPLE_MAP).osm.bz2 $(top_builddir)/src/osm2navit echo "Converting osm sample map" ! bzcat $(SAMPLE_MAP).osm.bz2 | $(top_builddir)/src/osm2navit --attr-debug-level=5 >$(SAMPLE_MAP).bin.tmp mv $(SAMPLE_MAP).bin.tmp $(SAMPLE_MAP).bin --- 14,18 ---- $(SAMPLE_MAP).bin: $(SAMPLE_MAP).osm.bz2 $(top_builddir)/src/osm2navit echo "Converting osm sample map" ! bzcat $(SAMPLE_MAP).osm.bz2 | $(top_builddir)/src/osm2navit --attr-debug-level=5 $(SAMPLE_MAP).bin.tmp mv $(SAMPLE_MAP).bin.tmp $(SAMPLE_MAP).bin |
From: Martin S. <mar...@us...> - 2007-11-22 22:55:31
|
Update of /cvsroot/navit/navit/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26405 Modified Files: file.c file.h osm2navit.c Log Message: Made osm2navit work again, Bugfixes in the binfile driver Index: osm2navit.c =================================================================== RCS file: /cvsroot/navit/navit/src/osm2navit.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** osm2navit.c 20 Nov 2007 18:55:41 -0000 1.10 --- osm2navit.c 22 Nov 2007 22:55:30 -0000 1.11 *************** *** 1,2 **** --- 1,5 ---- + #define _FILE_OFFSET_BITS 64 + #define _LARGEFILE_SOURCE + #define _LARGEFILE64_SOURCE #include <glib.h> #include <malloc.h> *************** *** 14,23 **** #include "zipfile.h" [...1458 lines suppressed...] ! phase=4; ! fprintf(stderr,"PROGRESS: Phase 4: assembling map\n"); ! ways_split=fopen64("ways_split.tmp","r"); ! nodes=fopen64("nodes.tmp","r"); ! res=fopen64(result,"w+"); ! zipdir=fopen64("zipdir.tmp","w+"); ! phase4(ways_split,nodes,res,zipdir); ! fclose(zipdir); ! fclose(res); ! fclose(nodes); ! fclose(ways_split); ! if(!keep_tmpfiles) { ! remove("nodes.tmp"); ! remove("ways_split.tmp"); ! remove("tilesdir.tmp"); ! remove("zipdir.tmp"); ! } ! } return 0; } Index: file.c =================================================================== RCS file: /cvsroot/navit/navit/src/file.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** file.c 12 Nov 2007 19:25:28 -0000 1.7 --- file.c 22 Nov 2007 22:55:30 -0000 1.8 *************** *** 1,2 **** --- 1,5 ---- + #define _FILE_OFFSET_BITS 64 + #define _LARGEFILE_SOURCE + #define _LARGEFILE64_SOURCE #include <unistd.h> #include <string.h> *************** *** 20,24 **** if (! file) return file; ! file->fd=open(name, O_RDONLY); if (file->fd < 0) { g_free(file); --- 23,27 ---- if (! file) return file; ! file->fd=open(name, O_RDONLY|O_LARGEFILE); if (file->fd < 0) { g_free(file); Index: file.h =================================================================== RCS file: /cvsroot/navit/navit/src/file.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** file.h 12 Nov 2007 19:25:28 -0000 1.7 --- file.h 22 Nov 2007 22:55:30 -0000 1.8 *************** *** 7,11 **** unsigned char *begin; unsigned char *end; ! unsigned long size; char *name; int fd; --- 7,11 ---- unsigned char *begin; unsigned char *end; ! long long size; char *name; int fd; |
From: Martin S. <mar...@us...> - 2007-11-22 22:55:31
|
Update of /cvsroot/navit/navit/src/data/binfile In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26405/data/binfile Modified Files: binfile.c Log Message: Made osm2navit work again, Bugfixes in the binfile driver Index: binfile.c =================================================================== RCS file: /cvsroot/navit/navit/src/data/binfile/binfile.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** binfile.c 21 Nov 2007 20:17:28 -0000 1.7 --- binfile.c 22 Nov 2007 22:55:30 -0000 1.8 *************** *** 37,40 **** --- 37,41 ---- int cde_size; struct zip_eoc *eoc; + int zip_members; }; *************** *** 135,138 **** --- 136,140 ---- push_tile(struct map_rect_priv *mr, struct tile *t) { + g_assert(mr->tile_depth < 8); mr->t=&mr->tiles[mr->tile_depth++]; *(mr->t)=*t; *************** *** 196,202 **** mr->item.id_hi=0; mr->item.id_lo=0; ! dbg(1,"eoc->zipecenn=%d\n", map->eoc->zipecenn); if (map->eoc) ! push_zipfile_tile(mr, map->eoc->zipecenn-1); else { unsigned char *d=file_data_read(map->fi, 0, map->fi->size); --- 198,204 ---- mr->item.id_hi=0; mr->item.id_lo=0; ! dbg(1,"zip_members=%d\n", map->zip_members); if (map->eoc) ! push_zipfile_tile(mr, map->zip_members-1); else { unsigned char *d=file_data_read(map->fi, 0, map->fi->size); *************** *** 279,283 **** continue; } ! dbg(1,"0x%x\n", t->pos_attr[5]); push_zipfile_tile(mr, t->pos_attr[5]); continue; --- 281,285 ---- continue; } ! dbg(1,"pushing zipfile %d from %d\n", t->pos_attr[5], t->zipfile_num); push_zipfile_tile(mr, t->pos_attr[5]); continue; *************** *** 318,321 **** --- 320,324 ---- struct attr *data=attr_search(attrs, NULL, attr_data); struct file_wordexp *wexp; + struct zip_cd *first_cd; char **wexp_data; int *magic,cde_index_size; *************** *** 343,354 **** cde_index_size=sizeof(struct zip_cd)+sizeof("index")-1; m->eoc=(struct zip_eoc *)file_data_read(m->fi,m->fi->size-sizeof(struct zip_eoc), sizeof(struct zip_eoc)); m->index_cd=(struct zip_cd *)file_data_read(m->fi,m->fi->size-sizeof(struct zip_eoc)-cde_index_size, cde_index_size); ! printf("length %d\n", m->eoc->zipecsz); ! printf("entries %d\n", m->eoc->zipecenn); ! m->cde_size=(m->eoc->zipecsz-cde_index_size)/(m->eoc->zipecenn-1); printf("cde_size %d\n", m->cde_size); ! printf("length %d\n",m->cde_size*(m->eoc->zipecenn-1)+cde_index_size); printf("0x%x\n", m->eoc->zipesig); printf("0x%x\n", m->index_cd->zipcensig); } else file_mmap(m->fi); --- 346,359 ---- cde_index_size=sizeof(struct zip_cd)+sizeof("index")-1; m->eoc=(struct zip_eoc *)file_data_read(m->fi,m->fi->size-sizeof(struct zip_eoc), sizeof(struct zip_eoc)); + printf("magic 0x%x\n", m->eoc->zipesig); m->index_cd=(struct zip_cd *)file_data_read(m->fi,m->fi->size-sizeof(struct zip_eoc)-cde_index_size, cde_index_size); ! first_cd=(struct zip_cd *)file_data_read(m->fi,m->eoc->zipeofst, sizeof(struct zip_cd)); ! m->cde_size=sizeof(struct zip_cd)+first_cd->zipcfnl; ! m->zip_members=(m->eoc->zipecsz-cde_index_size)/m->cde_size+1; printf("cde_size %d\n", m->cde_size); ! printf("members %d\n",m->zip_members); printf("0x%x\n", m->eoc->zipesig); printf("0x%x\n", m->index_cd->zipcensig); + file_data_free(m->fi, (unsigned char *)first_cd); } else file_mmap(m->fi); |
From: Alexander A. <za...@us...> - 2007-11-22 19:37:31
|
Update of /cvsroot/navit/navit/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21492 Modified Files: graphics.c map.c map.h route.c route.h transform.c transform.h Log Message: Route code emulates a map driver to draw the route path, coordinates are cached in the route_path_segment. This will also allow to easy debuging of routing code. Fix route clear to avoid double free. Route supports roads with segments contained in one item. Route supports the map projections. Implement transform_array - saves function calls and fpu start/stop Get all coordinates with one call for polygons and lines, so item_get_coord with more than one coordinate is now used. Reorder do_draw_map, separated from do_draw, so it checks if the item is contained in the selection before transforming coordinates. Tune a bit calculation of route_point's hash value. Index: transform.h =================================================================== RCS file: /cvsroot/navit/navit/src/transform.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** transform.h 19 Nov 2007 19:58:18 -0000 1.7 --- transform.h 22 Nov 2007 19:37:27 -0000 1.8 *************** *** 17,20 **** --- 17,21 ---- void transform_from_geo(enum projection pro, struct coord_geo *g, struct coord *c); int transform(struct transformation *t, enum projection pro, struct coord *c, struct point *p); + int transform_array(struct transformation *t, enum projection pro, struct coord *c, struct point *p, int count, int uniq); void transform_reverse(struct transformation *t, struct point *p, struct coord *c); enum projection transform_get_projection(struct transformation *this_); Index: route.h =================================================================== RCS file: /cvsroot/navit/navit/src/route.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** route.h 20 Nov 2007 18:55:41 -0000 1.12 --- route.h 22 Nov 2007 19:37:27 -0000 1.13 *************** *** 73,76 **** --- 73,77 ---- void route_info_close(struct route_info_handle *h); void route_draw(struct route *this, struct transformation *t, struct displaylist *dsp); + struct map *route_get_map(struct route *route); /* end of prototypes */ Index: route.c =================================================================== RCS file: /cvsroot/navit/navit/src/route.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** route.c 20 Nov 2007 20:01:50 -0000 1.23 --- route.c 22 Nov 2007 19:37:26 -0000 1.24 *************** *** 1,3 **** --- 1,4 ---- #include <stdio.h> + #include <stdlib.h> #include <string.h> #if 0 *************** *** 44,48 **** int debug_route=0; - struct route_graph_point { struct route_graph_point *next; --- 45,48 ---- *************** *** 51,60 **** struct route_graph_segment *end; struct route_graph_segment *seg; ! struct fibheap_el *el; int value; struct coord c; }; - struct route_graph_segment { struct route_graph_segment *next; --- 51,59 ---- struct route_graph_segment *end; struct route_graph_segment *seg; ! struct fibheap_el *el; int value; struct coord c; }; struct route_graph_segment { struct route_graph_segment *next; *************** *** 66,77 **** int flags; int len; }; struct route_path_segment { struct item item; int time; int length; ! struct coord c[2]; ! struct route_path_segment *next; }; --- 65,78 ---- int flags; int len; + int offset; }; struct route_path_segment { + struct route_path_segment *next; struct item item; int time; int length; ! unsigned ncoords; ! struct coord c[0]; }; *************** *** 90,100 **** struct route_path_segment *path; struct route_path_segment *path_last; struct item_hash *path_hash; }; - struct route { int version; struct mapset *ms; struct route_info *pos; struct route_info *dst; --- 91,102 ---- struct route_path_segment *path; struct route_path_segment *path_last; + /* XXX: path_hash is not necessery now */ struct item_hash *path_hash; }; struct route { int version; struct mapset *ms; + struct map route_map; struct route_info *pos; struct route_info *dst; *************** *** 112,115 **** --- 114,119 ---- }; + #define HASHCOORD(c) ((((c)->x +(c)->y) * 2654435761UL) & (HASH_SIZE-1)) + static struct route_info * route_find_nearest_street(struct mapset *ms, struct pcoord *c); static struct route_graph_point *route_graph_get_point(struct route_graph *this, struct coord *c); *************** *** 120,123 **** --- 124,134 ---- static void route_path_update(struct route *this); + static enum projection route_projection(struct route *route) + { + struct street_data *street; + street = route->pos ? route->pos->street : route->dst->street; + return map_projection(street->item.map); + } + static void route_path_destroy(struct route_path *this) *************** *** 130,137 **** this->path_hash=NULL; } ! c=this->path; while (c) { n=c->next; ! g_free(c); c=n; } --- 141,148 ---- this->path_hash=NULL; } ! c=this->path; while (c) { n=c->next; ! free(c); c=n; } *************** *** 191,197 **** route_contains(struct route *this, struct item *item) { ! if (! this->path2 || !this->path2->path_hash || !item_hash_lookup(this->path2->path_hash, item)) return 0; ! return 1; } --- 202,208 ---- route_contains(struct route *this, struct item *item) { ! if (! this->path2 || !this->path2->path_hash) return 0; ! return (int)item_hash_lookup(this->path2->path_hash, item); } *************** *** 200,203 **** --- 211,215 ---- { route_path_destroy(this->path2); + this->path2 = NULL; if (! this->pos || ! this->dst) return; *************** *** 249,253 **** } ! /* This is unused - check and remove from graphics.c too */ struct map_selection *route_selection; --- 261,265 ---- } ! /* Used for debuging of route_rect, what routing sees */ struct map_selection *route_selection; *************** *** 343,347 **** { struct route_graph_point *p=this->route_points; ! int hashval=(c->x + c->y) & (HASH_SIZE-1); p=this->hash[hashval]; while (p) { --- 355,359 ---- { struct route_graph_point *p=this->route_points; ! int hashval=HASHCOORD(c); p=this->hash[hashval]; while (p) { *************** *** 362,366 **** p=route_graph_get_point(this,f); if (!p) { ! hashval=(f->x + f->y) & (HASH_SIZE-1); if (debug_route) printf("p (0x%x,0x%x)\n", f->x, f->y); --- 374,378 ---- p=route_graph_get_point(this,f); if (!p) { ! hashval=HASHCOORD(f); if (debug_route) printf("p (0x%x,0x%x)\n", f->x, f->y); *************** *** 396,403 **** static void ! route_graph_add_segment(struct route_graph *this, struct route_graph_point *start, struct route_graph_point *end, int len, struct item *item, int flags) { struct route_graph_segment *s; ! s=g_new0(struct route_graph_segment,1); s->start=start; s->start_next=start->start; --- 408,417 ---- static void ! route_graph_add_segment(struct route_graph *this, struct route_graph_point *start, ! struct route_graph_point *end, int len, struct item *item, ! int flags, int offset) { struct route_graph_segment *s; ! s = calloc(1, sizeof(*s)); s->start=start; s->start_next=start->start; *************** *** 410,435 **** s->item=*item; s->flags=flags; s->next=this->route_segments; this->route_segments=s; if (debug_route) printf("l (0x%x,0x%x)-(0x%x,0x%x)\n", start->c.x, start->c.y, end->c.x, end->c.y); ! } static void ! route_path_add_item(struct route_path *this, struct item *itm, struct coord *start, struct coord *end, int len, int time) { ! struct route_path_segment *segment=g_new0(struct route_path_segment,1); ! item_hash_insert(this->path_hash, itm, (void *)1); ! segment->item=*itm; ! segment->next=NULL; segment->length=len; segment->time=time; - if (start) - segment->c[0]=*start; - if (end) - segment->c[1]=*end; if (!this->path) ! this->path=segment; if (this->path_last) this->path_last->next=segment; --- 424,485 ---- s->item=*item; s->flags=flags; + s->offset = offset; s->next=this->route_segments; this->route_segments=s; if (debug_route) printf("l (0x%x,0x%x)-(0x%x,0x%x)\n", start->c.x, start->c.y, end->c.x, end->c.y); ! } ! ! static int get_item_seg_coords(struct item *i, struct coord *c, int max, ! struct route_graph_segment *rgs) ! { ! struct map_rect *mr; ! struct item *item; ! int rc = 0, fs = 0, p = 0; ! struct coord c1; ! mr=map_rect_new(i->map, NULL); ! if (!mr) ! return 0; ! item = map_rect_get_item_byid(mr, i->id_hi, i->id_lo); ! if (item) { ! do { ! rc = item_coord_get(item, &c1, 1); ! if (rc) { ! if (!fs) { ! if (c1.x == rgs->start->c.x && ! c1.y == rgs->start->c.y) ! fs = 1; ! } ! if (fs) { ! c[p++] = c1; ! if (c1.x == rgs->end->c.x && ! c1.y == rgs->end->c.y) ! break; ! } ! } ! } while (rc); ! } ! map_rect_destroy(mr); ! return p; } static void ! route_path_add_item(struct route_path *this, struct route_graph_segment *rgs, int len, int time, int offset) { ! struct route_path_segment *segment; ! int ccnt = 0; ! struct coord ca[2048]; ! ! ccnt = get_item_seg_coords(&rgs->item, ca, 2047, rgs); ! segment= calloc(1, sizeof(*segment) + sizeof(struct coord) * ccnt); ! memcpy(segment->c, ca, ccnt * sizeof(struct coord)); ! segment->ncoords = ccnt; ! item_hash_insert(this->path_hash, &rgs->item, (void *)offset); ! segment->item=rgs->item; ! segment->next=NULL; segment->length=len; segment->time=time; if (!this->path) ! this->path=segment; if (this->path_last) this->path_last->next=segment; *************** *** 452,456 **** ret=g_new(struct route_path_handle, 1); ! ret->s=this->path2->path; return ret; } --- 502,506 ---- ret=g_new(struct route_path_handle, 1); ! ret->s=this->path2->path; return ret; } *************** *** 476,480 **** route_path_segment_get_end(struct route_path_segment *s) { ! return &s->c[1]; } --- 526,530 ---- route_path_segment_get_end(struct route_path_segment *s) { ! return &s->c[s->ncoords-1]; } *************** *** 613,617 **** while (curr) { next=curr->next; ! g_free(curr); curr=next; } --- 663,667 ---- while (curr) { next=curr->next; ! free(curr); curr=next; } *************** *** 666,669 **** --- 716,720 ---- int flags = 0; int segmented = 0; + int offset = 1; if (item_coord_get(item, &l, 1)) { *************** *** 681,685 **** e_pnt=route_graph_add_point(this,&l); g_assert(len >= 0); ! route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags); } else { int isseg,rc; --- 732,736 ---- e_pnt=route_graph_add_point(this,&l); g_assert(len >= 0); ! route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags, offset); } else { int isseg,rc; *************** *** 692,698 **** l=c; if (isseg) { - sc++; e_pnt=route_graph_add_point(this,&l); ! route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags); s_pnt=route_graph_add_point(this,&l); len = 0; --- 743,749 ---- l=c; if (isseg) { e_pnt=route_graph_add_point(this,&l); ! route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags, offset); ! offset++; s_pnt=route_graph_add_point(this,&l); len = 0; *************** *** 703,707 **** g_assert(len >= 0); sc++; ! route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags); } } --- 754,758 ---- g_assert(len >= 0); sc++; ! route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags, offset); } } *************** *** 885,891 **** } } ! ret=g_new0(struct route_path, 1); ret->path_hash=item_hash_new(); ! dbg(1,"dir=%d\n", pos->dir); while ((s=start->seg)) { segs++; --- 936,942 ---- } } ! ret=g_new0(struct route_path, 1); ret->path_hash=item_hash_new(); ! dbg(1,"dir=%d\n", pos->dir); while ((s=start->seg)) { segs++; *************** *** 900,907 **** len+=seg_len; if (s->start == start) { ! route_path_add_item(ret, &s->item, &s->start->c, &s->end->c, seg_len, seg_time); start=s->end; } else { ! route_path_add_item(ret, &s->item, &s->end->c, &s->start->c, seg_len, seg_time); start=s->start; } --- 951,958 ---- len+=seg_len; if (s->start == start) { ! route_path_add_item(ret, s, seg_len, seg_time, s->offset); start=s->end; } else { ! route_path_add_item(ret, s, seg_len, seg_time, s->offset); start=s->start; } *************** *** 955,969 **** struct map *m; struct item *item; - struct coord e; sel=route_calc_selection(c1, c2); ! h=mapset_open(ms); ! while ((m=mapset_next(h,1))) { mr=map_rect_new(m, sel); while ((item=map_rect_get_item(mr))) { if (item->type >= type_street_0 && item->type <= type_ferry) { route_process_street_graph(ret, item); ! } else ! while (item_coord_get(item, &e, 1)); } map_rect_destroy(mr); --- 1006,1018 ---- struct map *m; struct item *item; sel=route_calc_selection(c1, c2); ! h=mapset_open(ms); ! while ((m=mapset_next(h,1))) { mr=map_rect_new(m, sel); while ((item=map_rect_get_item(mr))) { if (item->type >= type_street_0 && item->type <= type_ferry) { route_process_street_graph(ret, item); ! } } map_rect_destroy(mr); *************** *** 1262,1267 **** - - static int route_draw_route_info(struct route_info *pos, struct route_info *dst, struct transformation *t, struct displaylist *dsp) --- 1311,1314 ---- *************** *** 1273,1276 **** --- 1320,1325 ---- struct point pnt[100]; int count=0; + struct street_data *street; + enum projection pro = projection_mg; item.id_lo=0; *************** *** 1286,1289 **** --- 1335,1340 ---- return 0; } + street = pos ? pos->street : dst->street; + pro = map_projection(street->item.map); if (pos) dbg(1, "pos=%p pos->dir=%d pos->pos=%d\n", pos, pos->dir, pos->pos); *************** *** 1293,1302 **** while (c && count < 100) { dbg(1,"c=%p (0x%x,0x%x)\n", c, c->x, c->y); ! transform(t, projection_mg, c, &pnt[count++]); coord_rect_extend(&r, c); c=route_info_get(h); } ! if (count && transform_contains(t, projection_mg, &r)) display_add(dsp, &item, count, pnt, "Route"); route_info_close(h); --- 1344,1353 ---- while (c && count < 100) { dbg(1,"c=%p (0x%x,0x%x)\n", c, c->x, c->y); ! transform(t, pro, c, &pnt[count++]); coord_rect_extend(&r, c); c=route_info_get(h); } ! if (count && transform_contains(t, pro, &r)) display_add(dsp, &item, count, pnt, "Route"); route_info_close(h); *************** *** 1345,1346 **** --- 1396,1530 ---- } #endif + + + struct map_rect_priv { + struct route *mpriv; + struct item item; + unsigned int last_coord; + struct route_path_segment *seg; + }; + + static void + rm_coord_rewind(void *priv_data) + { + struct map_rect_priv *mr = priv_data; + mr->last_coord = 0; + } + + static void + rm_attr_rewind(void *priv_data) + { + } + + static int + rm_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr) + { + return 0; + } + + static int + rm_coord_get(void *priv_data, struct coord *c, int count) + { + struct map_rect_priv *mr = priv_data; + struct route_path_segment *seg = mr->seg; + int rc = 0,i; + for (i=0; i < count; i++) { + if (mr->last_coord >= seg->ncoords) + break; + if (i >= seg->ncoords) + break; + c[i] = seg->c[mr->last_coord++]; + rc++; + } + return rc; + } + + static struct item_methods methods_route_item = { + rm_coord_rewind, + rm_coord_get, + rm_attr_rewind, + rm_attr_get, + }; + + static void + rm_destroy(struct map_priv *priv) + { + } + + static struct map_rect_priv * + rm_rect_new(struct map_priv *map, struct map_selection *sel) + { + struct map_rect_priv * mr; + mr = calloc(1, sizeof(*mr)); + if (!mr) + return mr; + mr->mpriv = (struct route *)map; + return mr; + } + + static void + rm_rect_destroy(struct map_rect_priv *mr) + { + free(mr); + } + + static struct item * + rm_get_item(struct map_rect_priv *mr) + { + struct route *r = mr->mpriv; + struct route_path_segment *seg = mr->seg; + + if (!seg) + seg = r->path2->path; + else + seg = seg->next; + if (!seg) + return NULL; + mr->seg = seg; + mr->last_coord = 0; + mr->item = seg->item; + mr->item.priv_data = mr; + mr->item.type = type_street_route; + mr->item.meth = &methods_route_item; + return &mr->item; + } + + static struct item * + rm_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo) + { + printf("%s called on Route map\n", __FUNCTION__); + return NULL; + } + + static struct map_methods route_meth = { + projection_none, + NULL, + rm_destroy, + rm_rect_new, + rm_rect_destroy, + rm_get_item, + rm_get_item_byid, + NULL, + NULL, + NULL, + }; + + static void route_init_map(struct route *route) + { + struct map *m = &route->route_map; + m->priv = (struct map_priv *)route; + m->type = "Route"; + m->filename = NULL; + m->active = 0; + m->meth = route_meth; + m->meth.pro = route_projection(route); + } + + struct map *route_get_map(struct route *route) + { + if (route->pos && route->dst && route->path2) { + route_init_map(route); + return &route->route_map; + } + return NULL; + } Index: transform.c =================================================================== RCS file: /cvsroot/navit/navit/src/transform.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** transform.c 19 Nov 2007 19:58:18 -0000 1.9 --- transform.c 22 Nov 2007 19:37:27 -0000 1.10 *************** *** 12,18 **** struct transformation { ! int width; /* Height of destination rectangle */ ! int height; /* Width of destination rectangle */ ! long scale; /* Scale factor */ int angle; /* Rotation angle */ double cos_val,sin_val; /* cos and sin of rotation angle */ --- 12,18 ---- struct transformation { ! int width; /* Height of destination rectangle */ ! int height; /* Width of destination rectangle */ ! long scale; /* Scale factor */ int angle; /* Rotation angle */ double cos_val,sin_val; /* cos and sin of rotation angle */ *************** *** 135,138 **** --- 135,218 ---- } + int + transform_array(struct transformation *t, enum projection pro, struct coord *c, struct point *p, int count, int uniq) + { + struct coord c1; + int xcn, ycn; + struct coord_geo g; + #ifdef AVOID_FLOAT + int xc,yc; + #else + double xc,yc; + #endif + int i,j = 0; + for (i=0; i < count; i++) { + if (pro == t->pro) { + xc=c[i].x; + yc=c[i].y; + } else { + transform_to_geo(pro, &c[i], &g); + transform_from_geo(t->pro, &g, &c1); + xc=c1.x; + yc=c1.y; + } + // dbg(2,"0x%x, 0x%x - 0x%x,0x%x contains 0x%x,0x%x\n", t->r.lu.x, t->r.lu.y, t->r.rl.x, t->r.rl.y, c->x, c->y); + // ret=coord_rect_contains(&t->r, c); + xc-=t->center.x; + yc-=t->center.y; + yc=-yc; + if (t->angle) { + xcn=xc*t->cos_val+yc*t->sin_val; + ycn=-xc*t->sin_val+yc*t->cos_val; + xc=xcn; + yc=ycn; + } + xc=xc*16; + yc=yc*16; + #ifndef AVOID_FLOAT + if (t->scale) { + xc=xc/(double)(t->scale); + yc=yc/(double)(t->scale); + } + #else + if (t->scale) { + xc=xc/t->scale; + yc=yc/t->scale; + } + #endif + yc+=t->height>>1; + xc+=t->width>>1; + if (xc < -0x8000) + xc=-0x8000; + if (xc > 0x7fff) { + xc=0x7fff; + } + if (yc < -0x8000) + yc=-0x8000; + if (yc > 0x7fff) + yc=0x7fff; + if (uniq) { + if (i) { + if (p[j].x != xc || p[j].y != yc) { + j++; + p[j].x=xc; + p[j].y=yc; + } + } else { + p[j].x=xc; + p[j].y=yc; + } + } else { + p[i].x=xc; + p[i].y=yc; + } + } + + if (uniq) + return 1+j; + + return count; + } + void transform_reverse(struct transformation *t, struct point *p, struct coord *c) Index: graphics.c =================================================================== RCS file: /cvsroot/navit/navit/src/graphics.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** graphics.c 16 Nov 2007 09:27:40 -0000 1.19 --- graphics.c 22 Nov 2007 19:37:26 -0000 1.20 *************** *** 451,469 **** static void ! do_draw(struct displaylist *displaylist, struct transformation *t, GList *mapsets, int order, struct route *route) { ! struct map_selection sel; struct map_rect *mr; struct item *item; - struct mapset *ms; - struct map *m; - enum projection pro; - struct mapset_handle *h; struct coord c; ! int conv,count,max=16384; struct point pnt[max]; struct attr attr; struct coord_rect r; if (! mapsets) return; --- 451,519 ---- static void ! do_draw_map(struct displaylist *displaylist, struct transformation *t, struct map *m, struct map_selection *sel) { ! enum projection pro; struct map_rect *mr; struct item *item; struct coord c; ! int i, conv,count,max=16384; struct point pnt[max]; + struct coord ca[max]; struct attr attr; struct coord_rect r; + pro=map_projection(m); + conv=map_requires_conversion(m); + transform_rect(t, pro, &sel->rect); + if (route_selection) + mr=map_rect_new(m, route_selection); + else + mr=map_rect_new(m, sel); + while ((item=map_rect_get_item(mr))) { + if (item->type < type_line) { + item_coord_get(item, &c, 1); + if (!transform(t, pro, &c, &pnt[0])) { + dbg(1,"not visible\n"); + continue; + } + count=1; + } else { + count = item_coord_get(item, ca, max); + if (count < 2) + continue; + r.lu=ca[0]; + r.rl=ca[0]; + for (i=1; i < count; i++) { + coord_rect_extend(&r, &ca[i]); + } + if (!transform_contains(t, pro, &r)) { + dbg(1,"poly not visible\n"); + continue; + } + count = transform_array(t, pro, ca, pnt, count, 1); + if (count < 2) + continue; + g_assert(count < max); + } + if (!item_attr_get(item, attr_label, &attr)) + attr.u.str=NULL; + if (conv && attr.u.str && attr.u.str[0]) { + char *str=map_convert_string(m, attr.u.str); + display_add(displaylist, item, count, pnt, str); + map_convert_free(str); + } else + display_add(displaylist, item, count, pnt, attr.u.str); + } + map_rect_destroy(mr); + } + + static void + do_draw(struct displaylist *displaylist, struct transformation *t, GList *mapsets, int order, struct route *route) + { + struct map_selection sel; + struct mapset *ms; + struct map *m; + struct mapset_handle *h; + if (! mapsets) return; *************** *** 475,532 **** h=mapset_open(ms); while ((m=mapset_next(h, 1))) { ! pro=map_projection(m); ! conv=map_requires_conversion(m); ! transform_rect(t, pro, &sel.rect); ! if (route_selection) ! mr=map_rect_new(m, route_selection); ! else ! mr=map_rect_new(m, &sel); ! while ((item=map_rect_get_item(mr))) { ! if (item->type < type_line) { ! item_coord_get(item, &c, 1); ! if (!transform(t, pro, &c, &pnt[0])) { ! dbg(1,"not visible\n"); ! continue; ! } ! count=1; ! } else { ! count=0; ! while (count < max) { ! if (!item_coord_get(item, &c, 1)) ! break; ! if (! count) { ! r.lu=c; ! r.rl=c; ! } else ! coord_rect_extend(&r, &c); ! transform(t, pro, &c, &pnt[count]); ! if (! count || pnt[count].x != pnt[count-1].x || pnt[count].y != pnt[count-1].y) ! count++; ! ! } ! g_assert(count < max); ! if (!transform_contains(t, pro, &r)) { ! dbg(1,"poly not visible\n"); ! continue; ! } ! if (route && route_contains(route, item)) { ! struct item ritem; ! ritem=*item; ! ritem.type=type_street_route; ! display_add(displaylist, &ritem, count, pnt, NULL); ! } ! } ! if (!item_attr_get(item, attr_label, &attr)) ! attr.u.str=NULL; ! if (conv && attr.u.str && attr.u.str[0]) { ! char *str=map_convert_string(m, attr.u.str); ! display_add(displaylist, item, count, pnt, str); ! map_convert_free(str); ! } else ! display_add(displaylist, item, count, pnt, attr.u.str); ! } ! map_rect_destroy(mr); } mapset_close(h); } --- 525,536 ---- h=mapset_open(ms); while ((m=mapset_next(h, 1))) { ! do_draw_map(displaylist, t, m, &sel); } mapset_close(h); + if (route) { + m = route_get_map(route); + if (m) + do_draw_map(displaylist, t, m, &sel); + } } Index: map.h =================================================================== RCS file: /cvsroot/navit/navit/src/map.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** map.h 19 Nov 2007 19:58:17 -0000 1.7 --- map.h 22 Nov 2007 19:37:26 -0000 1.8 *************** *** 26,29 **** --- 26,37 ---- }; + struct map { + struct map_methods meth; + struct map_priv *priv; + char *type; + char *filename; + int active; + }; + /* prototypes */ enum projection; Index: map.c =================================================================== RCS file: /cvsroot/navit/navit/src/map.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** map.c 19 Nov 2007 19:58:17 -0000 1.8 --- map.c 22 Nov 2007 19:37:26 -0000 1.9 *************** *** 11,22 **** #include "country.h" - struct map { - struct map_methods meth; - struct map_priv *priv; - char *type; - char *filename; - int active; - }; - struct map_rect { struct map *m; --- 11,14 ---- |
From: KaZeR <ka...@us...> - 2007-11-22 17:32:31
|
Update of /cvsroot/navit/navit/src/gui/sdl In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22708 Modified Files: sdl_events.cpp Log Message: Reverted some changes about search struct which broke town search in sdl Index: sdl_events.cpp =================================================================== RCS file: /cvsroot/navit/navit/src/gui/sdl/sdl_events.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** sdl_events.cpp 19 Nov 2007 19:58:19 -0000 1.16 --- sdl_events.cpp 22 Nov 2007 17:32:28 -0000 1.17 *************** *** 28,31 **** --- 28,39 ---- + static struct search_param { + struct navit *nav; + struct mapset *ms; + struct search_list *sl; + struct attr attr; + } search_param; + + void route_to(int x,int y){ struct pcoord pos; *************** *** 195,199 **** using namespace CEGUI; extern CEGUI::Window* myRoot; ! static struct search_param { struct navit *nav; --- 203,207 ---- using namespace CEGUI; extern CEGUI::Window* myRoot; ! /* static struct search_param { struct navit *nav; *************** *** 202,209 **** struct attr attr; } search_param; struct search_param *search=&search_param; struct search_list_result *res; ! // dbg(1,"search->nav=sdl_gui_navit;\n"); search->nav=sdl_gui_navit; --- 210,218 ---- struct attr attr; } search_param; + */ struct search_param *search=&search_param; struct search_list_result *res; ! /* // dbg(1,"search->nav=sdl_gui_navit;\n"); search->nav=sdl_gui_navit; *************** *** 212,215 **** --- 221,225 ---- // dbg(1,"search->sl=search_list_new(search->ms);\n"); search->sl=search_list_new(search->ms); + */ MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("DestinationWindow/Listbox")); *************** *** 249,253 **** } else { ! // dbg(1,"town searching for %s\n",content.c_str()); search->attr.type=attr_town_name; search->attr.u.str=(char *)content.c_str(); --- 259,263 ---- } else { ! dbg(0,"town searching for %s\n",content.c_str()); search->attr.type=attr_town_name; search->attr.u.str=(char *)content.c_str(); *************** *** 353,356 **** --- 363,375 ---- dbg(0,"*** Invalid navit instance in sdl_events\n"); } + struct search_param *search=&search_param; + struct search_list_result *res; + + // dbg(1,"search->nav=sdl_gui_navit;\n"); + search->nav=sdl_gui_navit; + // dbg(1,"search->ms=navit_get_mapset(sdl_gui_navit);\n"); + search->ms=navit_get_mapset(sdl_gui_navit); + // dbg(1,"search->sl=search_list_new(search->ms);\n"); + search->sl=search_list_new(search->ms); *************** *** 392,421 **** country_search_destroy(cs); - /* - // This code should 'guess' your country based upon your locale settings. - // useful if nothing else worked - char * lc_lang; - lc_lang = getenv ("LANG"); - if (lc_lang!=NULL){ - char lang_code [3]; - strncpy(lang_code, lc_lang+3, 2); - lang_code[2]='\0'; - dbg(0,"LC_LANG = %s -> %s\n",lc_lang,lang_code); - - struct search_param *search=&search_param; - struct search_list_result *res; - search->attr.type=attr_country_iso2; - search->attr.u.str=lang_code; - dbg(0,"launching iso2 search\n"); - search_list_search(search->sl, &search->attr, 1); - dbg(0,"got result. ready to parse\n"); - while((res=search_list_get_result(search->sl))) { - dbg(0," got country : \n",res->country->name); - } - dbg(0,"done parsing\n"); - } - - */ - we.window->getParent()->getChild("DestinationWindow")->show(); } --- 411,414 ---- |
From: Alexander A. <za...@us...> - 2007-11-22 15:36:16
|
Update of /cvsroot/navit/navit/src/data/garmin In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28418 Modified Files: garmin.c Log Message: Fix coordinates count Index: garmin.c =================================================================== RCS file: /cvsroot/navit/navit/src/data/garmin/garmin.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** garmin.c 20 Nov 2007 20:01:50 -0000 1.8 --- garmin.c 22 Nov 2007 15:36:12 -0000 1.9 *************** *** 281,285 **** c++; total++; - total++; mr->last_coord ++; } --- 281,284 ---- |
From: Martin S. <mar...@us...> - 2007-11-21 20:17:32
|
Update of /cvsroot/navit/navit/src/data/binfile In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5055 Modified Files: binfile.c Log Message: Improved debugging output Index: binfile.c =================================================================== RCS file: /cvsroot/navit/navit/src/data/binfile/binfile.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** binfile.c 12 Nov 2007 19:25:29 -0000 1.6 --- binfile.c 21 Nov 2007 20:17:28 -0000 1.7 *************** *** 73,79 **** struct tile *t=mr->t; int ret=0; ! dbg(1,"binfile_coord_get %d\n",count); while (count--) { ! dbg(1,"%p vs %p\n", t->pos_coord, t->pos_attr_start); if (t->pos_coord >= t->pos_attr_start) break; --- 73,79 ---- struct tile *t=mr->t; int ret=0; ! dbg(2,"binfile_coord_get %d\n",count); while (count--) { ! dbg(2,"%p vs %p\n", t->pos_coord, t->pos_attr_start); if (t->pos_coord >= t->pos_attr_start) break; *************** *** 157,160 **** --- 157,162 ---- struct zip_lfh *lfh; char *zipfn; + dbg(1,"enter %p %p %p\n", f, cd, t); + dbg(1,"cd->zipofst=0x%x\n", cd->zipofst); lfh=(struct zip_lfh *)(file_data_read(f,cd->zipofst,sizeof(struct zip_lfh))); zipfn=(char *)(file_data_read(f,cd->zipofst+sizeof(struct zip_lfh), lfh->zipfnln)); *************** *** 175,178 **** --- 177,181 ---- struct tile t; struct zip_cd *cd=(struct zip_cd *)(file_data_read(f, m->eoc->zipeofst + zipfile*m->cde_size, sizeof(struct zip_cd))); + dbg(1,"enter %p %d\n", mr, zipfile); t.zipfile_num=zipfile; zipfile_to_tile(f, cd, &t); *************** *** 193,196 **** --- 196,200 ---- mr->item.id_hi=0; mr->item.id_lo=0; + dbg(1,"eoc->zipecenn=%d\n", map->eoc->zipecenn); if (map->eoc) push_zipfile_tile(mr, map->eoc->zipecenn-1); |
From: KaZeR <ka...@us...> - 2007-11-20 20:47:39
|
Update of /cvsroot/navit/navit In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7811 Modified Files: configure.in Log Message: Added details in case of sdl gui dependency missing Index: configure.in =================================================================== RCS file: /cvsroot/navit/navit/configure.in,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** configure.in 19 Nov 2007 11:25:08 -0000 1.55 --- configure.in 20 Nov 2007 20:47:37 -0000 1.56 *************** *** 164,168 **** if test x"$cegui" = xyes ! then # Save the LIBS into a temp var since AC_CHECK_LIB adds the lib into LIBS # and we want just to check and use CEGUI_LIBS --- 164,168 ---- if test x"$cegui" = xyes ! then # Save the LIBS into a temp var since AC_CHECK_LIB adds the lib into LIBS # and we want just to check and use CEGUI_LIBS *************** *** 416,421 **** then if test x"$cegui" = xyes ! then ! echo "SDL gui : ENABLED, with $CEGUI_LIBS" else echo "SDL gui : DISABLED : you are missing cegui-devel >= 0.5" --- 416,431 ---- then if test x"$cegui" = xyes ! then ! if test x"$glut" = xyes ! then ! if test x"$glc" = xyes ! then ! echo "SDL gui : ENABLED, with $CEGUI_LIBS" ! else ! echo "SDL gui : DISABLED, you are missing quesoglc" ! fi ! else ! echo "SDL gui : DISABLED, your are missing glut" ! fi else echo "SDL gui : DISABLED : you are missing cegui-devel >= 0.5" |
From: Alexander A. <za...@us...> - 2007-11-20 20:01:49
|
Update of /cvsroot/navit/navit/src/data/garmin In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv20190/data/garmin Modified Files: garmin.c Log Message: Create more than one segment from a road Index: garmin.c =================================================================== RCS file: /cvsroot/navit/navit/src/data/garmin/garmin.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** garmin.c 20 Nov 2007 19:06:16 -0000 1.7 --- garmin.c 20 Nov 2007 20:01:50 -0000 1.8 *************** *** 233,236 **** --- 233,247 ---- } + static int + coord_is_segment(void *priv_data) + { + struct gobject *g = priv_data; + struct map_rect_priv *mr = g->priv_data; + + if (mr->last_coord == 0) + return 0; + return gar_is_object_dcoord_node(mr->gmap, g, mr->last_coord - 1); + } + static int poly_coord_get(void *priv_data, struct coord *c, int count) *************** *** 356,359 **** --- 367,371 ---- attr_rewind, // point_attr_rewind, point_attr_get, // poly_attr_get, + coord_is_segment, }; |
From: Alexander A. <za...@us...> - 2007-11-20 20:01:49
|
Update of /cvsroot/navit/navit/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv20190 Modified Files: item.c item.h route.c track.c Log Message: Create more than one segment from a road Index: item.c =================================================================== RCS file: /cvsroot/navit/navit/src/item.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** item.c 28 Aug 2007 17:31:09 -0000 1.6 --- item.c 20 Nov 2007 20:01:50 -0000 1.7 *************** *** 31,34 **** --- 31,42 ---- } + int + item_coord_is_segment(struct item *it) + { + if (it->meth->item_coord_is_segment) + return it->meth->item_coord_is_segment(it->priv_data); + return 0; + } + void item_attr_rewind(struct item *it) Index: route.c =================================================================== RCS file: /cvsroot/navit/navit/src/route.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** route.c 20 Nov 2007 18:55:41 -0000 1.22 --- route.c 20 Nov 2007 20:01:50 -0000 1.23 *************** *** 664,681 **** struct coord c,l; struct attr attr; ! if (item_coord_get(item, &l, 1)) { s_pnt=route_graph_add_point(this,&l); ! while (item_coord_get(item, &c, 1)) { ! len+=transform_distance(map_projection(item->map), &l, &c); ! l=c; } - e_pnt=route_graph_add_point(this,&l); - g_assert(len >= 0); - if (item_attr_get(item, attr_flags, &attr)) - route_graph_add_segment(this, s_pnt, e_pnt, len, item, attr.u.num); - else - route_graph_add_segment(this, s_pnt, e_pnt, len, item, 0); } } --- 664,708 ---- struct coord c,l; struct attr attr; ! int flags = 0; ! int segmented = 0; if (item_coord_get(item, &l, 1)) { + if (item_attr_get(item, attr_flags, &attr)) { + flags = attr.u.num; + if (flags & AF_SEGMENTED) + segmented = 1; + } s_pnt=route_graph_add_point(this,&l); ! if (!segmented) { ! while (item_coord_get(item, &c, 1)) { ! len+=transform_distance(map_projection(item->map), &l, &c); ! l=c; ! } ! e_pnt=route_graph_add_point(this,&l); ! g_assert(len >= 0); ! route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags); ! } else { ! int isseg,rc; ! int sc = 0; ! do { ! isseg = item_coord_is_segment(item); ! rc = item_coord_get(item, &c, 1); ! if (rc) { ! len+=transform_distance(map_projection(item->map), &l, &c); ! l=c; ! if (isseg) { ! sc++; ! e_pnt=route_graph_add_point(this,&l); ! route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags); ! s_pnt=route_graph_add_point(this,&l); ! len = 0; ! } ! } ! } while(rc); ! e_pnt=route_graph_add_point(this,&l); ! g_assert(len >= 0); ! sc++; ! route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags); } } } Index: item.h =================================================================== RCS file: /cvsroot/navit/navit/src/item.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** item.h 29 Oct 2007 19:33:16 -0000 1.7 --- item.h 20 Nov 2007 20:01:50 -0000 1.8 *************** *** 26,29 **** --- 26,30 ---- void (*item_attr_rewind)(void *priv_data); int (*item_attr_get)(void *priv_data, enum attr_type attr_type, struct attr *attr); + int (*item_coord_is_segment)(void *priv_data); }; *************** *** 46,49 **** --- 47,52 ---- void item_coord_rewind(struct item *it); int item_coord_get(struct item *it, struct coord *c, int count); + /* does the next returned coordinate mark a segment */ + int item_coord_is_segment(struct item *it); void item_attr_rewind(struct item *it); int item_attr_get(struct item *it, enum attr_type attr_type, struct attr *attr); Index: track.c =================================================================== RCS file: /cvsroot/navit/navit/src/track.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** track.c 20 Nov 2007 18:55:41 -0000 1.16 --- track.c 20 Nov 2007 20:01:50 -0000 1.17 *************** *** 247,251 **** while (t) { struct street_data *sd=t->street; ! int dir; switch(sd->flags & AF_ONEWAYMASK) { case 0: --- 247,251 ---- while (t) { struct street_data *sd=t->street; ! int dir = 0; switch(sd->flags & AF_ONEWAYMASK) { case 0: |
From: Alexander A. <za...@us...> - 2007-11-20 19:06:14
|
Update of /cvsroot/navit/navit/src/data/garmin In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27707/data/garmin Modified Files: garmin.c Log Message: attr_flags for garmin driver Index: garmin.c =================================================================== RCS file: /cvsroot/navit/navit/src/data/garmin/garmin.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** garmin.c 20 Nov 2007 18:55:41 -0000 1.6 --- garmin.c 20 Nov 2007 19:06:16 -0000 1.7 *************** *** 302,305 **** --- 302,321 ---- if (rc) return rc; + case 2: + mr->last_attr++; + attr->type = attr_street_name; + rc = garmin_object_label(g, attr); + if (rc) + return rc; + case 3: + mr->last_attr++; + attr->type = attr_flags; + attr->u.num = 0; + rc = gar_object_flags(g); + if (rc & F_ONEWAY) + attr->u.num |= AF_ONEWAY; + if (rc & F_SEGMENTED) + attr->u.num |= AF_SEGMENTED; + return 1; default: return 0; *************** *** 313,317 **** return garmin_object_label(g, attr); case attr_flags: ! return 0; default: dlog(1, "Dont know about attribute %d[%04X]=%s yet\n", attr_type,attr_type, attr_to_name(attr_type)); --- 329,340 ---- return garmin_object_label(g, attr); case attr_flags: ! attr->type = attr_flags; ! attr->u.num = 0; ! rc = gar_object_flags(g); ! if (rc & F_ONEWAY) ! attr->u.num |= AF_ONEWAY; ! if (rc & F_SEGMENTED) ! attr->u.num |= AF_SEGMENTED; ! return 1; default: dlog(1, "Dont know about attribute %d[%04X]=%s yet\n", attr_type,attr_type, attr_to_name(attr_type)); |
From: Alexander A. <za...@us...> - 2007-11-20 18:55:41
|
Update of /cvsroot/navit/navit/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23022 Modified Files: attr.h attr_def.h osm2navit.c route.c route.h track.c Log Message: Rename attr_limit to attr_flags and define what the flags are Index: route.h =================================================================== RCS file: /cvsroot/navit/navit/src/route.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** route.h 19 Nov 2007 19:58:18 -0000 1.11 --- route.h 20 Nov 2007 18:55:41 -0000 1.12 *************** *** 15,19 **** struct item item; int count; ! int limit; struct coord c[0]; }; --- 15,19 ---- struct item item; int count; ! int flags; struct coord c[0]; }; Index: attr.h =================================================================== RCS file: /cvsroot/navit/navit/src/attr.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** attr.h 5 Nov 2007 15:18:14 -0000 1.10 --- attr.h 20 Nov 2007 18:55:41 -0000 1.11 *************** *** 18,21 **** --- 18,28 ---- }; + #define AF_ONEWAY (1<<0) + #define AF_ONEWAYREV (1<<1) + #define AF_NOPASS (AF_ONEWAY|AF_ONEWAYREV) + #define AF_ONEWAYMASK (AF_ONEWAY|AF_ONEWAYREV) + #define AF_SEGMENTED (1<<2) + + struct attr { enum attr_type type; Index: attr_def.h =================================================================== RCS file: /cvsroot/navit/navit/src/attr_def.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** attr_def.h 5 Nov 2007 09:22:03 -0000 1.13 --- attr_def.h 20 Nov 2007 18:55:41 -0000 1.14 *************** *** 17,21 **** ATTR(h) ATTR(id) ! ATTR(limit) ATTR(w) ATTR(x) --- 17,21 ---- ATTR(h) ATTR(id) ! ATTR(flags) ATTR(w) ATTR(x) Index: route.c =================================================================== RCS file: /cvsroot/navit/navit/src/route.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** route.c 19 Nov 2007 19:58:17 -0000 1.21 --- route.c 20 Nov 2007 18:55:41 -0000 1.22 *************** *** 64,68 **** struct route_graph_point *end; struct item item; ! int limit; int len; }; --- 64,68 ---- struct route_graph_point *end; struct item item; ! int flags; int len; }; *************** *** 396,400 **** static void ! route_graph_add_segment(struct route_graph *this, struct route_graph_point *start, struct route_graph_point *end, int len, struct item *item, int limit) { struct route_graph_segment *s; --- 396,400 ---- static void ! route_graph_add_segment(struct route_graph *this, struct route_graph_point *start, struct route_graph_point *end, int len, struct item *item, int flags) { struct route_graph_segment *s; *************** *** 409,413 **** s->len=len; s->item=*item; ! s->limit=limit; s->next=this->route_segments; this->route_segments=s; --- 409,413 ---- s->len=len; s->item=*item; ! s->flags=flags; s->next=this->route_segments; this->route_segments=s; *************** *** 674,678 **** e_pnt=route_graph_add_point(this,&l); g_assert(len >= 0); ! if (item_attr_get(item, attr_limit, &attr)) route_graph_add_segment(this, s_pnt, e_pnt, len, item, attr.u.num); else --- 674,678 ---- e_pnt=route_graph_add_point(this,&l); g_assert(len >= 0); ! if (item_attr_get(item, attr_flags, &attr)) route_graph_add_segment(this, s_pnt, e_pnt, len, item, attr.u.num); else *************** *** 730,734 **** fh_setcmp(heap, compare); ! if (! (sd->limit & 2)) { end=route_graph_get_point(this, &sd->c[0]); g_assert(end != 0); --- 730,734 ---- fh_setcmp(heap, compare); ! if (! (sd->flags & AF_ONEWAYREV)) { end=route_graph_get_point(this, &sd->c[0]); g_assert(end != 0); *************** *** 737,741 **** } ! if (! (sd->limit & 1)) { end=route_graph_get_point(this, &sd->c[sd->count-1]); g_assert(end != 0); --- 737,741 ---- } ! if (! (sd->flags & AF_ONEWAY)) { end=route_graph_get_point(this, &sd->c[sd->count-1]); g_assert(end != 0); *************** *** 762,766 **** if (debug_route) printf("begin %d len %d vs %d (0x%x,0x%x)\n",new,val,s->end->value, s->end->c.x, s->end->c.y); ! if (new < s->end->value && !(s->limit & 1)) { s->end->value=new; s->end->seg=s; --- 762,766 ---- if (debug_route) printf("begin %d len %d vs %d (0x%x,0x%x)\n",new,val,s->end->value, s->end->c.x, s->end->c.y); ! if (new < s->end->value && !(s->flags & AF_ONEWAY)) { s->end->value=new; s->end->seg=s; *************** *** 788,792 **** if (debug_route) printf("end %d len %d vs %d (0x%x,0x%x)\n",new,val,s->start->value,s->start->c.x, s->start->c.y); ! if (new < s->start->value && !(s->limit & 2)) { old=s->start->value; s->start->value=new; --- 788,792 ---- if (debug_route) printf("end %d len %d vs %d (0x%x,0x%x)\n",new,val,s->start->value,s->start->c.x, s->start->c.y); ! if (new < s->start->value && !(s->flags & AF_ONEWAYREV)) { old=s->start->value; s->start->value=new; *************** *** 827,831 **** struct route_path *ret; ! if (! (sd->limit & 1)) { start1=route_graph_get_point(this, &sd->c[0]); if (! start1) --- 827,831 ---- struct route_path *ret; ! if (! (sd->flags & AF_ONEWAY)) { start1=route_graph_get_point(this, &sd->c[0]); if (! start1) *************** *** 834,838 **** dbg(1,"start1: %d(route)+%d=%d\n", start1->value, val1-start1->value, val1); } ! if (! (sd->limit & 2)) { start2=route_graph_get_point(this, &sd->c[sd->count-1]); if (! start2) --- 834,838 ---- dbg(1,"start1: %d(route)+%d=%d\n", start1->value, val1-start1->value, val1); } ! if (! (sd->flags & AF_ONEWAYREV)) { start2=route_graph_get_point(this, &sd->c[sd->count-1]); if (! start2) *************** *** 882,886 **** sd=dst->street; dbg(1,"start->value=%d 0x%x,0x%x\n", start->value, start->c.x, start->c.y); ! dbg(1,"dst sd->limit=%d sd->c[0]=0x%x,0x%x sd->c[sd->count-1]=0x%x,0x%x\n", sd->limit, sd->c[0].x,sd->c[0].y, sd->c[sd->count-1].x, sd->c[sd->count-1].y); if (start->c.x == sd->c[0].x && start->c.y == sd->c[0].y) dst->dir=-1; --- 882,886 ---- sd=dst->street; dbg(1,"start->value=%d 0x%x,0x%x\n", start->value, start->c.x, start->c.y); ! dbg(1,"dst sd->flags=%d sd->c[0]=0x%x,0x%x sd->c[sd->count-1]=0x%x,0x%x\n", sd->flags, sd->c[0].x,sd->c[0].y, sd->c[sd->count-1].x, sd->c[sd->count-1].y); if (start->c.x == sd->c[0].x && start->c.y == sd->c[0].y) dst->dir=-1; *************** *** 977,984 **** ret->item=*item; ret->count=count; ! if (item_attr_get(item, attr_limit, &attr)) ! ret->limit=attr.u.num; else ! ret->limit=0; memcpy(ret->c, c, count*sizeof(struct coord)); --- 977,984 ---- ret->item=*item; ret->count=count; ! if (item_attr_get(item, attr_flags, &attr)) ! ret->flags=attr.u.num; else ! ret->flags=0; memcpy(ret->c, c, count*sizeof(struct coord)); *************** *** 1019,1028 **** --- 1019,1040 ---- struct street_data *sd; struct coord c; + struct coord_geo g; c.x = pc->x; c.y = pc->y; + /* + * This is not correct for two reasons: + * - You may need to go back first + * - Currently we allow mixing of mapsets + */ sel = route_rect(18, &c, &c, 0, max_dist); h=mapset_open(ms); while ((m=mapset_next(h,1))) { + c.x = pc->x; + c.y = pc->y; + if (map_projection(m) != pc->pro) { + transform_to_geo(pc->pro, &c, &g); + transform_from_geo(map_projection(m), &g, &c); + } mr=map_rect_new(m, sel); while ((item=map_rect_get_item(mr))) { Index: osm2navit.c =================================================================== RCS file: /cvsroot/navit/navit/src/osm2navit.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** osm2navit.c 13 Nov 2007 20:39:57 -0000 1.9 --- osm2navit.c 20 Nov 2007 18:55:41 -0000 1.10 *************** *** 164,171 **** char debug_attr_buffer[1024]; ! struct attr_bin limit_attr = { ! 0, attr_limit }; ! int limit_attr_value; static void --- 164,171 ---- char debug_attr_buffer[1024]; ! struct attr_bin flags_attr = { ! 0, attr_flags }; ! int flags_attr_value; static void *************** *** 219,228 **** if (! strcmp(k,"oneway")) { if (! strcmp(v,"true") || !strcmp(v,"yes")) { ! limit_attr_value=1; ! limit_attr.len=2; } if (! strcmp(v,"-1")) { ! limit_attr_value=2; ! limit_attr.len=2; } if (!in_way) --- 219,228 ---- if (! strcmp(k,"oneway")) { if (! strcmp(v,"true") || !strcmp(v,"yes")) { ! flags_attr_value=AF_ONEWAY; ! flags_attr.len=2; } if (! strcmp(v,"-1")) { ! flags_attr_value=AF_ONEWAYREV; ! flags_attr.len=2; } if (!in_way) *************** *** 460,464 **** label_attr.len=0; debug_attr.len=0; ! limit_attr.len=0; sprintf(debug_attr_buffer,"way_id=%d", wayid); } --- 460,464 ---- label_attr.len=0; debug_attr.len=0; ! flags_attr.len=0; sprintf(debug_attr_buffer,"way_id=%d", wayid); } *************** *** 498,503 **** if (debug_attr.len) alen+=debug_attr.len+1; ! if (limit_attr.len) ! alen+=limit_attr.len+1; item.clen=coord_count*2; item.len=item.clen+2+alen; --- 498,503 ---- if (debug_attr.len) alen+=debug_attr.len+1; ! if (flags_attr.len) ! alen+=flags_attr.len+1; item.clen=coord_count*2; item.len=item.clen+2+alen; *************** *** 506,510 **** write_attr(out, &label_attr, label_attr_buffer); write_attr(out, &debug_attr, debug_attr_buffer); ! write_attr(out, &limit_attr, &limit_attr_value); } --- 506,510 ---- write_attr(out, &label_attr, label_attr_buffer); write_attr(out, &debug_attr, debug_attr_buffer); ! write_attr(out, &flags_attr, &flags_attr_value); } Index: track.c =================================================================== RCS file: /cvsroot/navit/navit/src/track.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** track.c 19 Nov 2007 19:58:18 -0000 1.15 --- track.c 20 Nov 2007 18:55:41 -0000 1.16 *************** *** 248,252 **** struct street_data *sd=t->street; int dir; ! switch(sd->limit & 3) { case 0: dir=0; --- 248,252 ---- struct street_data *sd=t->street; int dir; ! switch(sd->flags & AF_ONEWAYMASK) { case 0: dir=0; |
From: Alexander A. <za...@us...> - 2007-11-20 18:55:40
|
Update of /cvsroot/navit/navit/src/data/mg In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23022/data/mg Modified Files: street.c Log Message: Rename attr_limit to attr_flags and define what the flags are Index: street.c =================================================================== RCS file: /cvsroot/navit/navit/src/data/mg/street.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** street.c 8 Nov 2007 09:42:00 -0000 1.10 --- street.c 20 Nov 2007 18:55:41 -0000 1.11 *************** *** 243,247 **** return ((attr->u.str && attr->u.str[0]) ? 1:0); case attr_street_name_systematic: ! street->attr_next=attr_limit; nameid=L(street->str->nameid); if (! nameid) --- 243,247 ---- return ((attr->u.str && attr->u.str[0]) ? 1:0); case attr_street_name_systematic: ! street->attr_next=attr_flags; nameid=L(street->str->nameid); if (! nameid) *************** *** 251,261 **** attr->u.str=street->name.name1; return ((attr->u.str && attr->u.str[0]) ? 1:0); ! case attr_limit: if (street->str->type & 0x40) { ! attr->u.num=(street->str->limit & 0x30) ? 2:0; ! attr->u.num|=(street->str->limit & 0x03) ? 1:0; } else { ! attr->u.num=(street->str->limit & 0x30) ? 1:0; ! attr->u.num|=(street->str->limit & 0x03) ? 2:0; } street->attr_next=attr_country_id; --- 251,261 ---- attr->u.str=street->name.name1; return ((attr->u.str && attr->u.str[0]) ? 1:0); ! case attr_flags: if (street->str->type & 0x40) { ! attr->u.num=(street->str->limit & 0x30) ? AF_ONEWAYREV:0; ! attr->u.num|=(street->str->limit & 0x03) ? AF_ONEWAY:0; } else { ! attr->u.num=(street->str->limit & 0x30) ? AF_ONEWAY:0; ! attr->u.num|=(street->str->limit & 0x03) ? AF_ONEWAYREV:0; } street->attr_next=attr_country_id; |
From: Alexander A. <za...@us...> - 2007-11-20 18:55:40
|
Update of /cvsroot/navit/navit/src/data/garmin In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23022/data/garmin Modified Files: garmin.c Log Message: Rename attr_limit to attr_flags and define what the flags are Index: garmin.c =================================================================== RCS file: /cvsroot/navit/navit/src/data/garmin/garmin.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** garmin.c 19 Nov 2007 10:26:52 -0000 1.5 --- garmin.c 20 Nov 2007 18:55:41 -0000 1.6 *************** *** 312,316 **** attr->type = attr_street_name; return garmin_object_label(g, attr); ! case attr_limit: return 0; default: --- 312,316 ---- attr->type = attr_street_name; return garmin_object_label(g, attr); ! case attr_flags: return 0; default: *************** *** 508,511 **** --- 508,512 ---- // Get all roads flags = GO_GET_ROUTABLE; + sel = NULL; } else if (sel) flags = GO_GET_SORTED; |
From: Alexander A. <za...@us...> - 2007-11-19 20:33:52
|
Update of /cvsroot/navit/navit/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22069 Modified Files: navit.xml Log Message: Add some of the garmin types to the navit's layout Index: navit.xml =================================================================== RCS file: /cvsroot/navit/navit/src/navit.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** navit.xml 13 Nov 2007 20:39:57 -0000 1.16 --- navit.xml 19 Nov 2007 20:33:55 -0000 1.17 *************** *** 82,88 **** --- 82,90 ---- <polygon color="#82c8ea" /> <polyline color="#5096b8" /> + <label label_size="5" /> </item> <item type="park_poly" order="0-"> <polygon color="#7cc334" /> + <label label_size="5" /> </item> <item type="airport_poly" order="0-"> *************** *** 97,100 **** --- 99,103 ---- <item type="water_line" order="0-"> <polyline color="#5096b8" width="1" /> + <label label_size="5" /> </item> <item type="rail" order="6-"> *************** *** 479,482 **** --- 482,792 ---- <circle color="#8080ff" radius="3" /> </item> + <item type="poi_dining" order="0-"> + <icon src="dining.xpm" /> + </item> + <item type="poi_fastfood" order="0-"> + <icon src="fastfood.xpm" /> + </item> + <item type="poi_police" order="0-"> + <icon src="police.xpm" /> + </item> + <item type="poi_auto_club" order="0-"> + <icon src="auto_club.xpm" /> + </item> + <item type="poi_autoservice" order="0-"> + <icon src="autoservice.xpm" /> + </item> + <item type="poi_bank" order="0-"> + <icon src="bank.xpm" /> + </item> + <item type="poi_bay" order="0-"> + <icon src="bay.xpm" /> + </item> + <item type="poi_bend" order="0-"> + <icon src="bend.xpm" /> + </item> + <item type="poi_boat_ramp" order="0-"> + <icon src="boat_ramp.xpm" /> + </item> + <item type="poi_border_station" order="0-"> + <icon src="border_station.xpm" /> + </item> + <item type="poi_bowling" order="0-"> + <icon src="bowling.xpm" /> + </item> + <item type="poi_bus_station" order="0-"> + <icon src="bus_station.xpm" /> + </item> + <item type="poi_bus_stop" order="0-"> + <icon src="bus_stop.xpm" /> + </item> + <item type="poi_bussines_service" order="0-"> + <icon src="bussines_service.xpm" /> + </item> + <item type="poi_car_rent" order="0-"> + <icon src="car_rent.xpm" /> + </item> + <item type="poi_car_wash" order="0-"> + <icon src="car_wash.xpm" /> + </item> + <item type="poi_casino" order="0-"> + <icon src="casino.xpm" /> + </item> + <item type="poi_cemetery" order="0-"> + <icon src="cemetery.xpm" /> + </item> + <item type="poi_church" order="0-"> + <icon src="church.xpm" /> + </item> + <item type="poi_cinema" order="0-"> + <icon src="cinema.xpm" /> + </item> + <item type="poi_civil" order="0-"> + <icon src="civil.xpm" /> + </item> + <item type="poi_communication" order="0-"> + <icon src="communication.xpm" /> + </item> + <item type="poi_concert" order="0-"> + <icon src="concert.xpm" /> + </item> + <item type="poi_cove" order="0-"> + <icon src="cove.xpm" /> + </item> + <item type="poi_crossing" order="0-"> + <icon src="crossing.xpm" /> + </item> + <item type="poi_dam" order="0-"> + <icon src="dam.xpm" /> + </item> + <item type="poi_danger_area" order="0-"> + <icon src="danger_area.xpm" /> + </item> + <item type="poi_dangerous" order="0-"> + <icon src="dangerous.xpm" /> + </item> + <item type="poi_daymark" order="0-"> + <icon src="daymark.xpm" /> + </item> + <item type="poi_diving" order="0-"> + <icon src="diving.xpm" /> + </item> + <item type="poi_drinking_water" order="0-"> + <icon src="drinking_water.xpm" /> + </item> + <item type="poi_emergency" order="0-"> + <icon src="emergency.xpm" /> + </item> + <item type="poi_fair" order="0-"> + <icon src="fair.xpm" /> + </item> + <item type="poi_firebrigade" order="0-"> + <icon src="firebrigade.xpm" /> + </item> + <item type="poi_fish" order="0-"> + <icon src="fish.xpm" /> + </item> + <item type="poi_forbiden_area" order="0-"> + <icon src="forbiden_area.xpm" /> + </item> + <item type="poi_garmin" order="0-"> + <icon src="garmin.xpm" /> + </item> + <item type="poi_golf" order="0-"> + <icon src="golf.xpm" /> + </item> + <item type="poi_goverment_building" order="0-"> + <icon src="goverment_building.xpm" /> + </item> + <item type="poi_height" order="0-"> + <icon src="height.xpm" /> + </item> + <item type="poi_heliport" order="0-"> + <icon src="heliport.xpm" /> + </item> + <item type="poi_hotspring" order="0-"> + <icon src="hotspring.xpm" /> + </item> + <item type="poi_icesport" order="0-"> + <icon src="icesport.xpm" /> + </item> + <item type="poi_information" order="0-"> + <icon src="information.xpm" /> + </item> + <item type="poi_justice" order="0-"> + <icon src="justice.xpm" /> + </item> + <item type="poi_landmark" order="0-"> + <icon src="landmark.xpm" /> + </item> + <item type="poi_levee" order="0-"> + <icon src="levee.xpm" /> + </item> + <item type="poi_library" order="0-"> + <icon src="library.xpm" /> + </item> + <item type="poi_locale" order="0-"> + <icon src="locale.xpm" /> + </item> + <item type="poi_loudspeaker" order="0-"> + <icon src="loudspeaker.xpm" /> + </item> + <item type="poi_mall" order="0-"> + <icon src="mall.xpm" /> + </item> + <item type="poi_manmade_feature" order="0-"> + <icon src="manmade_feature.xpm" /> + </item> + <item type="poi_marine" order="0-"> + <icon src="marine.xpm" /> + </item> + <item type="poi_marine_type" order="0-"> + <icon src="marine_type.xpm" /> + </item> + <item type="poi_mark" order="0-"> + <icon src="mark.xpm" /> + </item> + <item type="poi_military" order="0-"> + <icon src="military.xpm" /> + </item> + <item type="poi_mine" order="0-"> + <icon src="mine.xpm" /> + </item> + <item type="poi_nondangerous" order="0-"> + <icon src="nondangerous.xpm" /> + </item> + <item type="poi_oil_field" order="0-"> + <icon src="oil_field.xpm" /> + </item> + <item type="poi_personal_service" order="0-"> + <icon src="personal_service.xpm" /> + </item> + <item type="poi_pharmacy" order="0-"> + <icon src="pharmacy.xpm" /> + </item> + <item type="poi_post" order="0-"> + <icon src="post.xpm" /> + </item> + <item type="poi_public_office" order="0-"> + <icon src="public_office.xpm" /> + </item> + <item type="poi_repair_service" order="0-"> + <icon src="repair_service.xpm" /> + </item> + <item type="poi_resort" order="0-"> + <icon src="resort.xpm" /> + </item> + <item type="poi_rest_room" order="0-"> + <icon src="rest_room.xpm" /> + </item> + <item type="poi_restaurant" order="0-"> + <icon src="restaurant.xpm" /> + </item> + <item type="poi_restricted_area" order="0-"> + <icon src="restricted_area.xpm" /> + </item> + <item type="poi_restroom" order="0-"> + <icon src="restroom.xpm" /> + </item> + <item type="poi_sailing" order="0-"> + <icon src="sailing.xpm" /> + </item> + <item type="poi_scenic_area" order="0-"> + <icon src="scenic_area.xpm" /> + </item> + <item type="poi_school" order="0-"> + <icon src="school.xpm" /> + </item> + <item type="poi_service" order="0-"> + <icon src="service.xpm" /> + </item> + <item type="poi_shop_apparel" order="0-"> + <icon src="shop_apparel.xpm" /> + </item> + <item type="poi_shop_computer" order="0-"> + <icon src="shop_computer.xpm" /> + </item> + <item type="poi_shop_department" order="0-"> + <icon src="shop_department.xpm" /> + </item> + <item type="poi_shop_furnish" order="0-"> + <icon src="shop_furnish.xpm" /> + </item> + <item type="poi_shop_grocery" order="0-"> + <icon src="shop_grocery.xpm" /> + </item> + <item type="poi_shop_handg" order="0-"> + <icon src="shop_handg.xpm" /> + </item> + <item type="poi_shop_merchandise" order="0-"> + <icon src="shop_merchandise.xpm" /> + </item> + <item type="poi_shop_retail" order="0-"> + <icon src="shop_retail.xpm" /> + </item> + <item type="poi_shower" order="0-"> + <icon src="shower.xpm" /> + </item> + <item type="poi_skiing" order="0-"> + <icon src="skiing.xpm" /> + </item> + <item type="poi_social_service" order="0-"> + <icon src="social_service.xpm" /> + </item> + <item type="poi_sounding" order="0-"> + <icon src="sounding.xpm" /> + </item> + <item type="poi_sport" order="0-"> + <icon src="sport.xpm" /> + </item> + <item type="poi_stadium" order="0-"> + <icon src="stadium.xpm" /> + </item> + <item type="poi_subdivision" order="0-"> + <icon src="subdivision.xpm" /> + </item> + <item type="poi_swimming" order="0-"> + <icon src="swimming.xpm" /> + </item> + <item type="poi_telephone" order="0-"> + <icon src="telephone.xpm" /> + </item> + <item type="poi_theater" order="0-"> + <icon src="theater.xpm" /> + </item> + <item type="poi_tide" order="0-"> + <icon src="tide.xpm" /> + </item> + <item type="poi_tower" order="0-"> + <icon src="tower.xpm" /> + </item> + <item type="poi_trail" order="0-"> + <icon src="trail.xpm" /> + </item> + <item type="poi_truck_stop" order="0-"> + <icon src="truck_stop.xpm" /> + </item> + <item type="poi_tunnel" order="0-"> + <icon src="tunnel.xpm" /> + </item> + <item type="poi_wine" order="0-"> + <icon src="wine.xpm" /> + </item> + <item type="poi_worship" order="0-"> + <icon src="worship.xpm" /> + </item> + <item type="poi_wrecker" order="0-"> + <icon src="wrecker.xpm" /> + </item> + <item type="poi_zoo" order="0-"> + <icon src="zoo.xpm" /> + </item> + <item type="poi_picnic" order="0-"> + <icon src="picnic.xpm" /> + </item> + <item type="flats,scrub,military_zone,marine_poly,plantation,tundra" order="0-"> + <polygon color="#a0a0a0" /> + <label label_size="5" /> + </item> </layer> </layout> |
From: Alexander A. <za...@us...> - 2007-11-19 19:58:22
|
Update of /cvsroot/navit/navit/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7412 Modified Files: coord.h map.c map.h navit.c navit.h popup.c route.c route.h search.c search.h track.c transform.c transform.h xmlconfig.c Log Message: Create struct pcoord containing the projection. Use it to propagate destinations/positions to route code. Use it to create the navit's instance. Use it in search structs so when you have the targets coordinates you know what projection they are. - SDL have to be fixed, GTK uses coordinates for lists data, SDL not. Fix memory leak when using route_rect, it allocates map_selection but users didn't free it. search_list_town/search_list_streets allocate the coordinate but do not free it - fixed. Store and read the projections in/from destinations.txt. Index: popup.c =================================================================== RCS file: /cvsroot/navit/navit/src/popup.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** popup.c 19 Nov 2007 11:41:04 -0000 1.15 --- popup.c 19 Nov 2007 19:58:17 -0000 1.16 *************** *** 44,55 **** { struct navit *nav=data1; ! struct coord *c=data2; struct coord_geo g; char buffer[1024]; char buffer_geo[1024]; ! transform_to_geo(transform_get_projection(navit_get_trans(nav)), c, &g); transform_geo_text(&g, buffer_geo); sprintf(buffer,"Map Point %s", buffer_geo); ! navit_set_destination(nav, c, buffer); } --- 44,58 ---- { struct navit *nav=data1; ! struct pcoord *pc=data2; ! struct coord c; struct coord_geo g; char buffer[1024]; char buffer_geo[1024]; ! c.x = pc->x; ! c.y = pc->y; ! transform_to_geo(transform_get_projection(navit_get_trans(nav)), &c, &g); transform_geo_text(&g, buffer_geo); sprintf(buffer,"Map Point %s", buffer_geo); ! navit_set_destination(nav, pc, buffer); } *************** *** 76,80 **** { struct navit *nav=data1; ! struct coord *c=data2; dbg(0,"%p %p\n", nav, c); navit_set_position(nav, c); --- 79,83 ---- { struct navit *nav=data1; ! struct pcoord *c=data2; dbg(0,"%p %p\n", nav, c); navit_set_position(nav, c); *************** *** 212,216 **** } ! static struct coord c; void --- 215,219 ---- } ! static struct pcoord c; void *************** *** 220,233 **** char buffer[1024]; struct coord_geo g; popup=gui_popup_new(navit_get_gui(nav)); ! transform_reverse(navit_get_trans(nav), p, &c); ! men=popup_printf(popup, menu_type_submenu, "Point 0x%x 0x%x", c.x, c.y); popup_printf(men, menu_type_menu, "Screen %d %d", p->x, p->y); ! transform_to_geo(transform_get_projection(navit_get_trans(nav)), &c, &g); transform_geo_text(&g, buffer); popup_printf(men, menu_type_menu, "%s", buffer); popup_printf(men, menu_type_menu, "%f %f", g.lat, g.lng); dbg(0,"%p %p\n", nav, &c); popup_printf_cb(men, menu_type_menu, popup_set_position, nav, &c, "Set as position"); popup_printf_cb(men, menu_type_menu, popup_set_destination, nav, &c, "Set as destination"); --- 223,240 ---- char buffer[1024]; struct coord_geo g; + struct coord co; popup=gui_popup_new(navit_get_gui(nav)); ! transform_reverse(navit_get_trans(nav), p, &co); ! men=popup_printf(popup, menu_type_submenu, "Point 0x%x 0x%x", co.x, co.y); popup_printf(men, menu_type_menu, "Screen %d %d", p->x, p->y); ! transform_to_geo(transform_get_projection(navit_get_trans(nav)), &co, &g); transform_geo_text(&g, buffer); popup_printf(men, menu_type_menu, "%s", buffer); popup_printf(men, menu_type_menu, "%f %f", g.lat, g.lng); dbg(0,"%p %p\n", nav, &c); + c.pro = transform_get_projection(navit_get_trans(nav)); + c.x = co.x; + c.y = co.y; popup_printf_cb(men, menu_type_menu, popup_set_position, nav, &c, "Set as position"); popup_printf_cb(men, menu_type_menu, popup_set_destination, nav, &c, "Set as destination"); Index: coord.h =================================================================== RCS file: /cvsroot/navit/navit/src/coord.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** coord.h 9 Oct 2007 16:44:05 -0000 1.5 --- coord.h 19 Nov 2007 19:58:17 -0000 1.6 *************** *** 1,4 **** --- 1,5 ---- #ifndef NAVIT_COORD_H #define NAVIT_COORD_H + #include "projection.h" /*! A integer mercator coordinate */ *************** *** 8,11 **** --- 9,19 ---- }; + /*! A integer mercator coordinate carrying its projection */ + struct pcoord { + enum projection pro; + int x; /*!< X-Value */ + int y; /*!< Y-Value */ + }; + struct coord_rect { struct coord lu; Index: transform.h =================================================================== RCS file: /cvsroot/navit/navit/src/transform.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** transform.h 19 Nov 2007 10:41:32 -0000 1.6 --- transform.h 19 Nov 2007 19:58:18 -0000 1.7 *************** *** 8,11 **** --- 8,12 ---- enum projection; struct coord; + struct pcoord; struct coord_geo; struct coord_rect; *************** *** 26,30 **** void transform_set_size(struct transformation *t, int width, int height); void transform_get_size(struct transformation *t, int *width, int *height); ! void transform_setup(struct transformation *t, struct coord *c, int scale, int angle); void transform_setup_source_rect_limit(struct transformation *t, struct coord *center, int limit); void transform_setup_source_rect(struct transformation *t); --- 27,31 ---- void transform_set_size(struct transformation *t, int width, int height); void transform_get_size(struct transformation *t, int *width, int *height); ! void transform_setup(struct transformation *t, struct pcoord *c, int scale, int angle); void transform_setup_source_rect_limit(struct transformation *t, struct coord *center, int limit); void transform_setup_source_rect(struct transformation *t); Index: search.h =================================================================== RCS file: /cvsroot/navit/navit/src/search.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** search.h 9 Oct 2007 16:48:41 -0000 1.3 --- search.h 19 Nov 2007 19:58:18 -0000 1.4 *************** *** 6,32 **** #endif struct search_list_country { ! struct item item; ! char *car; ! char *iso2; ! char *iso3; ! char *name; }; struct search_list_town { struct item item; ! struct item itemt; ! struct coord *c; char *postal; ! char *name; }; struct search_list_street { struct item item; ! struct coord *c; ! char *name; }; struct search_list_result { ! struct coord *c; struct search_list_country *country; struct search_list_town *town; --- 6,32 ---- #endif struct search_list_country { ! struct item item; ! char *car; ! char *iso2; ! char *iso3; ! char *name; }; struct search_list_town { struct item item; ! struct item itemt; ! struct pcoord *c; char *postal; ! char *name; }; struct search_list_street { struct item item; ! struct pcoord *c; ! char *name; }; struct search_list_result { ! struct pcoord *c; struct search_list_country *country; struct search_list_town *town; Index: map.c =================================================================== RCS file: /cvsroot/navit/navit/src/map.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** map.c 6 Nov 2007 22:43:18 -0000 1.7 --- map.c 19 Nov 2007 19:58:17 -0000 1.8 *************** *** 211,212 **** --- 211,223 ---- g_free(this); } + + void + map_selection_destroy(struct map_selection *sel) + { + struct map_selection *ms; + while (sel) { + ms = sel->next; + g_free(sel); + sel = ms; + } + } Index: search.c =================================================================== RCS file: /cvsroot/navit/navit/src/search.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** search.c 5 Nov 2007 17:52:39 -0000 1.8 --- search.c 19 Nov 2007 19:58:18 -0000 1.9 *************** *** 144,149 **** ret->postal=map_convert_string(item->map,attr.u.str); if (item_coord_get(item, &c, 1)) { ! ret->c=g_new(struct coord, 1); ! *(ret->c)=c; } return ret; --- 144,151 ---- ret->postal=map_convert_string(item->map,attr.u.str); if (item_coord_get(item, &c, 1)) { ! ret->c=g_new(struct pcoord, 1); ! ret->c->x=c.x; ! ret->c->y=c.y; ! ret->c->pro = map_projection(item->map); } return ret; *************** *** 155,158 **** --- 157,162 ---- map_convert_free(this_->name); map_convert_free(this_->postal); + if (this_->c) + g_free(this_->c); g_free(this_); } *************** *** 169,174 **** ret->name=map_convert_string(item->map, attr.u.str); if (item_coord_get(item, &c, 1)) { ! ret->c=g_new(struct coord, 1); ! *(ret->c)=c; } return ret; --- 173,180 ---- ret->name=map_convert_string(item->map, attr.u.str); if (item_coord_get(item, &c, 1)) { ! ret->c=g_new(struct pcoord, 1); ! ret->c->x=c.x; ! ret->c->y=c.y; ! ret->c->pro = map_projection(item->map); } return ret; *************** *** 179,182 **** --- 185,190 ---- { map_convert_free(this_->name); + if (this_->c) + g_free(this_->c); g_free(this_); } Index: transform.c =================================================================== RCS file: /cvsroot/navit/navit/src/transform.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** transform.c 19 Nov 2007 10:41:32 -0000 1.8 --- transform.c 19 Nov 2007 19:58:18 -0000 1.9 *************** *** 262,269 **** void ! transform_setup(struct transformation *t, struct coord *c, int scale, int angle) { ! t->center=*c; ! t->scale=scale; transform_set_angle(t, angle); } --- 262,271 ---- void ! transform_setup(struct transformation *t, struct pcoord *c, int scale, int angle) { ! t->pro=c->pro; ! t->center.x=c->x; ! t->center.y=c->y; ! t->scale=scale; transform_set_angle(t, angle); } Index: route.c =================================================================== RCS file: /cvsroot/navit/navit/src/route.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** route.c 19 Nov 2007 10:41:32 -0000 1.20 --- route.c 19 Nov 2007 19:58:17 -0000 1.21 *************** *** 112,116 **** }; ! static struct route_info * route_find_nearest_street(struct mapset *ms, struct coord *c); static struct route_graph_point *route_graph_get_point(struct route_graph *this, struct coord *c); static void route_graph_update(struct route *this); --- 112,116 ---- }; ! static struct route_info * route_find_nearest_street(struct mapset *ms, struct pcoord *c); static struct route_graph_point *route_graph_get_point(struct route_graph *this, struct coord *c); static void route_graph_update(struct route *this); *************** *** 212,216 **** void ! route_set_position(struct route *this, struct coord *pos) { if (this->pos) --- 212,216 ---- void ! route_set_position(struct route *this, struct pcoord *pos) { if (this->pos) *************** *** 249,252 **** --- 249,253 ---- } + /* This is unused - check and remove from graphics.c too */ struct map_selection *route_selection; *************** *** 322,326 **** void ! route_set_destination(struct route *this, struct coord *dst) { profile(0,NULL); --- 323,327 ---- void ! route_set_destination(struct route *this, struct pcoord *dst) { profile(0,NULL); *************** *** 1005,1013 **** static struct route_info * ! route_find_nearest_street(struct mapset *ms, struct coord *c) { struct route_info *ret=NULL; int max_dist=1000; ! struct map_selection *sel=route_rect(18, c, c, 0, max_dist); int dist,pos; struct mapset_handle *h; --- 1006,1014 ---- static struct route_info * ! route_find_nearest_street(struct mapset *ms, struct pcoord *pc) { struct route_info *ret=NULL; int max_dist=1000; ! struct map_selection *sel; int dist,pos; struct mapset_handle *h; *************** *** 1017,1028 **** struct coord lp, sc[1000]; struct street_data *sd; ! h=mapset_open(ms); ! while ((m=mapset_next(h,1))) { mr=map_rect_new(m, sel); ! while ((item=map_rect_get_item(mr))) { if (item->type >= type_street_0 && item->type <= type_ferry) { sd=street_get_data(item); ! dist=transform_distance_polyline_sq(sd->c, sd->count, c, &lp, &pos); if (!ret || dist < ret->dist) { if (ret) { --- 1018,1033 ---- struct coord lp, sc[1000]; struct street_data *sd; + struct coord c; ! c.x = pc->x; ! c.y = pc->y; ! sel = route_rect(18, &c, &c, 0, max_dist); ! h=mapset_open(ms); ! while ((m=mapset_next(h,1))) { mr=map_rect_new(m, sel); ! while ((item=map_rect_get_item(mr))) { if (item->type >= type_street_0 && item->type <= type_ferry) { sd=street_get_data(item); ! dist=transform_distance_polyline_sq(sd->c, sd->count, &c, &lp, &pos); if (!ret || dist < ret->dist) { if (ret) { *************** *** 1031,1035 **** } ret=g_new(struct route_info, 1); ! ret->c=*c; ret->lp=lp; ret->pos=pos; --- 1036,1040 ---- } ret=g_new(struct route_info, 1); ! ret->c=c; ret->lp=lp; ret->pos=pos; *************** *** 1039,1050 **** dbg(1,"dist=%d id 0x%x 0x%x pos=%d\n", dist, item->id_hi, item->id_lo, pos); } else ! street_data_free(sd); } else while (item_coord_get(item, &sc[0], 1)); ! } map_rect_destroy(mr); ! } ! mapset_close(h); ! return ret; } --- 1044,1056 ---- dbg(1,"dist=%d id 0x%x 0x%x pos=%d\n", dist, item->id_hi, item->id_lo, pos); } else ! street_data_free(sd); } else while (item_coord_get(item, &sc[0], 1)); ! } map_rect_destroy(mr); ! } ! mapset_close(h); ! map_selection_destroy(sel); ! return ret; } Index: route.h =================================================================== RCS file: /cvsroot/navit/navit/src/route.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** route.h 9 Oct 2007 19:03:06 -0000 1.10 --- route.h 19 Nov 2007 19:58:18 -0000 1.11 *************** *** 46,53 **** int route_set_speed(struct route *this, enum item_type type, int value); int route_contains(struct route *this, struct item *item); ! void route_set_position(struct route *this, struct coord *pos); void route_set_position_from_tracking(struct route *this, struct tracking *tracking); struct map_selection *route_rect(int order, struct coord *c1, struct coord *c2, int rel, int abs); ! void route_set_destination(struct route *this, struct coord *dst); struct route_path_handle *route_path_open(struct route *this); struct route_path_segment *route_path_get_segment(struct route_path_handle *h); --- 46,53 ---- int route_set_speed(struct route *this, enum item_type type, int value); int route_contains(struct route *this, struct item *item); ! void route_set_position(struct route *this, struct pcoord *pos); void route_set_position_from_tracking(struct route *this, struct tracking *tracking); struct map_selection *route_rect(int order, struct coord *c1, struct coord *c2, int rel, int abs); ! void route_set_destination(struct route *this, struct pcoord *dst); struct route_path_handle *route_path_open(struct route *this); struct route_path_segment *route_path_get_segment(struct route_path_handle *h); Index: navit.h =================================================================== RCS file: /cvsroot/navit/navit/src/navit.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** navit.h 4 Nov 2007 10:04:47 -0000 1.18 --- navit.h 19 Nov 2007 19:58:17 -0000 1.19 *************** *** 12,15 **** --- 12,16 ---- struct color; struct coord; + struct pcoord; struct displaylist; struct graphics; *************** *** 36,45 **** void navit_zoom_in(struct navit *this_, int factor); void navit_zoom_out(struct navit *this_, int factor); ! struct navit *navit_new(struct coord *center, enum projection pro, int zoom); void navit_set_gui(struct navit *this_, struct gui *gui, char *type); void navit_set_graphics(struct navit *this_, struct graphics *gra, char *type); struct graphics *navit_get_graphics(struct navit *this_); ! void navit_set_destination(struct navit *this_, struct coord *c, char *description); ! void navit_add_bookmark(struct navit *this_, struct coord *c, char *description); void navit_add_menu_layouts(struct navit *this_, struct menu *men); void navit_add_menu_layout(struct navit *this_, struct menu *men); --- 37,46 ---- void navit_zoom_in(struct navit *this_, int factor); void navit_zoom_out(struct navit *this_, int factor); ! struct navit *navit_new(struct pcoord *center, int zoom); void navit_set_gui(struct navit *this_, struct gui *gui, char *type); void navit_set_graphics(struct navit *this_, struct graphics *gra, char *type); struct graphics *navit_get_graphics(struct navit *this_); ! void navit_set_destination(struct navit *this_, struct pcoord *c, char *description); ! void navit_add_bookmark(struct navit *this_, struct pcoord *c, char *description); void navit_add_menu_layouts(struct navit *this_, struct menu *men); void navit_add_menu_layout(struct navit *this_, struct menu *men); *************** *** 64,68 **** void navit_toggle_tracking(struct navit *this_); void navit_toggle_orient_north(struct navit *this_); ! void navit_set_position(struct navit *this_, struct coord *c); struct navit_vehicle *navit_add_vehicle(struct navit *this_, struct vehicle *v, const char *name, struct color *c, int update, int follow); void navit_add_vehicle_cb(struct navit *this_, struct callback *cb); --- 65,69 ---- void navit_toggle_tracking(struct navit *this_); void navit_toggle_orient_north(struct navit *this_); ! void navit_set_position(struct navit *this_, struct pcoord *c); struct navit_vehicle *navit_add_vehicle(struct navit *this_, struct vehicle *v, const char *name, struct color *c, int update, int follow); void navit_add_vehicle_cb(struct navit *this_, struct callback *cb); Index: xmlconfig.c =================================================================== RCS file: /cvsroot/navit/navit/src/xmlconfig.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** xmlconfig.c 4 Nov 2007 10:04:47 -0000 1.18 --- xmlconfig.c 19 Nov 2007 19:58:18 -0000 1.19 *************** *** 194,198 **** const char *value; int zoom=0; ! struct coord c; enum projection pro=projection_mg; --- 194,199 ---- const char *value; int zoom=0; ! struct pcoord c; ! struct coord co; enum projection pro=projection_mg; *************** *** 203,211 **** zoom=256; value=find_attribute(state, "center", 0); ! if (! value || ! coord_parse(value, pro, &c)) { c.x=1300000; c.y=7000000; } ! state->element_object = navit_new(&c, pro, zoom); if (! state->element_object) return 0; --- 204,215 ---- zoom=256; value=find_attribute(state, "center", 0); ! if (! value || ! coord_parse(value, pro, &co)) { c.x=1300000; c.y=7000000; } ! c.x = co.x; ! c.y = co.y; ! c.pro = pro; ! state->element_object = navit_new(&c, zoom); if (! state->element_object) return 0; Index: map.h =================================================================== RCS file: /cvsroot/navit/navit/src/map.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** map.h 9 Oct 2007 16:48:36 -0000 1.6 --- map.h 19 Nov 2007 19:58:17 -0000 1.7 *************** *** 51,54 **** --- 51,55 ---- struct item *map_search_get_item(struct map_search *this); void map_search_destroy(struct map_search *this); + void map_selection_destroy(struct map_selection *sel); /* end of prototypes */ Index: navit.c =================================================================== RCS file: /cvsroot/navit/navit/src/navit.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** navit.c 19 Nov 2007 10:41:32 -0000 1.38 --- navit.c 19 Nov 2007 19:58:17 -0000 1.39 *************** *** 1,3 **** --- 1,4 ---- #include <stdio.h> + #include <stdlib.h> #include <signal.h> #include <string.h> *************** *** 265,269 **** struct navit * ! navit_new(struct coord *center, enum projection pro, int zoom) { struct navit *this_=g_new0(struct navit, 1); --- 266,270 ---- struct navit * ! navit_new(struct pcoord *center, int zoom) { struct navit *this_=g_new0(struct navit, 1); *************** *** 285,290 **** this_->tracking_flag=1; this_->trans=transform_new(); - transform_set_projection(this_->trans, pro); - transform_setup(this_->trans, center, zoom, 0); this_->displaylist=graphics_displaylist_new(); --- 286,289 ---- *************** *** 377,381 **** static void ! navit_append_coord(struct navit *this_, char *file, struct coord *c, char *type, char *description, struct menu *rmen, GHashTable *h, void (*callback)(struct menu *menu, void *data1, void *data2)) { FILE *f; --- 376,380 ---- static void ! navit_append_coord(struct navit *this_, char *file, struct pcoord *c, char *type, char *description, struct menu *rmen, GHashTable *h, void (*callback)(struct menu *menu, void *data1, void *data2)) { FILE *f; *************** *** 387,391 **** offset=ftell(f); if (c) ! fprintf(f,"0x%x 0x%x type=%s label=\"%s\"\n", c->x, c->y, type, description); else fprintf(f,"\n"); --- 386,390 ---- offset=ftell(f); if (c) ! fprintf(f,"p=%u 0x%x 0x%x type=%s label=\"%s\"\n", c->pro, c->x, c->y, type, description); else fprintf(f,"\n"); *************** *** 400,417 **** static int ! parse_line(FILE *f, char *buffer, char **name, struct coord *c) { int pos; char *s,*i; *name=NULL; if (! fgets(buffer, 2048, f)) return -3; ! pos=coord_parse(buffer, projection_mg, c); ! if (! pos) return -2; ! if (!buffer[pos] || buffer[pos] == '\n') return -1; ! buffer[strlen(buffer)-1]='\0'; ! s=buffer+pos+1; if (!strncmp(s,"type=", 5)) { i=index(s, '"'); --- 399,425 ---- static int ! parse_line(FILE *f, char *buffer, char **name, struct pcoord *c) { int pos; char *s,*i; + struct coord co; + char *cp, *ep; + enum projection pro = projection_mg; *name=NULL; if (! fgets(buffer, 2048, f)) return -3; ! cp = buffer; ! if (*cp == 'p') { ! pro = strtol(cp+2, &ep, 10); ! cp = ep; ! cp += strcspn(cp, " \t"); ! } ! pos=coord_parse(cp, pro, &co); ! if (!pos) return -2; ! if (!cp[pos] || cp[pos] == '\n') return -1; ! cp[strlen(cp)-1]='\0'; ! s=cp+pos+1; if (!strncmp(s,"type=", 5)) { i=index(s, '"'); *************** *** 424,427 **** --- 432,438 ---- } *name=s; + c->x = co.x; + c->y = co.y; + c->pro = pro; return pos; } *************** *** 433,437 **** FILE *f; char *name, *description, buffer[2048]; ! struct coord c; f=fopen(file, "r"); --- 444,448 ---- FILE *f; char *name, *description, buffer[2048]; ! struct pcoord c; f=fopen(file, "r"); *************** *** 462,477 **** void ! navit_set_destination(struct navit *this_, struct coord *c, char *description) { navit_append_coord(this_, "destination.txt", c, "former_destination", description, this_->destinations, NULL, navit_set_destination_from_destination); if (this_->route) { ! route_set_destination(this_->route, c); ! navit_draw(this_); ! } } void ! navit_add_bookmark(struct navit *this_, struct coord *c, char *description) { navit_append_coord(this_,"bookmark.txt", c, "bookmark", description, this_->bookmarks, this_->bookmarks_hash, navit_set_destination_from_bookmark); --- 473,488 ---- void ! navit_set_destination(struct navit *this_, struct pcoord *c, char *description) { navit_append_coord(this_, "destination.txt", c, "former_destination", description, this_->destinations, NULL, navit_set_destination_from_destination); if (this_->route) { ! route_set_destination(this_->route, c); ! navit_draw(this_); ! } } void ! navit_add_bookmark(struct navit *this_, struct pcoord *c, char *description) { navit_append_coord(this_,"bookmark.txt", c, "bookmark", description, this_->bookmarks, this_->bookmarks_hash, navit_set_destination_from_bookmark); *************** *** 565,569 **** FILE *f; char buffer[2048]; ! struct coord c; char *name; int offset=0; --- 576,580 ---- FILE *f; char buffer[2048]; ! struct pcoord c; char *name; int offset=0; *************** *** 737,745 **** navit_window_items_click(struct navit *this_, struct navit_window_items *nwi, char **col) { ! struct coord c; char *description; dbg(0,"enter col=%s,%s,%s,%s,%s\n", col[0], col[1], col[2], col[3], col[4]); sscanf(col[4], "0x%x,0x%x", &c.x, &c.y); dbg(0,"0x%x,0x%x\n", c.x, c.y); description=g_strdup_printf("%s %s", nwi->name, col[3]); --- 748,758 ---- navit_window_items_click(struct navit *this_, struct navit_window_items *nwi, char **col) { ! struct pcoord c; char *description; + // FIXME dbg(0,"enter col=%s,%s,%s,%s,%s\n", col[0], col[1], col[2], col[3], col[4]); sscanf(col[4], "0x%x,0x%x", &c.x, &c.y); + c.pro = projection_mg; dbg(0,"0x%x,0x%x\n", c.x, c.y); description=g_strdup_printf("%s %s", nwi->name, col[3]); *************** *** 1005,1008 **** --- 1018,1022 ---- struct point pnt; struct coord *cursor_c=cursor_pos_get(cursor); + struct pcoord pc; int dir=cursor_get_dir(cursor); int speed=cursor_get_speed(cursor); *************** *** 1018,1021 **** --- 1032,1036 ---- pro=vehicle_projection(this_->vehicle->vehicle); + /* This transform is useless cursor and vehicle are in the same projection */ if (!transform(this_->trans, pro, cursor_c, &pnt) || !transform_within_border(this_->trans, &pnt, border)) { if (!this_->cursor_flag) *************** *** 1039,1044 **** } } else { ! if (this_->route && this_->vehicle->update_curr == 1) ! route_set_position(this_->route, cursor_c); } if (this_->route && this_->vehicle->update_curr == 1) --- 1054,1063 ---- } } else { ! if (this_->route && this_->vehicle->update_curr == 1) { ! pc.pro = pro; ! pc.x = cursor_c->x; ! pc.y = cursor_c->y; ! route_set_position(this_->route, &pc); ! } } if (this_->route && this_->vehicle->update_curr == 1) *************** *** 1060,1064 **** void ! navit_set_position(struct navit *this_, struct coord *c) { if (this_->route) { --- 1079,1083 ---- void ! navit_set_position(struct navit *this_, struct pcoord *c) { if (this_->route) { Index: track.c =================================================================== RCS file: /cvsroot/navit/navit/src/track.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** track.c 5 Nov 2007 17:52:39 -0000 1.14 --- track.c 19 Nov 2007 19:58:18 -0000 1.15 *************** *** 135,142 **** } else while (item_coord_get(item, &c, 1)); ! } map_rect_destroy(mr); ! } ! mapset_close(h); dbg(1, "exit\n"); #if 0 --- 135,143 ---- } else while (item_coord_get(item, &c, 1)); ! } map_rect_destroy(mr); ! } ! mapset_close(h); ! map_selection_destroy(sel); dbg(1, "exit\n"); #if 0 |
From: Alexander A. <za...@us...> - 2007-11-19 19:58:18
|
Update of /cvsroot/navit/navit/src/gui/sdl In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7412/gui/sdl Modified Files: sdl_events.cpp Log Message: Create struct pcoord containing the projection. Use it to propagate destinations/positions to route code. Use it to create the navit's instance. Use it in search structs so when you have the targets coordinates you know what projection they are. - SDL have to be fixed, GTK uses coordinates for lists data, SDL not. Fix memory leak when using route_rect, it allocates map_selection but users didn't free it. search_list_town/search_list_streets allocate the coordinate but do not free it - fixed. Store and read the projections in/from destinations.txt. Index: sdl_events.cpp =================================================================== RCS file: /cvsroot/navit/navit/src/gui/sdl/sdl_events.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** sdl_events.cpp 16 Nov 2007 15:04:07 -0000 1.15 --- sdl_events.cpp 19 Nov 2007 19:58:19 -0000 1.16 *************** *** 29,35 **** void route_to(int x,int y){ ! struct coord pos; pos.x=x; pos.y=y; using namespace CEGUI; extern struct navit *sdl_gui_navit; --- 29,37 ---- void route_to(int x,int y){ ! struct pcoord pos; pos.x=x; pos.y=y; + /* FIXME: Get projection from list like x,y or use pcoord from search directly */ + pos.pro = projection_mg; using namespace CEGUI; extern struct navit *sdl_gui_navit; |
From: Alexander A. <za...@us...> - 2007-11-19 19:58:17
|
Update of /cvsroot/navit/navit/src/gui/gtk In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7412/gui/gtk Modified Files: destination.c Log Message: Create struct pcoord containing the projection. Use it to propagate destinations/positions to route code. Use it to create the navit's instance. Use it in search structs so when you have the targets coordinates you know what projection they are. - SDL have to be fixed, GTK uses coordinates for lists data, SDL not. Fix memory leak when using route_rect, it allocates map_selection but users didn't free it. search_list_town/search_list_streets allocate the coordinate but do not free it - fixed. Store and read the projections in/from destinations.txt. Index: destination.c =================================================================== RCS file: /cvsroot/navit/navit/src/gui/gtk/destination.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** destination.c 5 Nov 2007 20:21:29 -0000 1.8 --- destination.c 19 Nov 2007 19:58:19 -0000 1.9 *************** *** 13,16 **** --- 13,17 ---- #include "country.h" #include "search.h" + #include "projection.h" #define COL_COUNT 8 *************** *** 35,45 **** static void button_map(GtkWidget *widget, struct search_param *search) { ! struct coord *c=NULL; GtkTreeIter iter; if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter)) return; gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1); ! if (c) ! navit_set_center(search->nav, c); } --- 36,50 ---- static void button_map(GtkWidget *widget, struct search_param *search) { ! struct pcoord *c=NULL; ! struct coord co; GtkTreeIter iter; if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter)) return; gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1); ! if (c) { ! co.x = c->x; ! co.y = c->y; ! navit_set_center(search->nav, &co); ! } } *************** *** 60,64 **** static void button_destination(GtkWidget *widget, struct search_param *search) { ! struct coord *c=NULL; GtkTreeIter iter; char *desc; --- 65,69 ---- static void button_destination(GtkWidget *widget, struct search_param *search) { ! struct pcoord *c=NULL; GtkTreeIter iter; char *desc; |
From: Alexander A. <za...@us...> - 2007-11-19 11:41:03
|
Update of /cvsroot/navit/navit/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv32708 Modified Files: popup.c Log Message: make popup coordinate static Index: popup.c =================================================================== RCS file: /cvsroot/navit/navit/src/popup.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** popup.c 5 Nov 2007 09:22:04 -0000 1.14 --- popup.c 19 Nov 2007 11:41:04 -0000 1.15 *************** *** 212,216 **** } ! struct coord c; void --- 212,216 ---- } ! static struct coord c; void |
From: Alexander A. <za...@us...> - 2007-11-19 11:25:07
|
Update of /cvsroot/navit/navit In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30494 Modified Files: configure.in Log Message: Correctly check for GNU g++ and set CXXFLAGS Index: configure.in =================================================================== RCS file: /cvsroot/navit/navit/configure.in,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** configure.in 14 Nov 2007 20:53:29 -0000 1.54 --- configure.in 19 Nov 2007 11:25:08 -0000 1.55 *************** *** 11,16 **** fi AC_PROG_CXX ! if eval "test x$G++ = xyes"; then ! CFLAGS="$CFLAGS -Wall -Wcast-align -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wreturn-type -D_GNU_SOURCE" fi --- 11,16 ---- fi AC_PROG_CXX ! if eval "test x$GXX = xyes"; then ! CXXFLAGS="$CXXFLAGS -Wall -Wcast-align -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wreturn-type -D_GNU_SOURCE" fi |
From: Alexander A. <za...@us...> - 2007-11-19 10:41:33
|
Update of /cvsroot/navit/navit/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26572 Modified Files: compass.c navit.c route.c transform.c transform.h Log Message: Teach transform_distance about other projections Index: compass.c =================================================================== RCS file: /cvsroot/navit/navit/src/compass.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** compass.c 9 Oct 2007 16:57:38 -0000 1.8 --- compass.c 19 Nov 2007 10:41:32 -0000 1.9 *************** *** 100,104 **** p.x=8; p.y=72; ! distance=transform_distance(pos, dest)/1000.0; if (distance >= 100) sprintf(buffer,"%.0f km", distance); --- 100,104 ---- p.x=8; p.y=72; ! distance=transform_distance(projection_mg, pos, dest)/1000.0; if (distance >= 100) sprintf(buffer,"%.0f km", distance); Index: navit.c =================================================================== RCS file: /cvsroot/navit/navit/src/navit.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** navit.c 16 Nov 2007 09:27:40 -0000 1.37 --- navit.c 19 Nov 2007 10:41:32 -0000 1.38 *************** *** 802,806 **** if (! item_attr_get(item, attr_label, &attr)) attr.u.str=""; ! idist=transform_distance(center, &c); if (idist < dist) { get_direction(dirbuf, transform_get_angle_delta(center, &c, 0), 1); --- 802,806 ---- if (! item_attr_get(item, attr_label, &attr)) attr.u.str=""; ! idist=transform_distance(map_projection(item->map), center, &c); if (idist < dist) { get_direction(dirbuf, transform_get_angle_delta(center, &c, 0), 1); Index: transform.h =================================================================== RCS file: /cvsroot/navit/navit/src/transform.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** transform.h 9 Oct 2007 16:48:43 -0000 1.5 --- transform.h 19 Nov 2007 10:41:32 -0000 1.6 *************** *** 34,38 **** void transform_geo_text(struct coord_geo *g, char *buffer); double transform_scale(int y); ! double transform_distance(struct coord *c1, struct coord *c2); int transform_distance_sq(struct coord *c1, struct coord *c2); int transform_distance_line_sq(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt); --- 34,38 ---- void transform_geo_text(struct coord_geo *g, char *buffer); double transform_scale(int y); ! double transform_distance(enum projection pro, struct coord *c1, struct coord *c2); int transform_distance_sq(struct coord *c1, struct coord *c2); int transform_distance_line_sq(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt); Index: transform.c =================================================================== RCS file: /cvsroot/navit/navit/src/transform.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** transform.c 30 Oct 2007 11:31:15 -0000 1.7 --- transform.c 19 Nov 2007 10:41:32 -0000 1.8 *************** *** 355,358 **** --- 355,389 ---- } + #define TWOPI (M_PI*2) + #define GC2RAD(c) ((c) * TWOPI/(1<<24)) + #define minf(a,b) ((a) < (b) ? (a) : (b)) + + static double + transform_distance_garmin(struct coord *c1, struct coord *c2) + { + static const int earth_radius = 6371*1000; //m change accordingly + // static const int earth_radius = 3960; //miles + + //Point 1 cords + float lat1 = GC2RAD(c1->y); + float long1 = GC2RAD(c1->x); + + //Point 2 cords + float lat2 = GC2RAD(c2->y); + float long2 = GC2RAD(c2->x); + + //Haversine Formula + float dlong = long2-long1; + float dlat = lat2-lat1; + + float sinlat = sinf(dlat/2); + float sinlong = sinf(dlong/2); + + float a=(sinlat*sinlat)+cosf(lat1)*cosf(lat2)*(sinlong*sinlong); + float c=2*asinf(minf(1,sqrt(a))); + + return roundf(earth_radius*c); + } + double transform_scale(int y) *************** *** 372,377 **** double ! transform_distance(struct coord *c1, struct coord *c2) { #ifndef AVOID_FLOAT double dx,dy,scale=transform_scale((c1->y+c2->y)/2); --- 403,409 ---- double ! transform_distance(enum projection pro, struct coord *c1, struct coord *c2) { + if (pro == projection_mg) { #ifndef AVOID_FLOAT double dx,dy,scale=transform_scale((c1->y+c2->y)/2); *************** *** 408,411 **** --- 440,449 ---- } #endif + } else if (pro == projection_garmin) { + return transform_distance_garmin(c1, c2); + } else { + printf("Unknown projection: %d\n", pro); + return 0; + } } Index: route.c =================================================================== RCS file: /cvsroot/navit/navit/src/route.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** route.c 28 Oct 2007 11:00:53 -0000 1.19 --- route.c 19 Nov 2007 10:41:32 -0000 1.20 *************** *** 668,672 **** s_pnt=route_graph_add_point(this,&l); while (item_coord_get(item, &c, 1)) { ! len+=transform_distance(&l, &c); l=c; } --- 668,672 ---- s_pnt=route_graph_add_point(this,&l); while (item_coord_get(item, &c, 1)) { ! len+=transform_distance(map_projection(item->map), &l, &c); l=c; } *************** *** 698,701 **** --- 698,702 ---- struct coord *c,*l; int ret=0; + struct street_data *street; dbg(2,"enter pos=%p dst=%p dir=%d\n", pos, dst, dir); *************** *** 705,712 **** return -1; } l=route_info_get(h); while ((c=route_info_get(h))) { dbg(3,"c=%p\n", c); ! ret+=transform_distance(c, l); l=c; } --- 706,714 ---- return -1; } + street = pos ? pos->street : dst->street; l=route_info_get(h); while ((c=route_info_get(h))) { dbg(3,"c=%p\n", c); ! ret+=transform_distance(map_projection(street->item.map), c, l); l=c; } |