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: <sl...@us...> - 2014-07-07 14:28:11
|
Revision: 5806 http://sourceforge.net/p/navit/code/5806 Author: sleske Date: 2014-07-07 14:28:09 +0000 (Mon, 07 Jul 2014) Log Message: ----------- Refactor:maptool:Introduce struct files_relation_processing to simplify file handling during relation processing. Modified Paths: -------------- trunk/navit/navit/maptool/maptool.c trunk/navit/navit/maptool/maptool.h trunk/navit/navit/maptool/osm.c Modified: trunk/navit/navit/maptool/maptool.c =================================================================== --- trunk/navit/navit/maptool/maptool.c 2014-07-07 14:27:49 UTC (rev 5805) +++ trunk/navit/navit/maptool/maptool.c 2014-07-07 14:28:09 UTC (rev 5806) @@ -116,7 +116,38 @@ #endif } +static struct files_relation_processing * +files_relation_processing_new(FILE *line2poi, char *suffix) { + struct files_relation_processing *result = g_new(struct files_relation_processing, 1); + result->ways_in=tempfile(suffix,"ways_split",0); + result->ways_out=tempfile(suffix,"ways_split_relproc_tmp",1); + result->nodes_in=tempfile(suffix,"nodes",0); + result->nodes_out=tempfile(suffix,"nodes_relproc_tmp",1); + result->nodes2_in=NULL; + result->nodes2_out=NULL; + if(line2poi) { + result->nodes2_in=tempfile(suffix,"way2poi_result",0); + result->nodes2_out=tempfile(suffix,"way2poi_result_relproc_tmp",1); + } + return result; +} +static void +files_relation_processing_destroy(struct files_relation_processing *files_relproc, char *suffix) { + fclose(files_relproc->ways_in); + fclose(files_relproc->nodes_in); + fclose(files_relproc->ways_out); + fclose(files_relproc->nodes_out); + tempfile_rename(suffix,"ways_split_relproc_tmp","ways_split"); + tempfile_rename(suffix,"nodes_relproc_tmp","nodes"); + if(files_relproc->nodes2_in) { + fclose(files_relproc->nodes2_in); + fclose(files_relproc->nodes2_out); + tempfile_rename(suffix,"way2poi_result_relproc_tmp","way2poi_result"); + } + g_free(files_relproc); +} + static struct plugins *plugins; static void add_plugin(char *path) @@ -916,74 +947,25 @@ tempfile_unlink(suffix,"ways_split_index"); } if (p.process_relations && p.process_ways && p.process_nodes && start_phase(&p,"processing associated street relations")) { - FILE *ways_in=tempfile(suffix,"ways_split",0); - FILE *ways_out=tempfile(suffix,"ways_split_as",1); - FILE *nodes_in=tempfile(suffix,"nodes",0); - FILE *nodes_out=tempfile(suffix,"nodes_as",1); - FILE *nodes2_in=NULL; - FILE *nodes2_out=NULL; - if(p.osm.line2poi) { - nodes2_in=tempfile(suffix,"way2poi_result",0); - nodes2_out=tempfile(suffix,"way2poi_result_as",1); - } + struct files_relation_processing *files_relproc = files_relation_processing_new(p.osm.line2poi, suffix); p.osm.associated_streets=tempfile(suffix,"associated_streets",0); - process_associated_streets(p.osm.associated_streets, ways_in, ways_out, nodes_in, nodes_out, nodes2_in, nodes2_out); - fclose(ways_in); - fclose(nodes_in); - fclose(ways_out); - fclose(nodes_out); + process_associated_streets(p.osm.associated_streets, files_relproc); + fclose(p.osm.associated_streets); - tempfile_rename(suffix,"ways_split","ways_split_pre_as"); - tempfile_rename(suffix,"nodes","nodes_pre_as"); - tempfile_rename(suffix,"ways_split_as","ways_split"); - tempfile_rename(suffix,"nodes_as","nodes"); - if(p.osm.line2poi) { - fclose(nodes2_in); - fclose(nodes2_out); - tempfile_rename(suffix,"way2poi_result","way2poi_result_pre_as"); - tempfile_rename(suffix,"way2poi_result_as","way2poi_result"); - } - tempfile_unlink(suffix,"ways_split_pre_as"); - tempfile_unlink(suffix,"nodes_pre_as"); - tempfile_unlink(suffix,"way2poi_result_pre_as"); + files_relation_processing_destroy(files_relproc, suffix); if(!p.keep_tmpfiles) { tempfile_unlink(suffix,"associated_streets"); } } - // FIXME: c&p if (p.process_relations && p.process_ways && p.process_nodes && start_phase(&p,"processing house number interpolations")) { - FILE *ways_in=tempfile(suffix,"ways_split",0); - FILE *ways_out=tempfile(suffix,"ways_split_hn_interpol",1); - FILE *nodes_in=tempfile(suffix,"nodes",0); - FILE *nodes_out=tempfile(suffix,"nodes_hn_interpol",1); - FILE *nodes2_in=NULL; - FILE *nodes2_out=NULL; - if(p.osm.line2poi) { - nodes2_in=tempfile(suffix,"way2poi_result",0); - nodes2_out=tempfile(suffix,"way2poi_result_hn_interpol",1); - } + struct files_relation_processing *files_relproc = files_relation_processing_new(p.osm.line2poi, suffix); p.osm.house_number_interpolations=tempfile(suffix,"house_number_interpolations",0); - process_house_number_interpolations(p.osm.house_number_interpolations, ways_in, ways_out, nodes_in, nodes_out, nodes2_in, nodes2_out); - fclose(ways_in); - fclose(nodes_in); - fclose(ways_out); - fclose(nodes_out); + process_house_number_interpolations(p.osm.house_number_interpolations, files_relproc); + fclose(p.osm.house_number_interpolations); - tempfile_rename(suffix,"ways_split","ways_split_pre_hn_interpol"); - tempfile_rename(suffix,"nodes","nodes_pre_hn_interpol"); - tempfile_rename(suffix,"ways_split_hn_interpol","ways_split"); - tempfile_rename(suffix,"nodes_hn_interpol","nodes"); - if(p.osm.line2poi) { - fclose(nodes2_in); - fclose(nodes2_out); - tempfile_rename(suffix,"way2poi_result","way2poi_result_pre_hn_interpol"); - tempfile_rename(suffix,"way2poi_result_hn_interpol","way2poi_result"); - } - tempfile_unlink(suffix,"ways_split_pre_hn_interpol"); - tempfile_unlink(suffix,"nodes_pre_hn_interpol"); - tempfile_unlink(suffix,"way2poi_result_pre_hn_interpol"); + files_relation_processing_destroy(files_relproc, suffix); if(!p.keep_tmpfiles) { tempfile_unlink(suffix,"house_number_interpolations"); } Modified: trunk/navit/navit/maptool/maptool.h =================================================================== --- trunk/navit/navit/maptool/maptool.h 2014-07-07 14:27:49 UTC (rev 5805) +++ trunk/navit/navit/maptool/maptool.h 2014-07-07 14:28:09 UTC (rev 5806) @@ -124,6 +124,16 @@ typedef unsigned long long int osmid; #define OSMID_FMT LONGLONG_FMT +/** Files needed for processing a relation. */ +struct files_relation_processing { + FILE *ways_in; + FILE *ways_out; + FILE *nodes_in; + FILE *nodes_out; + FILE *nodes2_in; + FILE *nodes2_out; +}; + /* boundaries.c */ struct boundary { @@ -280,8 +290,8 @@ osmid item_bin_get_id(struct item_bin *ib); void flush_nodes(int final); void sort_countries(int keep_tmpfiles); -void process_associated_streets(FILE *in, FILE *ways_in, FILE *ways_out, FILE *nodes_in, FILE *nodes_out, FILE *nodes2_in, FILE *nodes2_out); -void process_house_number_interpolations(FILE *in, FILE *ways_in, FILE *ways_out, FILE *nodes_in, FILE *nodes_out, FILE *nodes2_in, FILE *nodes2_out); +void process_associated_streets(FILE *in, struct files_relation_processing *files_relproc); +void process_house_number_interpolations(FILE *in, struct files_relation_processing *files_relproc); void process_turn_restrictions(FILE *in, FILE *coords, FILE *ways, FILE *ways_index, FILE *out); void process_turn_restrictions_old(FILE *in, FILE *coords, FILE *ways, FILE *ways_index, FILE *out); void clear_node_item_buffer(void); Modified: trunk/navit/navit/maptool/osm.c =================================================================== --- trunk/navit/navit/maptool/osm.c 2014-07-07 14:27:49 UTC (rev 5805) +++ trunk/navit/navit/maptool/osm.c 2014-07-07 14:28:09 UTC (rev 5806) @@ -2427,7 +2427,7 @@ } void -process_associated_streets(FILE *in, FILE *ways_in, FILE *ways_out, FILE *nodes_in, FILE *nodes_out, FILE *nodes2_in, FILE *nodes2_out) +process_associated_streets(FILE *in, struct files_relation_processing *files_relproc) { struct relations *relations=relations_new(); struct process_relation_member_func_priv fp={NULL,NULL}; @@ -2435,22 +2435,22 @@ process_associated_streets_setup(in, relations, &fp); /* Set noname relations names from their street members */ - fseek(ways_in, 0, SEEK_SET); - relations_process(relations, NULL, ways_in); + fseek(files_relproc->ways_in, 0, SEEK_SET); + relations_process(relations, NULL, files_relproc->ways_in); /* Set street names on all members */ - fp.out=ways_out; - fseek(ways_in, 0, SEEK_SET); - relations_process(relations, NULL, ways_in); + fp.out=files_relproc->ways_out; + fseek(files_relproc->ways_in, 0, SEEK_SET); + relations_process(relations, NULL, files_relproc->ways_in); - fp.out=nodes_out; - fseek(nodes_in, 0, SEEK_SET); - relations_process(relations, NULL, nodes_in); + fp.out=files_relproc->nodes_out; + fseek(files_relproc->nodes_in, 0, SEEK_SET); + relations_process(relations, NULL, files_relproc->nodes_in); - if(nodes2_in) { - fp.out=nodes2_out; - fseek(nodes2_in, 0, SEEK_SET); - relations_process(relations, NULL, nodes2_in); + if(files_relproc->nodes2_in) { + fp.out=files_relproc->nodes2_out; + fseek(files_relproc->nodes2_in, 0, SEEK_SET); + relations_process(relations, NULL, files_relproc->nodes2_in); } relations_destroy(relations); @@ -2480,33 +2480,32 @@ } void -process_house_number_interpolations(FILE *in, FILE *ways_in, FILE *ways_out, FILE *nodes_in, FILE *nodes_out, FILE *nodes2_in, FILE *nodes2_out) -{ +process_house_number_interpolations(FILE *in, struct files_relation_processing *files_relproc) { struct relations *relations=relations_new(); struct process_relation_member_func_priv fp={NULL,NULL}; fseek(in, 0, SEEK_SET); process_house_number_interpolations_setup(in, relations, &fp); /* Copy house numbers & street names from first/last node to interpolation way. */ - fseek(ways_in, 0, SEEK_SET); - relations_process(relations, NULL, ways_in); + fseek(files_relproc->ways_in, 0, SEEK_SET); + relations_process(relations, NULL, files_relproc->ways_in); - fseek(nodes_in, 0, SEEK_SET); - relations_process(relations, NULL, nodes_in); + fseek(files_relproc->nodes_in, 0, SEEK_SET); + relations_process(relations, NULL, files_relproc->nodes_in); /* Set street names on all members */ - fp.out=ways_out; - fseek(ways_in, 0, SEEK_SET); - relations_process(relations, NULL, ways_in); + fp.out=files_relproc->ways_out; + fseek(files_relproc->ways_in, 0, SEEK_SET); + relations_process(relations, NULL, files_relproc->ways_in); - fp.out=nodes_out; - fseek(nodes_in, 0, SEEK_SET); - relations_process(relations, NULL, nodes_in); + fp.out=files_relproc->nodes_out; + fseek(files_relproc->nodes_in, 0, SEEK_SET); + relations_process(relations, NULL, files_relproc->nodes_in); - if(nodes2_in) { - fp.out=nodes2_out; - fseek(nodes2_in, 0, SEEK_SET); - relations_process(relations, NULL, nodes2_in); + if(files_relproc->nodes2_in) { + fp.out=files_relproc->nodes2_out; + fseek(files_relproc->nodes2_in, 0, SEEK_SET); + relations_process(relations, NULL, files_relproc->nodes2_in); } relations_destroy(relations); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-07-07 14:27:56
|
Revision: 5805 http://sourceforge.net/p/navit/code/5805 Author: sleske Date: 2014-07-07 14:27:49 +0000 (Mon, 07 Jul 2014) Log Message: ----------- Add:core:Search using OSM house number interpolation data, exclude first&last node from interpolation.|Concludes implementation of #1177. Modified Paths: -------------- trunk/navit/navit/search.c Modified: trunk/navit/navit/search.c =================================================================== --- trunk/navit/navit/search.c 2014-07-07 14:27:36 UTC (rev 5804) +++ trunk/navit/navit/search.c 2014-07-07 14:27:49 UTC (rev 5805) @@ -57,10 +57,15 @@ GList *list,*curr,*last; }; +enum include_end_nodes { + end_nodes_yes, + end_nodes_no, +}; struct hn_interpol_attr { enum attr_type house_number_interpol_attr; int interpol_increment; + enum include_end_nodes include_end_nodes; }; #define house_number_interpol_attr_END -1 @@ -69,13 +74,15 @@ * along with interpolation information. */ struct hn_interpol_attr house_number_interpol_attrs[] = { - { attr_house_number_left, 1 }, - { attr_house_number_left_odd, 2 }, - { attr_house_number_left_even, 2 }, - { attr_house_number_right, 1 }, - { attr_house_number_right_odd, 2 }, - { attr_house_number_right_even, 2 }, - { house_number_interpol_attr_END, -1 }, + { attr_house_number_left, 1, end_nodes_yes }, + { attr_house_number_left_odd, 2, end_nodes_yes }, + { attr_house_number_left_even, 2, end_nodes_yes }, + { attr_house_number_right, 1, end_nodes_yes }, + { attr_house_number_right_odd, 2, end_nodes_yes }, + { attr_house_number_right_even, 2, end_nodes_yes }, + { attr_house_number_interpolation_no_ends_incrmt_1, 1, end_nodes_no }, + { attr_house_number_interpolation_no_ends_incrmt_2, 2, end_nodes_no }, + { house_number_interpol_attr_END, -1, -1 }, }; /** Data for a house number interpolation. */ @@ -90,6 +97,8 @@ char *first; /** Last number. */ char *last; + /** Include first and last node in interpolation results? */ + enum include_end_nodes include_end_nodes; /** Current number in running interpolation. */ char *curr; }; @@ -186,12 +195,13 @@ g_free(inter->last); g_free(inter->curr); inter->first=inter->last=inter->curr=NULL; + inter->increment=inter->include_end_nodes=-1; } static void house_number_interpolation_clear_all(struct house_number_interpolation *inter) { - inter->increment=inter->curr_interpol_attr_idx=0; + inter->curr_interpol_attr_idx=0; house_number_interpolation_clear_current(inter); } @@ -692,7 +702,7 @@ } static char * -search_next_house_number_curr_interpol(struct house_number_interpolation *inter) +search_next_house_number_curr_interpol_with_ends(struct house_number_interpolation *inter) { dbg(1,"interpolate %s-%s %s\n",inter->first,inter->last,inter->curr); if (!inter->first || !inter->last) @@ -716,6 +726,29 @@ return inter->curr; } +static int +house_number_is_end_number(char* house_number, struct house_number_interpolation *inter) { + return ( (!strcmp(house_number, inter->first)) + || (!strcmp(house_number, inter->last)) ); +} + +static char * +search_next_house_number_curr_interpol(struct house_number_interpolation *inter) +{ + char* hn=NULL; + switch (inter->include_end_nodes) { + case end_nodes_yes: + hn=search_next_house_number_curr_interpol_with_ends(inter); + break; + case end_nodes_no: + do { + hn=search_next_house_number_curr_interpol_with_ends(inter); + } while (hn!=NULL && house_number_is_end_number(hn, inter)); + break; + } + return hn; +} + static void search_house_number_interpolation_split(char *str, struct house_number_interpolation *inter) { @@ -835,6 +868,7 @@ if (item_attr_get(item, curr_interpol_attr.house_number_interpol_attr, &attr)) { search_house_number_interpolation_split(attr.u.str, inter); inter->increment=curr_interpol_attr.interpol_increment; + inter->include_end_nodes=curr_interpol_attr.include_end_nodes; } inter->curr_interpol_attr_idx++; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-07-07 14:27:39
|
Revision: 5804 http://sourceforge.net/p/navit/code/5804 Author: sleske Date: 2014-07-07 14:27:36 +0000 (Mon, 07 Jul 2014) Log Message: ----------- Add:maptool:Write OSM data from addr:interpolation to binfile.|Part of #1177. Modified Paths: -------------- trunk/navit/navit/attr_def.h trunk/navit/navit/maptool/maptool.c trunk/navit/navit/maptool/maptool.h trunk/navit/navit/maptool/osm.c Modified: trunk/navit/navit/attr_def.h =================================================================== --- trunk/navit/navit/attr_def.h 2014-07-07 14:26:45 UTC (rev 5803) +++ trunk/navit/navit/attr_def.h 2014-07-07 14:27:36 UTC (rev 5804) @@ -346,6 +346,8 @@ ATTR(map_pass) ATTR(validity_period) ATTR(socket) +/* These attributes for house number interpolation are only written by + * martin-s' (unpublished) GDF converter. */ ATTR(house_number_left) ATTR(house_number_left_odd) ATTR(house_number_left_even) @@ -376,6 +378,10 @@ ATTR(last_key) ATTR(src_dir) ATTR(refresh_cond) +/* House number interpolation information from OSM. For OSM data, the interpolation must + * exclude the end nodes, because these are imported as separate nodes. */ +ATTR(house_number_interpolation_no_ends_incrmt_1) +ATTR(house_number_interpolation_no_ends_incrmt_2) ATTR2(0x0003ffff,type_string_end) ATTR2(0x00040000,type_special_begin) ATTR(order) Modified: trunk/navit/navit/maptool/maptool.c =================================================================== --- trunk/navit/navit/maptool/maptool.c 2014-07-07 14:26:45 UTC (rev 5803) +++ trunk/navit/navit/maptool/maptool.c 2014-07-07 14:27:36 UTC (rev 5804) @@ -951,6 +951,43 @@ tempfile_unlink(suffix,"associated_streets"); } } + // FIXME: c&p + if (p.process_relations && p.process_ways && p.process_nodes && start_phase(&p,"processing house number interpolations")) { + FILE *ways_in=tempfile(suffix,"ways_split",0); + FILE *ways_out=tempfile(suffix,"ways_split_hn_interpol",1); + FILE *nodes_in=tempfile(suffix,"nodes",0); + FILE *nodes_out=tempfile(suffix,"nodes_hn_interpol",1); + FILE *nodes2_in=NULL; + FILE *nodes2_out=NULL; + if(p.osm.line2poi) { + nodes2_in=tempfile(suffix,"way2poi_result",0); + nodes2_out=tempfile(suffix,"way2poi_result_hn_interpol",1); + } + p.osm.house_number_interpolations=tempfile(suffix,"house_number_interpolations",0); + + process_house_number_interpolations(p.osm.house_number_interpolations, ways_in, ways_out, nodes_in, nodes_out, nodes2_in, nodes2_out); + fclose(ways_in); + fclose(nodes_in); + fclose(ways_out); + fclose(nodes_out); + fclose(p.osm.house_number_interpolations); + tempfile_rename(suffix,"ways_split","ways_split_pre_hn_interpol"); + tempfile_rename(suffix,"nodes","nodes_pre_hn_interpol"); + tempfile_rename(suffix,"ways_split_hn_interpol","ways_split"); + tempfile_rename(suffix,"nodes_hn_interpol","nodes"); + if(p.osm.line2poi) { + fclose(nodes2_in); + fclose(nodes2_out); + tempfile_rename(suffix,"way2poi_result","way2poi_result_pre_hn_interpol"); + tempfile_rename(suffix,"way2poi_result_hn_interpol","way2poi_result"); + } + tempfile_unlink(suffix,"ways_split_pre_hn_interpol"); + tempfile_unlink(suffix,"nodes_pre_hn_interpol"); + tempfile_unlink(suffix,"way2poi_result_pre_hn_interpol"); + if(!p.keep_tmpfiles) { + tempfile_unlink(suffix,"house_number_interpolations"); + } + } if (p.output == 1 && start_phase(&p,"dumping")) { maptool_dump(&p, suffix); exit(0); Modified: trunk/navit/navit/maptool/maptool.h =================================================================== --- trunk/navit/navit/maptool/maptool.h 2014-07-07 14:26:45 UTC (rev 5803) +++ trunk/navit/navit/maptool/maptool.h 2014-07-07 14:27:36 UTC (rev 5804) @@ -281,6 +281,7 @@ void flush_nodes(int final); void sort_countries(int keep_tmpfiles); void process_associated_streets(FILE *in, FILE *ways_in, FILE *ways_out, FILE *nodes_in, FILE *nodes_out, FILE *nodes2_in, FILE *nodes2_out); +void process_house_number_interpolations(FILE *in, FILE *ways_in, FILE *ways_out, FILE *nodes_in, FILE *nodes_out, FILE *nodes2_in, FILE *nodes2_out); void process_turn_restrictions(FILE *in, FILE *coords, FILE *ways, FILE *ways_index, FILE *out); void process_turn_restrictions_old(FILE *in, FILE *coords, FILE *ways, FILE *ways_index, FILE *out); void clear_node_item_buffer(void); Modified: trunk/navit/navit/maptool/osm.c =================================================================== --- trunk/navit/navit/maptool/osm.c 2014-07-07 14:26:45 UTC (rev 5803) +++ trunk/navit/navit/maptool/osm.c 2014-07-07 14:27:36 UTC (rev 5804) @@ -902,16 +902,22 @@ attr_strings_buffer_free_offset+=str_size; } -osmid -item_bin_get_nodeid(struct item_bin *ib) +static osmid +item_bin_get_nodeid_from_attr(struct item_bin *ib, enum attr_type attr_type) { - unsigned long long *ret=item_bin_get_attr(ib, attr_osm_nodeid, NULL); + unsigned long long *ret=item_bin_get_attr(ib, attr_type, NULL); if (ret) return *ret; return 0; } osmid +item_bin_get_nodeid(struct item_bin *ib) +{ + return item_bin_get_nodeid_from_attr(ib, attr_osm_nodeid); +} + +osmid item_bin_get_wayid(struct item_bin *ib) { long long *ret=item_bin_get_attr(ib, attr_osm_wayid, NULL); @@ -2277,7 +2283,7 @@ char *name; }; -struct associated_street_member_func_priv { +struct process_relation_member_func_priv { FILE *out; GList *allocations; }; @@ -2285,7 +2291,7 @@ static void process_associated_street_member(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv) { - struct associated_street_member_func_priv *fp=func_priv; + struct process_relation_member_func_priv *fp=func_priv; struct associated_street *rel=relation_priv; if(!fp->out) { /* Pass 1, fill associated street names in relation_priv */ @@ -2308,7 +2314,67 @@ } } +struct house_number_interpolation { + osmid wayid; + char* street_name; + osmid nodeid_first_node; + char* house_number_first_node; + osmid nodeid_last_node; + char* house_number_last_node; +}; + static void +process_house_number_interpolation_member(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv) +{ + struct process_relation_member_func_priv *fp=func_priv; + struct house_number_interpolation *rel=relation_priv; + if(!fp->out) { + /* Pass 1, read street name & house numbers from first & last node.*/ + char *street_name; + char *house_number; + if((street_name=item_bin_get_attr(member,attr_street_name,NULL))) { + rel->street_name=g_strdup(street_name); + fp->allocations=g_list_prepend(fp->allocations, rel->street_name); + } + if ((house_number=item_bin_get_attr(member,attr_house_number,NULL))) { + osmid* nodeid; + char *house_number_dup; + if((nodeid=item_bin_get_attr(member,attr_osm_nodeid,NULL))) { + house_number_dup=g_strdup(house_number); + fp->allocations=g_list_prepend(fp->allocations, house_number_dup); + if (*nodeid==rel->nodeid_first_node){ + rel->house_number_first_node=house_number_dup; + }else{ + rel->house_number_last_node=house_number_dup; + } + } + } + } else { + /* Pass 2, add interpolation information to interpolation ways. */ + enum attr_type attr_for_interpolation = 0; + switch (member->type){ + case type_house_number_interpolation_even: + case type_house_number_interpolation_odd: + attr_for_interpolation = attr_house_number_interpolation_no_ends_incrmt_2; + break; + case type_house_number_interpolation_all: + attr_for_interpolation = attr_house_number_interpolation_no_ends_incrmt_1; + break; + default: + // alphabetic interpolation not (yet) supported + break; + } + if(attr_for_interpolation && rel->street_name){ + item_bin_add_attr_string(member, attr_street_name, rel->street_name); + char* house_number_from_to = g_strconcat(rel->house_number_first_node, "-", rel->house_number_last_node, NULL); + fp->allocations=g_list_prepend(fp->allocations, house_number_from_to); + item_bin_add_attr_string(member, attr_for_interpolation, house_number_from_to); + } + item_bin_write(member,fp->out); + } +} + +static void relation_func_writethrough(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv) { FILE *out=*(FILE **)func_priv; @@ -2318,7 +2384,7 @@ static void -process_associated_streets_setup(FILE *in, struct relations *relations, struct associated_street_member_func_priv *fp) +process_associated_streets_setup(FILE *in, struct relations *relations, struct process_relation_member_func_priv *fp) { struct relation_member relm; long long relid; @@ -2364,7 +2430,7 @@ process_associated_streets(FILE *in, FILE *ways_in, FILE *ways_out, FILE *nodes_in, FILE *nodes_out, FILE *nodes2_in, FILE *nodes2_out) { struct relations *relations=relations_new(); - struct associated_street_member_func_priv fp={NULL,NULL}; + struct process_relation_member_func_priv fp={NULL,NULL}; fseek(in, 0, SEEK_SET); process_associated_streets_setup(in, relations, &fp); @@ -2392,7 +2458,62 @@ g_list_free(fp.allocations); } +static void +process_house_number_interpolations_setup(FILE *in, struct relations *relations, struct process_relation_member_func_priv *fp) +{ + struct item_bin *ib; + struct relations_func *relations_func_process_hn_interpol; + fseek(in, 0, SEEK_SET); + relations_func_process_hn_interpol=relations_func_new(process_house_number_interpolation_member, fp); + while ((ib=read_item(in))) { + struct house_number_interpolation *hn_interpol=g_malloc0(sizeof(struct house_number_interpolation)); + hn_interpol->wayid=item_bin_get_wayid(ib); + hn_interpol->nodeid_first_node=item_bin_get_nodeid_from_attr(ib, attr_osm_nodeid_first_node); + hn_interpol->nodeid_last_node=item_bin_get_nodeid_from_attr(ib, attr_osm_nodeid_last_node); + dbg_assert(hn_interpol->wayid && hn_interpol->nodeid_first_node && hn_interpol->nodeid_last_node); + relations_add_func(relations, relations_func_process_hn_interpol, hn_interpol, NULL, 1, hn_interpol->nodeid_first_node); + relations_add_func(relations, relations_func_process_hn_interpol, hn_interpol, NULL, 1, hn_interpol->nodeid_last_node); + relations_add_func(relations, relations_func_process_hn_interpol, hn_interpol, NULL, 2, hn_interpol->wayid); + } + relations_add_func(relations, relations_func_new(relation_func_writethrough, &fp->out), NULL, NULL, -1, 0); +} + +void +process_house_number_interpolations(FILE *in, FILE *ways_in, FILE *ways_out, FILE *nodes_in, FILE *nodes_out, FILE *nodes2_in, FILE *nodes2_out) +{ + struct relations *relations=relations_new(); + struct process_relation_member_func_priv fp={NULL,NULL}; + fseek(in, 0, SEEK_SET); + process_house_number_interpolations_setup(in, relations, &fp); + + /* Copy house numbers & street names from first/last node to interpolation way. */ + fseek(ways_in, 0, SEEK_SET); + relations_process(relations, NULL, ways_in); + + fseek(nodes_in, 0, SEEK_SET); + relations_process(relations, NULL, nodes_in); + + /* Set street names on all members */ + fp.out=ways_out; + fseek(ways_in, 0, SEEK_SET); + relations_process(relations, NULL, ways_in); + + fp.out=nodes_out; + fseek(nodes_in, 0, SEEK_SET); + relations_process(relations, NULL, nodes_in); + + if(nodes2_in) { + fp.out=nodes2_out; + fseek(nodes2_in, 0, SEEK_SET); + relations_process(relations, NULL, nodes2_in); + } + + relations_destroy(relations); + g_list_foreach(fp.allocations, (GFunc)free, NULL); + g_list_free(fp.allocations); +} + struct turn_restriction { osmid relid; enum item_type type; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-07-07 14:26:52
|
Revision: 5803 http://sourceforge.net/p/navit/code/5803 Author: sleske Date: 2014-07-07 14:26:45 +0000 (Mon, 07 Jul 2014) Log Message: ----------- Add:maptool:Write addr:interpolation data to temporary file when reading OSM input file.|Part of #1177. Modified Paths: -------------- trunk/navit/navit/attr_def.h trunk/navit/navit/maptool/maptool.c trunk/navit/navit/maptool/maptool.h trunk/navit/navit/maptool/osm.c Modified: trunk/navit/navit/attr_def.h =================================================================== --- trunk/navit/navit/attr_def.h 2014-07-07 14:26:25 UTC (rev 5802) +++ trunk/navit/navit/attr_def.h 2014-07-07 14:26:45 UTC (rev 5803) @@ -480,6 +480,8 @@ ATTR(osm_nodeid) ATTR(osm_wayid) ATTR(osm_relationid) +ATTR(osm_nodeid_first_node) +ATTR(osm_nodeid_last_node) ATTR2(0x000cffff,type_int64_end) ATTR2(0x000d0000,type_group_begin) ATTR(speed_dep) Modified: trunk/navit/navit/maptool/maptool.c =================================================================== --- trunk/navit/navit/maptool/maptool.c 2014-07-07 14:26:25 UTC (rev 5802) +++ trunk/navit/navit/maptool/maptool.c 2014-07-07 14:26:45 UTC (rev 5803) @@ -442,6 +442,7 @@ if (p->process_relations) { p->osm.boundaries=tempfile(suffix,"boundaries",1); p->osm.associated_streets=tempfile(suffix,"associated_streets",1); + p->osm.house_number_interpolations=tempfile(suffix,"house_number_interpolations",1); } #ifdef HAVE_POSTGRESQL if (p->dbstr) @@ -483,6 +484,8 @@ fclose(p->osm.turn_restrictions); if (p->osm.associated_streets) fclose(p->osm.associated_streets); + if (p->osm.house_number_interpolations) + fclose(p->osm.house_number_interpolations); if (p->osm.boundaries) fclose(p->osm.boundaries); if (p->osm.poly2poi) Modified: trunk/navit/navit/maptool/maptool.h =================================================================== --- trunk/navit/navit/maptool/maptool.h 2014-07-07 14:26:25 UTC (rev 5802) +++ trunk/navit/navit/maptool/maptool.h 2014-07-07 14:26:45 UTC (rev 5803) @@ -258,6 +258,7 @@ FILE *boundaries; FILE *turn_restrictions; FILE *associated_streets; + FILE *house_number_interpolations; FILE *nodes; FILE *ways; FILE *line2poi; Modified: trunk/navit/navit/maptool/osm.c =================================================================== --- trunk/navit/navit/maptool/osm.c 2014-07-07 14:26:25 UTC (rev 5802) +++ trunk/navit/navit/maptool/osm.c 2014-07-07 14:26:45 UTC (rev 5803) @@ -1755,6 +1755,14 @@ if(i>0) item_bin_add_attr_int(item_bin, attr_duplicate, 1); item_bin_write(item_bin,osm->ways); + + if (types[i]>=type_house_number_interpolation_even && types[i]<=type_house_number_interpolation_alphabetic){ + struct item_bin *item_bin_interpolation_way=init_item(types[i]); + item_bin_add_attr_longlong(item_bin, attr_osm_wayid, osmid_attr_value); + item_bin_add_attr_longlong(item_bin, attr_osm_nodeid_first_node, GET_REF(coord_buffer[0])); + item_bin_add_attr_longlong(item_bin, attr_osm_nodeid_last_node, GET_REF(coord_buffer[coord_count-1])); + item_bin_write(item_bin_interpolation_way, osm->house_number_interpolations); + } } if(osm->line2poi) { count=attr_longest_match(attr_mapping_way2poi, attr_mapping_way2poi_count, types, sizeof(types)/sizeof(enum item_type)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-07-07 14:26:33
|
Revision: 5802 http://sourceforge.net/p/navit/code/5802 Author: sleske Date: 2014-07-07 14:26:25 +0000 (Mon, 07 Jul 2014) Log Message: ----------- Refactor:core:Restructure house number interpolation, read interpolation attributes from list. Modified Paths: -------------- trunk/navit/navit/search.c Modified: trunk/navit/navit/search.c =================================================================== --- trunk/navit/navit/search.c 2014-07-07 14:26:07 UTC (rev 5801) +++ trunk/navit/navit/search.c 2014-07-07 14:26:25 UTC (rev 5802) @@ -57,9 +57,41 @@ GList *list,*curr,*last; }; + +struct hn_interpol_attr { + enum attr_type house_number_interpol_attr; + int interpol_increment; +}; + +#define house_number_interpol_attr_END -1 +/** + * Attributes that indicate a house number interpolation, + * along with interpolation information. + */ +struct hn_interpol_attr house_number_interpol_attrs[] = { + { attr_house_number_left, 1 }, + { attr_house_number_left_odd, 2 }, + { attr_house_number_left_even, 2 }, + { attr_house_number_right, 1 }, + { attr_house_number_right_odd, 2 }, + { attr_house_number_right_even, 2 }, + { house_number_interpol_attr_END, -1 }, +}; + +/** Data for a house number interpolation. */ struct house_number_interpolation { - int side, increment, rev; - char *first, *last, *curr; + /** Index of interpolation attribute currently used. */ + int curr_interpol_attr_idx; + /** Interpolation increment */ + int increment; + /** Reverse interpolation? (0/1) */ + int rev; + /** First number. */ + char *first; + /** Last number. */ + char *last; + /** Current number in running interpolation. */ + char *curr; }; struct search_list { @@ -148,15 +180,21 @@ } static void -house_number_interpolation_clear(struct house_number_interpolation *inter) +house_number_interpolation_clear_current(struct house_number_interpolation *inter) { - inter->increment=inter->side=0; g_free(inter->first); g_free(inter->last); g_free(inter->curr); inter->first=inter->last=inter->curr=NULL; } +static void +house_number_interpolation_clear_all(struct house_number_interpolation *inter) +{ + inter->increment=inter->curr_interpol_attr_idx=0; + house_number_interpolation_clear_current(inter); +} + static char * search_fix_spaces(char *str) { @@ -372,7 +410,7 @@ this_->use_address_results=0; level=search_list_level(search_attr->type); this_->item=NULL; - house_number_interpolation_clear(&this_->inter); + house_number_interpolation_clear_all(&this_->inter); if (level != -1) { this_->result.id=0; this_->level=level; @@ -654,7 +692,7 @@ } static char * -search_interpolate(struct house_number_interpolation *inter) +search_next_house_number_curr_interpol(struct house_number_interpolation *inter) { dbg(1,"interpolate %s-%s %s\n",inter->first,inter->last,inter->curr); if (!inter->first || !inter->last) @@ -708,30 +746,6 @@ } static int -search_setup_house_number_interpolation(struct item *item, enum attr_type i0, enum attr_type i1, enum attr_type i2, - struct house_number_interpolation *inter) -{ - struct attr attr; - g_free(inter->first); - g_free(inter->last); - g_free(inter->curr); - inter->first=inter->last=inter->curr=NULL; - dbg(1,"setup %s\n",attr_to_name(i0)); - if (item_attr_get(item, i0, &attr)) { - search_house_number_interpolation_split(attr.u.str, inter); - inter->increment=1; - } else if (item_attr_get(item, i1, &attr)) { - search_house_number_interpolation_split(attr.u.str, inter); - inter->increment=2; - } else if (item_attr_get(item, i2, &attr)) { - search_house_number_interpolation_split(attr.u.str, inter); - inter->increment=2; - } else - return 0; - return 1; -} - -static int search_match(char *str, char *search, int partial) { if (!partial) @@ -800,43 +814,52 @@ return ret; } +static char * +search_next_interpolated_house_number(struct item *item, struct house_number_interpolation *inter, char *inter_match, int inter_partial) +{ + while (1) { + char *hn; + struct attr attr; + struct hn_interpol_attr curr_interpol_attr; + while((hn=search_next_house_number_curr_interpol(inter))){ + if (search_match(hn, inter_match, inter_partial)) { + return map_convert_string(item->map, hn); + } + } + + house_number_interpolation_clear_current(inter); + curr_interpol_attr=house_number_interpol_attrs[inter->curr_interpol_attr_idx]; + if (curr_interpol_attr.house_number_interpol_attr==house_number_interpol_attr_END) { + return NULL; + } + if (item_attr_get(item, curr_interpol_attr.house_number_interpol_attr, &attr)) { + search_house_number_interpolation_split(attr.u.str, inter); + inter->increment=curr_interpol_attr.interpol_increment; + } + inter->curr_interpol_attr_idx++; + } +} + static struct search_list_house_number * search_list_house_number_new(struct item *item, struct house_number_interpolation *inter, char *inter_match, int inter_partial) { struct search_list_house_number *ret=g_new0(struct search_list_house_number, 1); struct attr attr; - char *hn; + char *house_number=NULL; ret->common.item=ret->common.unique=*item; - if (item_attr_get(item, attr_house_number, &attr)) - ret->house_number=map_convert_string(item->map, attr.u.str); - else { + if (item_attr_get(item, attr_house_number, &attr)) { + house_number=attr.u.str; + } else { + ret->house_number_interpolation=1; memset(&ret->common.unique, 0, sizeof(ret->common.unique)); - for (;;) { - ret->house_number_interpolation=1; - switch(inter->side) { - case 0: - inter->side=-1; - search_setup_house_number_interpolation(item, attr_house_number_left, attr_house_number_left_odd, attr_house_number_left_even, inter); - case -1: - if ((hn=search_interpolate(inter))) - break; - inter->side=1; - search_setup_house_number_interpolation(item, attr_house_number_right, attr_house_number_right_odd, attr_house_number_right_even, inter); - case 1: - if ((hn=search_interpolate(inter))) - break; - default: - g_free(ret); - return NULL; - } - if (search_match(hn, inter_match, inter_partial)) - { - ret->house_number=map_convert_string(item->map, hn); - break; - } - } + house_number=search_next_interpolated_house_number(item, inter, inter_match, inter_partial); } + if (!house_number) { + g_free(ret); + return NULL; + } + ret->house_number=map_convert_string(item->map, house_number); search_list_common_new(item, &ret->common); ret->common.c=search_house_number_coordinate(item, ret->house_number_interpolation?inter:NULL); return ret; @@ -1151,7 +1174,7 @@ p=search_list_house_number_new(this_->item, &this_->inter, le->attr->u.str, le->partial); if (!p) { - house_number_interpolation_clear(&this_->inter); + house_number_interpolation_clear_all(&this_->inter); this_->item=NULL; continue; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-07-07 14:26:15
|
Revision: 5801 http://sourceforge.net/p/navit/code/5801 Author: sleske Date: 2014-07-07 14:26:07 +0000 (Mon, 07 Jul 2014) Log Message: ----------- Refactor:maptool:Macro for default slice size. Modified Paths: -------------- trunk/navit/navit/maptool/maptool.c Modified: trunk/navit/navit/maptool/maptool.c =================================================================== --- trunk/navit/navit/maptool/maptool.c 2014-07-07 14:25:44 UTC (rev 5800) +++ trunk/navit/navit/maptool/maptool.c 2014-07-07 14:26:07 UTC (rev 5801) @@ -47,7 +47,8 @@ #include "util.h" #include "maptool.h" -long long slice_size=1024*1024*1024; +#define SLIZE_SIZE_DEFAULT_GB 1 +long long slice_size=SLIZE_SIZE_DEFAULT_GB*1024ll*1024*1024; int attr_debug_level=1; int ignore_unkown = 0; GHashTable *dedupe_ways_hash; @@ -171,7 +172,7 @@ fprintf(f,"-P (--protobuf) : input file is protobuf\n"); fprintf(f,"-r (--rule-file) <file> : read mapping rules from specified file\n"); fprintf(f,"-s (--start) <phase> : start at specified phase\n"); - fprintf(f,"-S (--slice-size) <size> : defines the amount of memory to use, in bytes. Default is 1GB\n"); + fprintf(f,"-S (--slice-size) <size> : defines the amount of memory to use, in bytes. Default is %dGB\n", SLIZE_SIZE_DEFAULT_GB); fprintf(f,"-t (--timestamp) y-m-dTh:m:s : Set zip timestamp\n"); fprintf(f,"-w (--dedupe-ways) : ensure no duplicate ways or nodes. useful when using several input files\n"); fprintf(f,"-W (--ways-only) : process only ways\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-07-07 14:25:51
|
Revision: 5800 http://sourceforge.net/p/navit/code/5800 Author: sleske Date: 2014-07-07 14:25:44 +0000 (Mon, 07 Jul 2014) Log Message: ----------- Refactor:core:Remove commented-out debugging code. Modified Paths: -------------- trunk/navit/navit/search.c Modified: trunk/navit/navit/search.c =================================================================== --- trunk/navit/navit/search.c 2014-07-03 20:21:48 UTC (rev 5799) +++ trunk/navit/navit/search.c 2014-07-07 14:25:44 UTC (rev 5800) @@ -808,50 +808,37 @@ char *hn; ret->common.item=ret->common.unique=*item; - //if (item_attr_get(item, attr_street_name, &attr)) - // dbg(0,"xx1 %s\n",attr.u.str); if (item_attr_get(item, attr_house_number, &attr)) ret->house_number=map_convert_string(item->map, attr.u.str); else { memset(&ret->common.unique, 0, sizeof(ret->common.unique)); - //if (item_attr_get(item, attr_street_name, &attr)) - // dbg(0,"xx2 %s\n",attr.u.str); for (;;) { - //dbg(0,"interpolate 11"); ret->house_number_interpolation=1; switch(inter->side) { case 0: - //dbg(0,"interpolate 11 0"); inter->side=-1; search_setup_house_number_interpolation(item, attr_house_number_left, attr_house_number_left_odd, attr_house_number_left_even, inter); case -1: - //dbg(0,"interpolate 11 -1"); if ((hn=search_interpolate(inter))) break; inter->side=1; search_setup_house_number_interpolation(item, attr_house_number_right, attr_house_number_right_odd, attr_house_number_right_even, inter); case 1: - //dbg(0,"interpolate 11 1"); if ((hn=search_interpolate(inter))) break; default: - //dbg(0,"interpolate 11 default"); g_free(ret); return NULL; } if (search_match(hn, inter_match, inter_partial)) { - //dbg(0,"interpolate 22"); - //dbg(0,"match %s %s-%s\n",hn, inter->first, inter->last); ret->house_number=map_convert_string(item->map, hn); break; } } } - //dbg(0,"interpolate 33"); search_list_common_new(item, &ret->common); ret->common.c=search_house_number_coordinate(item, ret->house_number_interpolation?inter:NULL); - //dbg(0,"interpolate 44"); return ret; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2014-07-03 20:21:55
|
Revision: 5799 http://sourceforge.net/p/navit/code/5799 Author: mdankov Date: 2014-07-03 20:21:48 +0000 (Thu, 03 Jul 2014) Log Message: ----------- Fix:graphics/gtk_drawing_area:Do not crash when bg passed to draw_text is NULL.|thanks tauso for reporting this Modified Paths: -------------- trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c Modified: trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c =================================================================== --- trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c 2014-06-25 07:53:55 UTC (rev 5798) +++ trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c 2014-07-03 20:21:48 UTC (rev 5799) @@ -418,7 +418,7 @@ return; } #endif - if (!bg->c.a) + if (bg && !bg->c.a) bg=NULL; if (bg) { if (COLOR_IS_BLACK(fg->c) && COLOR_IS_WHITE(bg->c)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2014-06-25 07:53:59
|
Revision: 5798 http://sourceforge.net/p/navit/code/5798 Author: martin-s Date: 2014-06-25 07:53:55 +0000 (Wed, 25 Jun 2014) Log Message: ----------- Add:gui_internal:Improve configurability Modified Paths: -------------- trunk/navit/navit/gui/internal/gui_internal.c trunk/navit/navit/gui/internal/gui_internal_menu.c trunk/navit/navit/gui/internal/gui_internal_priv.h Modified: trunk/navit/navit/gui/internal/gui_internal.c =================================================================== --- trunk/navit/navit/gui/internal/gui_internal.c 2014-06-25 07:52:39 UTC (rev 5797) +++ trunk/navit/navit/gui/internal/gui_internal.c 2014-06-25 07:53:55 UTC (rev 5798) @@ -561,9 +561,13 @@ this->spacing = current_config->spacing; } if (!this->fonts[0]) { - this->fonts[0]=graphics_font_new(this->gra,this->font_size,1); - this->fonts[1]=graphics_font_new(this->gra,this->font_size*66/100,1); - this->fonts[2]=graphics_font_new(this->gra,this->font_size*50/100,1); + int i,sizes[]={100,66,50}; + for (i = 0 ; i < 3 ; i++) { + if (this->font_name) + this->fonts[i]=graphics_named_font_new(this->gra,this->font_name,this->font_size*sizes[i]/100,1); + else + this->fonts[i]=graphics_font_new(this->gra,this->font_size*sizes[i]/100,1); + } } } @@ -3269,7 +3273,10 @@ this->text_foreground_color=*attr->u.color; else this->text_foreground_color=color_white; - this->text_background_color=color_black; + if( (attr=attr_search(attrs,NULL,attr_text_background))) + this->text_background_color=*attr->u.color; + else + this->text_background_color=color_black; if( (attr=attr_search(attrs,NULL,attr_columns))) this->cols=attr->u.num; if( (attr=attr_search(attrs,NULL,attr_osd_configuration))) @@ -3295,6 +3302,8 @@ this->radius=attr->u.num; else this->radius=10; + if( (attr=attr_search(attrs,NULL,attr_font))) + this->font_name=g_strdup(attr->u.str); this->data.priv=this; this->data.gui=&gui_internal_methods_ext; this->data.widget=&gui_internal_widget_methods; Modified: trunk/navit/navit/gui/internal/gui_internal_menu.c =================================================================== --- trunk/navit/navit/gui/internal/gui_internal_menu.c 2014-06-25 07:52:39 UTC (rev 5797) +++ trunk/navit/navit/gui/internal/gui_internal_menu.c 2014-06-25 07:53:55 UTC (rev 5798) @@ -208,9 +208,10 @@ 512:Set osd_configuration and zoom to route when setting position 1024:Don't show back button 2048:No highlighting of keyboard + 4096:Center menu title */ - w=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|(this->flags & 1 ? 0:flags_fill)); + w=gui_internal_box_new(this, (this->flags & 4096 ? gravity_center : gravity_left_center)|orientation_horizontal|(this->flags & 1 ? 0:flags_fill)); w->bl=this->spacing; w->spx=this->spacing; w->background=this->background2; Modified: trunk/navit/navit/gui/internal/gui_internal_priv.h =================================================================== --- trunk/navit/navit/gui/internal/gui_internal_priv.h 2014-06-25 07:52:39 UTC (rev 5797) +++ trunk/navit/navit/gui/internal/gui_internal_priv.h 2014-06-25 07:53:55 UTC (rev 5798) @@ -54,6 +54,7 @@ struct color background_color, background2_color, text_foreground_color, text_background_color; int spacing; int font_size; + char *font_name; int fullscreen; struct graphics_font *fonts[3]; /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2014-06-25 07:52:47
|
Revision: 5797 http://sourceforge.net/p/navit/code/5797 Author: martin-s Date: 2014-06-25 07:52:39 +0000 (Wed, 25 Jun 2014) Log Message: ----------- Fix:graphics_gtk_drawing_area:Handle transparent background in text as non-existent Modified Paths: -------------- trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c Modified: trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c =================================================================== --- trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c 2014-06-25 07:49:36 UTC (rev 5796) +++ trunk/navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c 2014-06-25 07:52:39 UTC (rev 5797) @@ -418,7 +418,8 @@ return; } #endif - + if (!bg->c.a) + bg=NULL; if (bg) { if (COLOR_IS_BLACK(fg->c) && COLOR_IS_WHITE(bg->c)) { gdk_gc_set_function(fg->gc, GDK_AND_INVERT); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2014-06-25 07:49:44
|
Revision: 5796 http://sourceforge.net/p/navit/code/5796 Author: martin-s Date: 2014-06-25 07:49:36 +0000 (Wed, 25 Jun 2014) Log Message: ----------- Add:Core:New attribute to specify text background Modified Paths: -------------- trunk/navit/navit/attr_def.h Modified: trunk/navit/navit/attr_def.h =================================================================== --- trunk/navit/navit/attr_def.h 2014-06-15 19:35:32 UTC (rev 5795) +++ trunk/navit/navit/attr_def.h 2014-06-25 07:49:36 UTC (rev 5796) @@ -413,6 +413,7 @@ ATTR(text_color) ATTR(idle_color) ATTR(background_color2) +ATTR(text_background) ATTR2(0x0007ffff,type_color_end) ATTR2(0x00080000,type_object_begin) ATTR(navit) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2014-06-15 19:35:37
|
Revision: 5795 http://sourceforge.net/p/navit/code/5795 Author: mdankov Date: 2014-06-15 19:35:32 +0000 (Sun, 15 Jun 2014) Log Message: ----------- Fix:maptool:Memleak Modified Paths: -------------- trunk/navit/navit/maptool/osm.c Modified: trunk/navit/navit/maptool/osm.c =================================================================== --- trunk/navit/navit/maptool/osm.c 2014-05-30 21:28:40 UTC (rev 5794) +++ trunk/navit/navit/maptool/osm.c 2014-06-15 19:35:32 UTC (rev 5795) @@ -2508,6 +2508,9 @@ } } + g_free(t->c[0]); + g_free(t->c[1]); + g_free(t->c[2]); g_free(t); l=g_list_next(l); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <xen...@us...> - 2014-05-30 21:28:43
|
Revision: 5794 http://sourceforge.net/p/navit/code/5794 Author: xenos1984 Date: 2014-05-30 21:28:40 +0000 (Fri, 30 May 2014) Log Message: ----------- Fix:Core:Re-enable search for gettext in main CMakeLists.txt. Modified Paths: -------------- trunk/navit/CMakeLists.txt Modified: trunk/navit/CMakeLists.txt =================================================================== --- trunk/navit/CMakeLists.txt 2014-05-30 20:51:42 UTC (rev 5793) +++ trunk/navit/CMakeLists.txt 2014-05-30 21:28:40 UTC (rev 5794) @@ -5,7 +5,7 @@ # Workaround for CMake issue 8345 / 9220, see http://trac.navit-project.org/ticket/1041 if(DEFINED CMAKE_CXX_COMPILER AND CMAKE_CXX_COMPILER MATCHES "^$") set(CMAKE_CXX_COMPILER CMAKE_CXX_COMPILER-NOTFOUND) -endif(DEFINED CMAKE_CXX_COMPILER AND CMAKE_CXX_COMPILER MATCHES "^$") +endif(DEFINED CMAKE_CXX_COMPILER AND CMAKE_CXX_COMPILER MATCHES "^$") if (NOT DISABLE_CXX) enable_language(CXX OPTIONAL) endif(NOT DISABLE_CXX) @@ -52,7 +52,7 @@ SET(LIB_DIR lib) ENDIF (UNIX AND NOT ANDROID AND NOT APPLE) -foreach(EXTRA_MODULE ${EXTRA_MODULES}) +foreach(EXTRA_MODULE ${EXTRA_MODULES}) add_module(${EXTRA_MODULE} "extra module specified" TRUE) endforeach() @@ -114,6 +114,7 @@ find_package(OpenGL) find_package(GLUT) find_package(GTK2 2.6 COMPONENTS gtk) +find_package(Gettext) find_package(PNG) find_package(DBusGLib) find_package(PythonLibs) @@ -172,7 +173,7 @@ CHECK_FUNCTION_EXISTS(sbrk HAVE_SBRK) CHECK_FUNCTION_EXISTS(getdelim HAVE_GETDELIM) CHECK_FUNCTION_EXISTS(getline HAVE_GETLINE) -CHECK_FUNCTION_EXISTS(fsync HAVE_FSYNC) +CHECK_FUNCTION_EXISTS(fsync HAVE_FSYNC) ### Configure build @@ -258,7 +259,7 @@ set_with_reason(graphics/qt_qpainter "Qt libraries found" TRUE ${QT_LIBRARIES}) if (QT_QTDECLARATIVE_FOUND AND QT_QTXML_FOUND) - set_with_reason(gui/qml "Qt Declarative found" TRUE ${QT_LIBRARIES}) + set_with_reason(gui/qml "Qt Declarative found" TRUE ${QT_LIBRARIES}) endif() if (QT_QTSVG_FOUND) @@ -488,7 +489,7 @@ set(LOCALE_DIR locale) set(IMAGE_DIR xpm) - + if(HAVE_GTK2 AND NOT MSVC) #GTK requires special compile flags add_definitions("-mms-bitfields") @@ -556,7 +557,7 @@ if(ANDROID) # for android API 3 compatiblity SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,/data/data/org.navitproject.navit/lib/") - + find_program(ANDROID_LOCATION NAMES android android.bat) find_program(ANT_LOCATION NAMES ant) if (NOT ANT_LOCATION) @@ -578,7 +579,7 @@ set_with_reason(vehicle/android "Android detected" TRUE) set_with_reason(plugin/pedestrian "Android detected" TRUE) cfg_feature(SHARED_LIBNAVIT "Android detected" TRUE) - + add_feature(XPM2PNG "Android detected" TRUE) set(NAVIT_COMPILE_FLAGS "${NAVIT_COMPILE_FLAGS} -fPIC") @@ -716,7 +717,7 @@ message("Disabled ${FEATURE} ( ${${FEATURE}_REASON} )") endif() endforeach() - + if (XSL_PROCESSING) if (XSLTS) message("\nProcessing XSLT files: ${XSLTS}") @@ -726,7 +727,7 @@ message("See navit/xslt for available XSLT files, and put them into " "cache variable 'XSLTS' (without extension .xslt).") endif(XSL_PROCESSING) - + message("\nTo configure your build use 'cmake -L' to find changeable variables and run cmake again with 'cmake -D <var-name>=<your value> ...'.") endif(NOT NAVIT_DEPENDENCY_ERROR) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2014-05-30 20:51:46
|
Revision: 5793 http://sourceforge.net/p/navit/code/5793 Author: mdankov Date: 2014-05-30 20:51:42 +0000 (Fri, 30 May 2014) Log Message: ----------- Fix:core:Do not depend on XGettextGlade ability to process broken glade input to fetch translatable strings from navit_shipped.xml. Modified Paths: -------------- trunk/navit/CMakeLists.txt trunk/navit/cmake/navit_xml_parser.cmake trunk/navit/po/CMakeLists.txt Modified: trunk/navit/CMakeLists.txt =================================================================== --- trunk/navit/CMakeLists.txt 2014-05-29 23:01:21 UTC (rev 5792) +++ trunk/navit/CMakeLists.txt 2014-05-30 20:51:42 UTC (rev 5793) @@ -114,7 +114,6 @@ find_package(OpenGL) find_package(GLUT) find_package(GTK2 2.6 COMPONENTS gtk) -find_package(XGettextGlade) find_package(PNG) find_package(DBusGLib) find_package(PythonLibs) Modified: trunk/navit/cmake/navit_xml_parser.cmake =================================================================== --- trunk/navit/cmake/navit_xml_parser.cmake 2014-05-29 23:01:21 UTC (rev 5792) +++ trunk/navit/cmake/navit_xml_parser.cmake 2014-05-30 20:51:42 UTC (rev 5793) @@ -5,3 +5,21 @@ string(REGEX REPLACE ".*(_\\(\"[^\"]*\"\\)).*" "\\1\n" OUTPUT_LINE ${LINE}) file(APPEND ${DST} ${OUTPUT_LINE}) endforeach() + +file(READ "${SRC}" SRC_CONTENT) + +string(REGEX MATCHALL "<text>([^<>]*)</text>" TEXT_ELEMENTS "${SRC_CONTENT}") + +foreach (LINE ${TEXT_ELEMENTS}) + string(REGEX REPLACE ".*<text[^>]*>([^<>]*)</text>.*" "_(\"\\1\")" OUTPUT_LINE ${LINE}) + string(REPLACE "\n" "\\n" OUTPUT_LINE ${OUTPUT_LINE}) + file(APPEND ${DST} "${OUTPUT_LINE}\n") +endforeach() + +string(REGEX MATCHALL "<vehicleprofile [^<>]*name=\"[^\"]+\"" ATTRS "${SRC_CONTENT}") + +foreach (LINE ${ATTRS}) + string(REGEX REPLACE ".* name=\"([^\"]+)\"" "_(\"\\1\")" OUTPUT_LINE ${LINE}) + file(APPEND ${DST} "${OUTPUT_LINE}\n") +endforeach() + Modified: trunk/navit/po/CMakeLists.txt =================================================================== --- trunk/navit/po/CMakeLists.txt 2014-05-29 23:01:21 UTC (rev 5792) +++ trunk/navit/po/CMakeLists.txt 2014-05-30 20:51:42 UTC (rev 5793) @@ -32,9 +32,6 @@ ${CMAKE_CURRENT_BINARY_DIR}/navit_shipped.c ${CMAKE_CURRENT_BINARY_DIR}/strings_xml.c ) -if (XGETTEXT_GLADE) - list(APPEND POTFILES ${CMAKE_CURRENT_BINARY_DIR}/navit_shipped.glade) -endif() # Trick gettext to get translateable strings out of navit_shipped.xml @@ -45,13 +42,6 @@ -P ${PROJECT_SOURCE_DIR}/cmake/navit_xml_parser.cmake ) -ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/navit_shipped.glade - DEPENDS ${PROJECT_SOURCE_DIR}/navit/navit_shipped.xml - COMMAND ${CMAKE_COMMAND} -D SRC=${PROJECT_SOURCE_DIR}/navit/navit_shipped.xml -D DST=${CMAKE_CURRENT_BINARY_DIR}/navit_shipped.glade - -P ${PROJECT_SOURCE_DIR}/cmake/navit_xml_parser_glade.cmake -) - # Trick gettext to get translateable strings out of android strings.xml ADD_CUSTOM_COMMAND( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-05-29 23:01:25
|
Revision: 5792 http://sourceforge.net/p/navit/code/5792 Author: sleske Date: 2014-05-29 23:01:21 +0000 (Thu, 29 May 2014) Log Message: ----------- Fix:maptool:Put back switch '--experimental' removed in r.5780, add description text. Modified Paths: -------------- trunk/navit/navit/maptool/maptool.c Modified: trunk/navit/navit/maptool/maptool.c =================================================================== --- trunk/navit/navit/maptool/maptool.c 2014-05-29 15:46:19 UTC (rev 5791) +++ trunk/navit/navit/maptool/maptool.c 2014-05-29 23:01:21 UTC (rev 5792) @@ -56,6 +56,10 @@ int unknown_country; int doway2poi=1; char ch_suffix[] ="r"; /* Used to make compiler happy due to Bug 35903 in gcc */ +/** Textual description of available experimental features, or NULL (=none available). */ +char* experimental_feature_description = NULL; /* add description here */ +/** Indicates if experimental features (if available) were enabled. */ +int experimental; struct buffer node_buffer = { 64*1024*1024, @@ -157,6 +161,8 @@ fprintf(f,"-d (--db) <conn. string> : get osm data out of a postgresql database with osm simple scheme and given connect string\n"); #endif fprintf(f,"-e (--end) <phase> : end at specified phase\n"); + fprintf(f,"-E (--experimental) : Enable experimental features (%s)\n", + experimental_feature_description ? experimental_feature_description : "-not available in this version-"); fprintf(f,"-i (--input-file) <file> : specify the input file name (OSM), overrules default stdin\n"); fprintf(f,"-k (--keep-tmpfiles) : do not delete tmp files after processing. useful to reuse them\n\n"); fprintf(f,"-M (--o5m) : input file os o5m\n"); @@ -235,6 +241,7 @@ {"dump", 0, 0, 'D'}, {"dump-coordinates", 0, 0, 'c'}, {"end", 1, 0, 'e'}, + {"experimental", 0, 0, 'E'}, {"help", 0, 0, 'h'}, {"keep-tmpfiles", 0, 0, 'k'}, {"nodes-only", 0, 0, 'N'}, @@ -274,6 +281,9 @@ case 'D': p->output=1; break; + case 'E': + experimental=1; + break; case 'M': p->o5m=1; break; @@ -820,6 +830,10 @@ exit(0); } } + if (experimental && (!experimental_feature_description )) { + fprintf(stderr,"No experimental features available in this version, aborting. \n"); + exit(1); + } if (optind != argc-(p.output == 1 ? 0:1)) usage(stderr); p.result=argv[optind]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2014-05-29 15:46:21
|
Revision: 5791 http://sourceforge.net/p/navit/code/5791 Author: martin-s Date: 2014-05-29 15:46:19 +0000 (Thu, 29 May 2014) Log Message: ----------- Add:binding_dbus:Implement new routing functions Modified Paths: -------------- trunk/navit/navit/binding/dbus/binding_dbus.c Modified: trunk/navit/navit/binding/dbus/binding_dbus.c =================================================================== --- trunk/navit/navit/binding/dbus/binding_dbus.c 2014-05-29 15:45:42 UTC (rev 5790) +++ trunk/navit/navit/binding/dbus/binding_dbus.c 2014-05-29 15:46:19 UTC (rev 5791) @@ -600,6 +600,35 @@ return ret; } } + if(attr->type >= attr_type_pcoord_begin && attr->type <= attr_type_pcoord_end) { + int i; + if (dbus_message_iter_get_arg_type(&iterattr) == DBUS_TYPE_STRUCT) { + attr->u.pcoord=g_new(typeof(*attr->u.pcoord),1); + dbus_message_iter_recurse(&iterattr, &iterstruct); + if (dbus_message_iter_get_arg_type(&iterstruct) == DBUS_TYPE_INT32) { + dbus_message_iter_get_basic(&iterstruct, &i); + dbus_message_iter_next(&iterstruct); + attr->u.pcoord->pro=i; + } else + ret=0; + if (dbus_message_iter_get_arg_type(&iterstruct) == DBUS_TYPE_INT32) { + dbus_message_iter_get_basic(&iterstruct, &i); + dbus_message_iter_next(&iterstruct); + attr->u.pcoord->x=i; + } else + ret=0; + if (dbus_message_iter_get_arg_type(&iterstruct) == DBUS_TYPE_INT32) { + dbus_message_iter_get_basic(&iterstruct, &i); + attr->u.pcoord->y=i; + } else + ret=0; + if (!ret) { + g_free(attr->u.pcoord); + attr->u.pcoord=NULL; + } + return ret; + } + } if (attr->type == attr_callback) { struct dbus_callback *callback=object_get_from_message_arg(&iterattr, "callback"); if (callback) { @@ -687,6 +716,27 @@ static DBusHandlerResult +request_dup(DBusConnection *connection, DBusMessage *message, char *type, void *data, void *(*func)(void *)) +{ + DBusMessage *reply; + char *opath; + void *obj; + if (!data) + data=object_get_from_message(message, type); + if (!data) + return dbus_error_invalid_object_path(connection, message); + obj=func(data); + opath=object_new(type,obj); + reply = dbus_message_new_method_return(message); + dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &opath, DBUS_TYPE_INVALID); + dbus_connection_send (connection, reply, NULL); + dbus_message_unref (reply); + + return DBUS_HANDLER_RESULT_HANDLED; +} + + +static DBusHandlerResult request_get_attr(DBusConnection *connection, DBusMessage *message, char *type, void *data, int (*func)(void *data, enum attr_type type, struct attr *attr, struct attr_iter *iter)) { DBusMessage *reply; @@ -1028,7 +1078,19 @@ return request_set_add_remove_attr(connection, message, "route", NULL, (int (*)(void *, struct attr *))route_remove_attr); } +static DBusHandlerResult +request_route_destroy(DBusConnection *connection, DBusMessage *message) +{ + return request_destroy(connection, message, "route", NULL, (void (*)(void *)) route_destroy); +} +static DBusHandlerResult +request_route_dup(DBusConnection *connection, DBusMessage *message) +{ + return request_dup(connection, message, "route", NULL, (void *(*)(void *)) route_dup); +} + + /* navit */ static DBusHandlerResult @@ -1704,7 +1766,11 @@ {".route", "set_attr", "sv", "attribute,value", "", "", request_route_set_attr}, {".route", "add_attr", "sv", "attribute,value", "", "", request_route_add_attr}, {".route", "remove_attr", "sv", "attribute,value", "", "", request_route_remove_attr}, + {".route", "destroy", "", "", "", "", request_route_destroy}, + {".route", "dup", "", "", "", "", request_route_dup}, {".search_list","destroy", "", "", "", "", request_search_list_destroy}, + {".search_list","destroy", "", "", "", "", request_search_list_destroy}, + {".search_list","destroy", "", "", "", "", request_search_list_destroy}, {".search_list","get_result", "", "", "i(iii)a{sa{sv}}", "id,coord,dict", request_search_list_get_result}, {".search_list","search", "svi", "attribute,value,partial", "", "", request_search_list_search}, {".search_list","select", "sii", "attribute_type,id,mode", "", "", request_search_list_select}, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2014-05-29 15:45:45
|
Revision: 5790 http://sourceforge.net/p/navit/code/5790 Author: martin-s Date: 2014-05-29 15:45:42 +0000 (Thu, 29 May 2014) Log Message: ----------- Fix:Core:Set routing profile even if no vehicle is active Modified Paths: -------------- trunk/navit/navit/navit.c Modified: trunk/navit/navit/navit.c =================================================================== --- trunk/navit/navit/navit.c 2014-05-29 15:45:01 UTC (rev 5789) +++ trunk/navit/navit/navit.c 2014-05-29 15:45:42 UTC (rev 5790) @@ -3136,9 +3136,7 @@ { struct attr attr; this_->vehicle=nv; - if (!nv) - return; - if (vehicle_get_attr(nv->vehicle, attr_profilename, &attr, NULL)) { + if (nv && vehicle_get_attr(nv->vehicle, attr_profilename, &attr, NULL)) { if (navit_set_vehicleprofile_name(this_, attr.u.str)) return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2014-05-29 15:45:04
|
Revision: 5789 http://sourceforge.net/p/navit/code/5789 Author: martin-s Date: 2014-05-29 15:45:01 +0000 (Thu, 29 May 2014) Log Message: ----------- Add:Core:Improved routing api and support for testing route positions without rebuilding graph Modified Paths: -------------- trunk/navit/navit/route.c trunk/navit/navit/route.h trunk/navit/navit/xmlconfig.c trunk/navit/navit/xmlconfig.h Modified: trunk/navit/navit/route.c =================================================================== --- trunk/navit/navit/route.c 2014-05-29 15:43:30 UTC (rev 5788) +++ trunk/navit/navit/route.c 2014-05-29 15:45:01 UTC (rev 5789) @@ -78,6 +78,13 @@ int debug_route=0; +enum route_path_flags { + route_path_flag_none=0, + route_path_flag_cancel=1, + route_path_flag_async=2, + route_path_flag_no_rebuild=4, +}; + /** * @brief A point in the route graph * @@ -230,6 +237,7 @@ * This struct holds all information about a route. */ struct route { + NAVIT_OBJECT struct mapset *ms; /**< The mapset this route is built upon */ unsigned flags; struct route_info *pos; /**< Current position within this route */ @@ -468,6 +476,9 @@ struct route *this=g_new0(struct route, 1); struct attr dest_attr; + this->func=&route_func; + navit_object_ref((struct navit_object *)this); + if (attr_generic_get_attr(attrs, NULL, attr_destination_distance, &dest_attr, NULL)) { this->destination_distance = dest_attr.u.num; } else { @@ -479,6 +490,27 @@ } /** + * @brief Duplicates a route object + * + * @return The duplicated route + */ + +struct route * +route_dup(struct route *orig) +{ + struct route *this=g_new0(struct route, 1); + this->func=&route_func; + navit_object_ref((struct navit_object *)this); + this->cbl2=callback_list_new(); + this->destination_distance=orig->destination_distance; + this->ms=orig->ms; + this->flags=orig->flags; + this->vehicleprofile=orig->vehicleprofile; + + return this; +} + +/** * @brief Checks if a segment is part of a roundabout * * This function checks if a segment is part of a roundabout. @@ -800,16 +832,16 @@ * @param this The route to update */ static void -route_path_update(struct route *this, int cancel, int async) +route_path_update_flags(struct route *this, enum route_path_flags flags) { - dbg(1,"enter %d\n", cancel); + dbg(1,"enter %d\n", flags); if (! this->pos || ! this->destinations) { dbg(1,"destroy\n"); route_path_destroy(this->path2,1); this->path2 = NULL; return; } - if (cancel) { + if (flags & route_path_flag_cancel) { route_graph_destroy(this->graph); this->graph=NULL; } @@ -826,15 +858,23 @@ route_path_destroy(this->path2,1); this->path2 = NULL; } - if (!this->graph || !this->path2) { - dbg(1,"rebuild graph\n"); + if (!this->graph || (!this->path2 && !(flags & route_path_flag_no_rebuild))) { + dbg(0,"rebuild graph %p %p\n",this->graph,this->path2); if (! this->route_graph_flood_done_cb) this->route_graph_flood_done_cb=callback_new_2(callback_cast(route_path_update_done), this, (long)1); dbg(1,"route_graph_update\n"); - route_graph_update(this, this->route_graph_flood_done_cb, async); + route_graph_update(this, this->route_graph_flood_done_cb, !!(flags & route_path_flag_async)); } } +static void +route_path_update(struct route *this, int cancel, int async) +{ + enum route_path_flags flags=(cancel ? route_path_flag_cancel:0)|(async ? route_path_flag_async:0); + route_path_update_flags(this, flags); +} + + /** * @brief This will calculate all the distances stored in a route_info * @@ -864,9 +904,11 @@ * * @param this The route to set the position of * @param pos Coordinates to set as position + * @param flags Flags to use for building the graph */ -void -route_set_position(struct route *this, struct pcoord *pos) + +static int +route_set_position_flags(struct route *this, struct pcoord *pos, enum route_path_flags flags) { if (this->pos) route_info_free(this->pos); @@ -874,15 +916,31 @@ this->pos=route_find_nearest_street(this->vehicleprofile, this->ms, pos); // If there is no nearest street, bail out. - if (!this->pos) return; + if (!this->pos) return 0; this->pos->street_direction=0; dbg(1,"this->pos=%p\n", this->pos); route_info_distances(this->pos, pos->pro); - route_path_update(this, 0, 1); + route_path_update_flags(this, flags); + return 1; } /** + * @brief This sets the current position of the route passed + * + * This will set the current position of the route passed to the street that is nearest to the + * passed coordinates. It also automatically updates the route. + * + * @param this The route to set the position of + * @param pos Coordinates to set as position + */ +void +route_set_position(struct route *this, struct pcoord *pos) +{ + route_set_position_flags(this, pos, route_path_flag_async); +} + +/** * @brief Sets a route's current position based on coordinates from tracking * * @param this The route to set the current position of @@ -3854,8 +3912,10 @@ route_set_destination(this_, attr->u.pcoord, 1); return 1; case attr_position: - route_set_position(this_, attr->u.pcoord); + route_set_position_flags(this_, attr->u.pcoord, route_path_flag_async); return 1; + case attr_position_test: + return route_set_position_flags(this_, attr->u.pcoord, route_path_flag_no_rebuild); case attr_vehicle: attr_updated = (this_->v != attr->u.vehicle); this_->v=attr->u.vehicle; @@ -4005,6 +4065,7 @@ void route_destroy(struct route *this_) { + this_->refcount++; /* avoid recursion */ route_path_destroy(this_->path2,1); route_graph_destroy(this_->graph); route_clear_destinations(this_); @@ -4013,3 +4074,19 @@ map_destroy(this_->graph_map); g_free(this_); } + +struct object_func route_func = { + attr_route, + (object_func_new)route_new, + (object_func_get_attr)route_get_attr, + (object_func_iter_new)NULL, + (object_func_iter_destroy)NULL, + (object_func_set_attr)route_set_attr, + (object_func_add_attr)route_add_attr, + (object_func_remove_attr)route_remove_attr, + (object_func_init)NULL, + (object_func_destroy)route_destroy, + (object_func_dup)route_dup, + (object_func_ref)navit_object_ref, + (object_func_unref)navit_object_unref, +}; Modified: trunk/navit/navit/route.h =================================================================== --- trunk/navit/navit/route.h 2014-05-29 15:43:30 UTC (rev 5788) +++ trunk/navit/navit/route.h 2014-05-29 15:45:01 UTC (rev 5789) @@ -82,6 +82,7 @@ struct tracking; struct vehicleprofile; struct route *route_new(struct attr *parent, struct attr **attrs); +struct route *route_dup(struct route *orig); void route_set_mapset(struct route *this_, struct mapset *ms); void route_set_profile(struct route *this_, struct vehicleprofile *prof); struct mapset *route_get_mapset(struct route *this_); Modified: trunk/navit/navit/xmlconfig.c =================================================================== --- trunk/navit/navit/xmlconfig.c 2014-05-29 15:43:30 UTC (rev 5788) +++ trunk/navit/navit/xmlconfig.c 2014-05-29 15:45:01 UTC (rev 5789) @@ -247,7 +247,6 @@ { attr_plugin, NEW(plugin_new)}, { attr_polygon, NEW(polygon_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)}, { attr_polyline, NEW(polyline_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)}, - { attr_route, NEW(route_new), GET(route_get_attr), NULL, NULL, SET(route_set_attr), ADD(route_add_attr), REMOVE(route_remove_attr)}, { attr_text, NEW(text_new)}, }; @@ -278,6 +277,8 @@ return &profile_option_func; case attr_roadprofile: return &roadprofile_func; + case attr_route: + return &route_func; case attr_script: return &script_func; case attr_osd: Modified: trunk/navit/navit/xmlconfig.h =================================================================== --- trunk/navit/navit/xmlconfig.h 2014-05-29 15:43:30 UTC (rev 5788) +++ trunk/navit/navit/xmlconfig.h 2014-05-29 15:45:01 UTC (rev 5789) @@ -81,9 +81,9 @@ void *(*unref)(void *); }; -extern struct object_func map_func, mapset_func, navit_func, osd_func, tracking_func, vehicle_func, maps_func, layout_func, roadprofile_func, vehicleprofile_func, layer_func, config_func, profile_option_func, script_func, log_func, speech_func, navigation_func; +extern struct object_func map_func, mapset_func, navit_func, osd_func, tracking_func, vehicle_func, maps_func, layout_func, roadprofile_func, vehicleprofile_func, layer_func, config_func, profile_option_func, script_func, log_func, speech_func, navigation_func, route_func; -#define HAS_OBJECT_FUNC(x) ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_roadprofile || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config || (x) == attr_profile_option || (x) == attr_script || (x) == attr_log || (x) == attr_speech || (x) == attr_navigation) +#define HAS_OBJECT_FUNC(x) ((x) == attr_map || (x) == attr_mapset || (x) == attr_navit || (x) == attr_osd || (x) == attr_trackingo || (x) == attr_vehicle || (x) == attr_maps || (x) == attr_layout || (x) == attr_roadprofile || (x) == attr_vehicleprofile || (x) == attr_layer || (x) == attr_config || (x) == attr_profile_option || (x) == attr_script || (x) == attr_log || (x) == attr_speech || (x) == attr_navigation || (x) == attr_route) #define NAVIT_OBJECT struct object_func *func; int refcount; struct attr **attrs; struct navit_object { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2014-05-29 15:43:33
|
Revision: 5788 http://sourceforge.net/p/navit/code/5788 Author: martin-s Date: 2014-05-29 15:43:30 +0000 (Thu, 29 May 2014) Log Message: ----------- Add:Core:New attribute to test positions for routing Modified Paths: -------------- trunk/navit/navit/attr_def.h Modified: trunk/navit/navit/attr_def.h =================================================================== --- trunk/navit/navit/attr_def.h 2014-05-29 13:36:45 UTC (rev 5787) +++ trunk/navit/navit/attr_def.h 2014-05-29 15:43:30 UTC (rev 5788) @@ -462,6 +462,7 @@ ATTR2(0x000a0000,type_pcoord_begin) ATTR(destination) ATTR(position) +ATTR(position_test) ATTR2(0x000affff,type_pcoord_end) ATTR2(0x000b0000,type_callback_begin) ATTR(resize) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-05-29 13:36:48
|
Revision: 5787 http://sourceforge.net/p/navit/code/5787 Author: sleske Date: 2014-05-29 13:36:45 +0000 (Thu, 29 May 2014) Log Message: ----------- Fix:maptool:Correct pointer arithmetic for attr_strings_buffer; some renaming. Modified Paths: -------------- trunk/navit/navit/maptool/osm.c Modified: trunk/navit/navit/maptool/osm.c =================================================================== --- trunk/navit/navit/maptool/osm.c 2014-05-29 13:36:36 UTC (rev 5786) +++ trunk/navit/navit/maptool/osm.c 2014-05-29 13:36:45 UTC (rev 5787) @@ -68,7 +68,7 @@ char is_in_buffer[BUFFER_SIZE]; char attr_strings_buffer[BUFFER_SIZE*16]; -int attr_strings_buffer_len; +int attr_strings_buffer_free_offset; #define MAX_COORD_COUNT 65536 struct coord coord_buffer[MAX_COORD_COUNT]; @@ -95,7 +95,7 @@ static void attr_longest_match_clear(void); -enum attr_strings { +enum attr_strings_type { attr_string_phone, attr_string_fax, attr_string_email, @@ -888,18 +888,18 @@ static void attr_strings_clear(void) { - attr_strings_buffer_len=0; + attr_strings_buffer_free_offset=0; memset(attr_strings, 0, sizeof(attr_strings)); } static void -attr_strings_save(enum attr_strings id, char *str) +attr_strings_save(enum attr_strings_type id, char *str) { - int len=strlen(str)+1; - dbg_assert(attr_strings_buffer_len+len+1<sizeof(attr_strings_buffer)); - attr_strings[id]=attr_strings_buffer+attr_strings_buffer_len; - g_strlcpy(attr_strings[id], str, len+1); - attr_strings_buffer_len+=len+1; + int str_size=strlen(str)+1; + dbg_assert(attr_strings_buffer_free_offset+str_size<sizeof(attr_strings_buffer)); + attr_strings[id]=attr_strings_buffer+attr_strings_buffer_free_offset; + g_strlcpy(attr_strings[id], str, str_size); + attr_strings_buffer_free_offset+=str_size; } osmid This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-05-29 13:36:39
|
Revision: 5786 http://sourceforge.net/p/navit/code/5786 Author: sleske Date: 2014-05-29 13:36:36 +0000 (Thu, 29 May 2014) Log Message: ----------- Refactor:maptool:Refactor node_item_get, extract node_item_find_index_in_ordered_list. Modified Paths: -------------- trunk/navit/navit/maptool/osm.c Modified: trunk/navit/navit/maptool/osm.c =================================================================== --- trunk/navit/navit/maptool/osm.c 2014-05-29 13:36:26 UTC (rev 5785) +++ trunk/navit/navit/maptool/osm.c 2014-05-29 13:36:36 UTC (rev 5786) @@ -1351,59 +1351,64 @@ } } -static struct node_item * -node_item_get(osmid id) +static int +node_item_find_index_in_ordered_list(osmid id) { - struct node_item *ni=(struct node_item *)(node_buffer.base); - int count=node_buffer.size/sizeof(struct node_item); - int interval=count/4; - int p=count/2; - if(interval==0) { - // If fewer than 4 nodes defined so far set interval to 1 to - // avoid infinite loop - interval = 1; - } - if (node_hash) { - int i; - i=(int)(long)(g_hash_table_lookup(node_hash, (gpointer)(long)(id))); - return ni+i; - } - if (ni[0].id > id) - return NULL; - if (ni[count-1].id < id) - return NULL; - while (ni[p].id != id) { + struct node_item *node_buffer_base=(struct node_item *)(node_buffer.base); + int node_count=node_buffer.size/sizeof(struct node_item); + int search_step=node_count>4 ? node_count/4 : 1; + int search_index=node_count/2; + if (node_buffer_base[0].id > id) + return -1; + if (node_buffer_base[node_count-1].id < id) + return -1; + while (node_buffer_base[search_index].id != id) { #if 0 - fprintf(stderr,"p=%d count=%d interval=%d id=%d ni[p].id=%d\n", p, count, interval, id, ni[p].id); + fprintf(stderr,"search_index=%d node_count=%d search_step=%d id=%d node_buffer_base[search_index].id=%d\n", + search_index, node_count, search_step, id, node_buffer_base[search_index].id); #endif - if (ni[p].id < id) { - p+=interval; - if (interval == 1) { - if (p >= count) - return NULL; - if (ni[p].id > id) - return NULL; + if (node_buffer_base[search_index].id < id) { + search_index+=search_step; + if (search_step == 1) { + if (search_index >= node_count) + return -1; + if (node_buffer_base[search_index].id > id) + return -1; } else { - if (p >= count) - p=count-1; + if (search_index >= node_count) + search_index=node_count-1; } } else { - p-=interval; - if (interval == 1) { - if (p < 0) - return NULL; - if (ni[p].id < id) - return NULL; + search_index-=search_step; + if (search_step == 1) { + if (search_index < 0) + return -1; + if (node_buffer_base[search_index].id < id) + return -1; } else { - if (p < 0) - p=0; + if (search_index < 0) + search_index=0; } } - if (interval > 1) - interval/=2; + if (search_step > 1) + search_step/=2; } - return &ni[p]; + return search_index; } + +static struct node_item * +node_item_get(osmid id) +{ + struct node_item *node_buffer_base=(struct node_item *)(node_buffer.base); + int result_index; + if (node_hash) { + result_index=(int)(long)(g_hash_table_lookup(node_hash, (gpointer)(long)(id))); + } else { + result_index=node_item_find_index_in_ordered_list(id); + } + return result_index!=-1 ? node_buffer_base+result_index : NULL; +} + #if 0 static int load_node(FILE *coords, int p, struct node_item *ret) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-05-29 13:36:29
|
Revision: 5785 http://sourceforge.net/p/navit/code/5785 Author: sleske Date: 2014-05-29 13:36:26 +0000 (Thu, 29 May 2014) Log Message: ----------- Refactor:maptool:Better names, add comments, remove unused parameter. Modified Paths: -------------- trunk/navit/navit/maptool/boundaries.c trunk/navit/navit/maptool/itembin.c trunk/navit/navit/maptool/itembin_buffer.c trunk/navit/navit/maptool/maptool.h trunk/navit/navit/maptool/osm.c trunk/navit/navit/maptool/osm_relations.c Modified: trunk/navit/navit/maptool/boundaries.c =================================================================== --- trunk/navit/navit/maptool/boundaries.c 2014-05-29 13:36:13 UTC (rev 5784) +++ trunk/navit/navit/maptool/boundaries.c 2014-05-29 13:36:26 UTC (rev 5785) @@ -268,7 +268,7 @@ c++; } if (f) { - struct item_bin *ib=item_bin; + struct item_bin *ib=tmp_item_bin; item_bin_init(ib, type_selected_line); item_bin_add_coord(ib, gs->first, gs->last-gs->first+1); item_bin_write(ib, f); @@ -281,7 +281,7 @@ fu=tempfile("",name,1); g_free(name); } - ib=item_bin; + ib=tmp_item_bin; item_bin_init(ib, type_selected_point); item_bin_add_coord(ib, gs->first, 1); item_bin_write(ib, fu); @@ -344,7 +344,7 @@ struct relations *relations=relations_new(); boundaries_list=process_boundaries_setup(boundaries, relations); - relations_process(relations, NULL, ways, NULL); + relations_process(relations, NULL, ways); relations_destroy(relations); return process_boundaries_finish(boundaries_list); } Modified: trunk/navit/navit/maptool/itembin.c =================================================================== --- trunk/navit/navit/maptool/itembin.c 2014-05-29 13:36:13 UTC (rev 5784) +++ trunk/navit/navit/maptool/itembin.c 2014-05-29 13:36:26 UTC (rev 5785) @@ -55,11 +55,11 @@ void -item_bin_add_coord(struct item_bin *ib, struct coord *c, int count) +item_bin_add_coord(struct item_bin *ib, struct coord *coords_to_add, int count) { - struct coord *c2=(struct coord *)(ib+1); - c2+=ib->clen/2; - memcpy(c2, c, count*sizeof(struct coord)); + struct coord *coord_list=(struct coord *)(ib+1); + coord_list+=ib->clen/2; + memcpy(coord_list, coords_to_add, count*sizeof(struct coord)); ib->clen+=count*2; ib->len+=count*2; } Modified: trunk/navit/navit/maptool/itembin_buffer.c =================================================================== --- trunk/navit/navit/maptool/itembin_buffer.c 2014-05-29 13:36:13 UTC (rev 5784) +++ trunk/navit/navit/maptool/itembin_buffer.c 2014-05-29 13:36:26 UTC (rev 5785) @@ -22,28 +22,31 @@ #include "debug.h" -static char buffer[2000000]; -struct item_bin *item_bin=(struct item_bin *)(void *)buffer; -static struct node_item *node_item=(struct node_item *)(void *)buffer; +/** Buffer for temporarily storing an item. */ +static char misc_item_buffer[2000000]; +/** An item_bin for temporary use. */ +struct item_bin *tmp_item_bin=(struct item_bin *)(void *)misc_item_buffer; +/** A node_item for temporary use. */ +static struct node_item *tmp_node_item=(struct node_item *)(void *)misc_item_buffer; struct node_item * read_node_item(FILE *in) { - if (fread(node_item, sizeof(struct node_item), 1, in) != 1) + if (fread(tmp_node_item, sizeof(struct node_item), 1, in) != 1) return NULL; - return node_item; + return tmp_node_item; } struct item_bin * read_item(FILE *in) { - struct item_bin *ib=(struct item_bin *) buffer; + struct item_bin *ib=(struct item_bin *) misc_item_buffer; for (;;) { switch (item_bin_read(ib, in)) { case 0: return NULL; case 2: - dbg_assert((ib->len+1)*4 < sizeof(buffer)); + dbg_assert((ib->len+1)*4 < sizeof(misc_item_buffer)); bytes_read+=(ib->len+1)*sizeof(int); return ib; default: @@ -67,7 +70,7 @@ struct item_bin * init_item(enum item_type type) { - struct item_bin *ib=(struct item_bin *) buffer; + struct item_bin *ib=(struct item_bin *) misc_item_buffer; item_bin_init(ib, type); return ib; Modified: trunk/navit/navit/maptool/maptool.h =================================================================== --- trunk/navit/navit/maptool/maptool.h 2014-05-29 13:36:13 UTC (rev 5784) +++ trunk/navit/navit/maptool/maptool.h 2014-05-29 13:36:26 UTC (rev 5785) @@ -214,6 +214,7 @@ struct item_bin *read_item(FILE *in); struct item_bin *read_item_range(FILE *in, int *min, int *max); struct item_bin *init_item(enum item_type type); +extern struct item_bin *tmp_item_bin; /* maptool.c */ @@ -225,7 +226,6 @@ extern int slices; extern struct buffer node_buffer; extern int processed_nodes, processed_nodes_out, processed_ways, processed_relations, processed_tiles; -extern struct item_bin *item_bin; extern int bytes_read; extern int overlap; extern int unknown_country; @@ -312,7 +312,7 @@ struct relations * relations_new(void); struct relations_func *relations_func_new(void (*func)(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv), void *func_priv); void relations_add_func(struct relations *rel, struct relations_func *func, void *relation_priv, void *member_priv, int type, osmid id); -void relations_process(struct relations *rel, FILE *nodes, FILE *ways, FILE *relations); +void relations_process(struct relations *rel, FILE *nodes, FILE *ways); void relations_destroy(struct relations *rel); Modified: trunk/navit/navit/maptool/osm.c =================================================================== --- trunk/navit/navit/maptool/osm.c 2014-05-29 13:36:13 UTC (rev 5784) +++ trunk/navit/navit/maptool/osm.c 2014-05-29 13:36:26 UTC (rev 5785) @@ -1267,7 +1267,10 @@ } -osmid nodeid_last; +/** The node currently being processed. */ +static struct node_item *current_node; +/** ID of the last node processed. */ +osmid id_last_node; GHashTable *node_hash,*way_hash; static void @@ -1279,8 +1282,6 @@ g_hash_table_insert(node_hash, (gpointer)(long)(ni[i].id), (gpointer)(long)i); } -static struct node_item *ni; - void flush_nodes(int final) { @@ -1311,26 +1312,28 @@ if (node_buffer.size + sizeof(struct node_item) > slice_size) { flush_nodes(0); } - ni=(struct node_item *)(node_buffer.base+node_buffer.size); - ni->id=id; - ni->ref_node=0; - ni->ref_way=0; - ni->ref_ref=0; - ni->dummy=0; - ni->c.x=lon*6371000.0*M_PI/180; - ni->c.y=log(tan(M_PI_4+lat*M_PI/360))*6371000.0; + current_node=(struct node_item *)(node_buffer.base+node_buffer.size); + current_node->id=id; + current_node->ref_node=0; + current_node->ref_way=0; + current_node->ref_ref=0; + current_node->dummy=0; + current_node->c.x=lon*6371000.0*M_PI/180; + current_node->c.y=log(tan(M_PI_4+lat*M_PI/360))*6371000.0; node_buffer.size+=sizeof(struct node_item); if (! node_hash) { - if (ni->id > nodeid_last) { - nodeid_last=ni->id; + if (current_node->id > id_last_node) { + id_last_node=current_node->id; } else { - fprintf(stderr,"INFO: Nodes out of sequence (new " OSMID_FMT " vs old " OSMID_FMT "), adding hash\n", (osmid)ni->id, nodeid_last); + fprintf(stderr,"INFO: Nodes out of sequence (new " OSMID_FMT " vs old " OSMID_FMT "), adding hash\n", + (osmid)current_node->id, id_last_node); node_hash=g_hash_table_new(NULL, NULL); node_buffer_to_hash(); } } else - if (!g_hash_table_lookup(node_hash, (gpointer)(long)(ni->id))) - g_hash_table_insert(node_hash, (gpointer)(long)(ni->id), (gpointer)(long)(ni-(struct node_item *)node_buffer.base)); + if (!g_hash_table_lookup(node_hash, (gpointer)(long)(current_node->id))) + g_hash_table_insert(node_hash, (gpointer)(long)(current_node->id), + (gpointer)(long)(current_node-(struct node_item *)node_buffer.base)); else { node_buffer.size-=sizeof(struct node_item); nodeid=0; @@ -1520,8 +1523,8 @@ iso_code[0]='\0'; admin_level=-1; boundary=0; - item_bin_init(item_bin, type_none); - item_bin_add_attr_longlong(item_bin, attr_osm_relationid, osmid_attr_value); + item_bin_init(tmp_item_bin, type_none); + item_bin_add_attr_longlong(tmp_item_bin, attr_osm_relationid, osmid_attr_value); } static int @@ -1569,7 +1572,7 @@ in_relation=0; if(attr_longest_match(attr_mapping_rel2poly_place, attr_mapping_rel2poly_place_count, &type, 1)) { - item_bin->type=type; + tmp_item_bin->type=type; } else type=type_none; @@ -1581,18 +1584,18 @@ fprintf(stderr,"Multipolygon for %s\n", iso_code); char *name=g_strdup_printf("country_%s.tmp",iso_code); f=fopen(name,"w"); - item_bin_write(item_bin, f); + item_bin_write(tmp_item_bin, f); fclose(f); } #endif - item_bin_write(item_bin, osm->boundaries); + item_bin_write(tmp_item_bin, osm->boundaries); } - if (!strcmp(relation_type, "restriction") && (item_bin->type == type_street_turn_restriction_no || item_bin->type == type_street_turn_restriction_only)) - item_bin_write(item_bin, osm->turn_restrictions); + if (!strcmp(relation_type, "restriction") && (tmp_item_bin->type == type_street_turn_restriction_no || tmp_item_bin->type == type_street_turn_restriction_only)) + item_bin_write(tmp_item_bin, osm->turn_restrictions); if (!strcmp(relation_type, "associatedStreet") ) - item_bin_write(item_bin, osm->associated_streets); + item_bin_write(tmp_item_bin, osm->associated_streets); attr_longest_match_clear(); } @@ -1606,7 +1609,7 @@ snprintf(member_buffer,bufsize,"%d:"LONGLONG_FMT":%s", type, (long long) ref, role); memberattr.u.str=member_buffer; - item_bin_add_attr(item_bin, &memberattr); + item_bin_add_attr(tmp_item_bin, &memberattr); } static void @@ -1622,13 +1625,13 @@ } else if (!strcmp(k,"restriction")) { if (!strncmp(v,"no_",3)) { - item_bin->type=type_street_turn_restriction_no; + tmp_item_bin->type=type_street_turn_restriction_no; add_tag=0; } else if (!strncmp(v,"only_",5)) { - item_bin->type=type_street_turn_restriction_only; + tmp_item_bin->type=type_street_turn_restriction_only; add_tag=0; } else { - item_bin->type=type_none; + tmp_item_bin->type=type_none; osm_warning("relation", osmid_attr_value, 0, "Unknown restriction %s\n",v); } } else if (!strcmp(k,"admin_level")) { @@ -1644,7 +1647,7 @@ char *tag; tag=g_alloca(strlen(k)+strlen(v)+2); sprintf(tag,"%s=%s",k,v); - item_bin_add_attr_string(item_bin, attr_osm_tag, tag); + item_bin_add_attr_string(tmp_item_bin, attr_osm_tag, tag); } osm_update_attr_present(k,v); @@ -1800,7 +1803,7 @@ item_bin=init_item(types[i]); if (item_is_town(*item_bin) && attr_strings[attr_string_population]) item_bin_set_type_by_population(item_bin, atoi(attr_strings[attr_string_population])); - item_bin_add_coord(item_bin, &ni->c, 1); + item_bin_add_coord(item_bin, ¤t_node->c, 1); item_bin_add_attr_string(item_bin, item_is_town(*item_bin) ? attr_town_name : attr_label, attr_strings[attr_string_label]); item_bin_add_attr_string(item_bin, attr_house_number, attr_strings[attr_string_house_number]); item_bin_add_attr_string(item_bin, attr_street_name, attr_strings[attr_string_street_name]); @@ -1821,7 +1824,7 @@ item_bin_write(item_bin,osm->nodes); if (item_is_town(*item_bin) && attr_strings[attr_string_label] && osm->towns) { item_bin=init_item(item_bin->type); - item_bin_add_coord(item_bin, &ni->c, 1); + item_bin_add_coord(item_bin, ¤t_node->c, 1); item_bin_add_attr_string(item_bin, attr_osm_is_in, is_in_buffer); item_bin_add_attr_longlong(item_bin, attr_osm_nodeid, osmid_attr_value); item_bin_add_attr_string(item_bin, attr_town_postal, postal); @@ -2118,13 +2121,12 @@ char *role; }; -static int -get_relation_member(char *str, struct relation_member *memb) +static void +parse_relation_member_string(char *relation_member_string, struct relation_member *memb) { int len; - sscanf(str,"%d:"LONGLONG_FMT":%n",&memb->type,&memb->id,&len); - memb->role=str+len; - return 1; + sscanf(relation_member_string,"%d:"LONGLONG_FMT":%n",&memb->type,&memb->id,&len); + memb->role=relation_member_string+len; } static int @@ -2133,8 +2135,7 @@ char *str=NULL; int count=0; while ((str=item_bin_get_attr(ib, attr_osm_member, str))) { - if (!get_relation_member(str, memb)) - return 0; + parse_relation_member_string(str, memb); count++; if (!strcmp(memb->role, role) && (!min_count || *min_count < count)) { if (min_count) @@ -2356,21 +2357,21 @@ /* Set noname relations names from their street members */ fseek(ways_in, 0, SEEK_SET); - relations_process(relations, NULL, ways_in, NULL); + relations_process(relations, NULL, ways_in); /* Set street names on all members */ fp.out=ways_out; fseek(ways_in, 0, SEEK_SET); - relations_process(relations, NULL, ways_in, NULL); + relations_process(relations, NULL, ways_in); fp.out=nodes_out; fseek(nodes_in, 0, SEEK_SET); - relations_process(relations, NULL, nodes_in, NULL); + relations_process(relations, NULL, nodes_in); if(nodes2_in) { fp.out=nodes2_out; fseek(nodes2_in, 0, SEEK_SET); - relations_process(relations, NULL, nodes2_in, NULL); + relations_process(relations, NULL, nodes2_in); } relations_destroy(relations); @@ -2455,7 +2456,7 @@ while (l) { struct turn_restriction *t=l->data; struct coord *c[4]; - struct item_bin *ib=item_bin; + struct item_bin *ib=tmp_item_bin; if (!t->c_count[0]) { osm_warning("relation",t->relid,0,"turn restriction: from member not found\n"); @@ -2585,7 +2586,7 @@ GList *turn_restrictions; fseek(in, 0, SEEK_SET); turn_restrictions=process_turn_restrictions_setup(in, relations); - relations_process(relations, coords, ways, NULL); + relations_process(relations, coords, ways); process_turn_restrictions_finish(turn_restrictions, out); relations_destroy(relations); } @@ -2720,7 +2721,7 @@ char *str=NULL; struct relation_member member; while ((str=item_bin_get_attr(ib, attr_osm_member, str))) { - if (!get_relation_member(str, &member)) + if (!parse_relation_member_string(str, &member)) break; if (member.type == 2) { if (!seek_to_way(way, ways_index, member.id)) { Modified: trunk/navit/navit/maptool/osm_relations.c =================================================================== --- trunk/navit/navit/maptool/osm_relations.c 2014-05-29 13:36:13 UTC (rev 5784) +++ trunk/navit/navit/maptool/osm_relations.c 2014-05-29 13:36:26 UTC (rev 5785) @@ -104,10 +104,9 @@ * @param in rel struct relations storing pre-processed relations info * @param in nodes file containing nodes in "coords.tmp" format * @param in ways file containing items in item_bin format. This file may contain both nodes, ways, and relations in that format. - * @param unused relations */ void -relations_process(struct relations *rel, FILE *nodes, FILE *ways, FILE *relations) +relations_process(struct relations *rel, FILE *nodes, FILE *ways) { char buffer[128]; struct item_bin *ib=(struct item_bin *)buffer; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-05-29 13:36:16
|
Revision: 5784 http://sourceforge.net/p/navit/code/5784 Author: sleske Date: 2014-05-29 13:36:13 +0000 (Thu, 29 May 2014) Log Message: ----------- Fix:maptool:Refactoring & better error message for too many nodes in a way. Modified Paths: -------------- trunk/navit/navit/maptool/osm.c Modified: trunk/navit/navit/maptool/osm.c =================================================================== --- trunk/navit/navit/maptool/osm.c 2014-05-29 13:36:03 UTC (rev 5783) +++ trunk/navit/navit/maptool/osm.c 2014-05-29 13:36:13 UTC (rev 5784) @@ -70,9 +70,9 @@ char attr_strings_buffer[BUFFER_SIZE*16]; int attr_strings_buffer_len; +#define MAX_COORD_COUNT 65536 +struct coord coord_buffer[MAX_COORD_COUNT]; -struct coord coord_buffer[65536]; - struct attr_mapping { enum item_type type; int attr_present_idx_count; @@ -115,9 +115,10 @@ char *osm_types[]={"unknown","node","way","relation"}; -#define IS_REF(c) ((c).x >= (1 << 30)) -#define REF(c) ((unsigned)(c).y) -#define SET_REF(c,ref) do { (c).x = 1 << 30; (c).y = ref ; } while(0) +#define REF_MARKER (1 << 30) +#define IS_REF(c) ((c).x == REF_MARKER) +#define GET_REF(c) ((unsigned)(c).y) +#define SET_REF(c,ref) do { (c).x = REF_MARKER; (c).y = ref ; } while(0) /* Table of country codes with possible is_in spellings. * Note: If you update this list, check also country array in country.c @@ -2773,7 +2774,7 @@ int i; struct coord *c=(struct coord *)(ib+1); for (i = 0 ; i < ib->clen/2 ; i++) - node_ref_way(REF(c[i])); + node_ref_way(GET_REF(c[i])); } @@ -2782,8 +2783,8 @@ { SET_REF(coord_buffer[coord_count], ref); coord_count++; - if (coord_count > 65536) { - fprintf(stderr,"ERROR: Overflow\n"); + if (coord_count > MAX_COORD_COUNT) { + fprintf(stderr,"ERROR: Overflow - more than %d coordinates in one way.\n", MAX_COORD_COUNT); exit(1); } } @@ -2851,7 +2852,7 @@ for (i = 0 ; i < ib->clen/2 ; i++) { if(!IS_REF(c[i])) continue; - ni=node_item_get(REF(c[i])); + ni=node_item_get(GET_REF(c[i])); if(ni) { c[i].x=ni->c.x; c[i].y=ni->c.y; @@ -2938,7 +2939,7 @@ last=0; for (i = 0 ; i < ccount ; i++) { if (IS_REF(c[i])) { - ndref=REF(c[i]); + ndref=GET_REF(c[i]); ni=node_item_get(ndref); if (ni) { c[i]=ni->c; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-05-29 13:36:06
|
Revision: 5783 http://sourceforge.net/p/navit/code/5783 Author: sleske Date: 2014-05-29 13:36:03 +0000 (Thu, 29 May 2014) Log Message: ----------- Refactor:core:Better function and variable names for house number interpolation. Modified Paths: -------------- trunk/navit/navit/search.c trunk/navit/navit/search.h Modified: trunk/navit/navit/search.c =================================================================== --- trunk/navit/navit/search.c 2014-05-29 13:35:51 UTC (rev 5782) +++ trunk/navit/navit/search.c 2014-05-29 13:36:03 UTC (rev 5783) @@ -57,8 +57,8 @@ GList *list,*curr,*last; }; -struct interpolation { - int side, mode, rev; +struct house_number_interpolation { + int side, increment, rev; char *first, *last, *curr; }; @@ -71,7 +71,7 @@ struct search_list_result last_result; int last_result_valid; char *postal; - struct interpolation inter; + struct house_number_interpolation inter; int use_address_results; GList *address_results,*address_results_pos; }; @@ -148,9 +148,9 @@ } static void -interpolation_clear(struct interpolation *inter) +house_number_interpolation_clear(struct house_number_interpolation *inter) { - inter->mode=inter->side=0; + inter->increment=inter->side=0; g_free(inter->first); g_free(inter->last); g_free(inter->curr); @@ -372,7 +372,7 @@ this_->use_address_results=0; level=search_list_level(search_attr->type); this_->item=NULL; - interpolation_clear(&this_->inter); + house_number_interpolation_clear(&this_->inter); if (level != -1) { this_->result.id=0; this_->level=level; @@ -654,7 +654,7 @@ } static char * -search_interpolate(struct interpolation *inter) +search_interpolate(struct house_number_interpolation *inter) { dbg(1,"interpolate %s-%s %s\n",inter->first,inter->last,inter->curr); if (!inter->first || !inter->last) @@ -663,7 +663,7 @@ inter->curr=g_strdup(inter->first); else { if (strcmp(inter->curr, inter->last)) { - int next=atoi(inter->curr)+(inter->mode?2:1); + int next=atoi(inter->curr)+(inter->increment); g_free(inter->curr); if (next == atoi(inter->last)) inter->curr=g_strdup(inter->last); @@ -679,7 +679,7 @@ } static void -search_interpolation_split(char *str, struct interpolation *inter) +search_house_number_interpolation_split(char *str, struct house_number_interpolation *inter) { char *pos=strchr(str,'-'); char *first,*last; @@ -708,7 +708,8 @@ } static int -search_setup_interpolation(struct item *item, enum attr_type i0, enum attr_type i1, enum attr_type i2, struct interpolation *inter) +search_setup_house_number_interpolation(struct item *item, enum attr_type i0, enum attr_type i1, enum attr_type i2, + struct house_number_interpolation *inter) { struct attr attr; g_free(inter->first); @@ -717,14 +718,14 @@ inter->first=inter->last=inter->curr=NULL; dbg(1,"setup %s\n",attr_to_name(i0)); if (item_attr_get(item, i0, &attr)) { - search_interpolation_split(attr.u.str, inter); - inter->mode=0; + search_house_number_interpolation_split(attr.u.str, inter); + inter->increment=1; } else if (item_attr_get(item, i1, &attr)) { - search_interpolation_split(attr.u.str, inter); - inter->mode=1; + search_house_number_interpolation_split(attr.u.str, inter); + inter->increment=2; } else if (item_attr_get(item, i2, &attr)) { - search_interpolation_split(attr.u.str, inter); - inter->mode=2; + search_house_number_interpolation_split(attr.u.str, inter); + inter->increment=2; } else return 0; return 1; @@ -740,7 +741,7 @@ } static struct pcoord * -search_house_number_coordinate(struct item *item, struct interpolation *inter) +search_house_number_coordinate(struct item *item, struct house_number_interpolation *inter) { struct pcoord *ret=g_new(struct pcoord, 1); ret->pro = map_projection(item->map); @@ -757,7 +758,7 @@ } else { int count,max=1024; int hn_pos,hn_length; - int step=inter->mode?2:1; + int inter_increment=inter->increment; struct coord *c=g_alloca(sizeof(struct coord)*max); item_coord_rewind(item); count=item_coord_get(item, c, max); @@ -785,7 +786,7 @@ #if 0 hn_distance=distance_sum*hn_pos/hn_length; #else - hn_distance=(distance_sum*hn_pos+distance_sum*step/2)/(hn_length+step); + hn_distance=(distance_sum*hn_pos+distance_sum*inter_increment/2)/(hn_length+inter_increment); #endif dbg(1,"hn_distance=%d\n",hn_distance); i=0; @@ -800,7 +801,7 @@ } static struct search_list_house_number * -search_list_house_number_new(struct item *item, struct interpolation *inter, char *inter_match, int inter_partial) +search_list_house_number_new(struct item *item, struct house_number_interpolation *inter, char *inter_match, int inter_partial) { struct search_list_house_number *ret=g_new0(struct search_list_house_number, 1); struct attr attr; @@ -817,18 +818,18 @@ // dbg(0,"xx2 %s\n",attr.u.str); for (;;) { //dbg(0,"interpolate 11"); - ret->interpolation=1; + ret->house_number_interpolation=1; switch(inter->side) { case 0: //dbg(0,"interpolate 11 0"); inter->side=-1; - search_setup_interpolation(item, attr_house_number_left, attr_house_number_left_odd, attr_house_number_left_even, inter); + search_setup_house_number_interpolation(item, attr_house_number_left, attr_house_number_left_odd, attr_house_number_left_even, inter); case -1: //dbg(0,"interpolate 11 -1"); if ((hn=search_interpolate(inter))) break; inter->side=1; - search_setup_interpolation(item, attr_house_number_right, attr_house_number_right_odd, attr_house_number_right_even, inter); + search_setup_house_number_interpolation(item, attr_house_number_right, attr_house_number_right_odd, attr_house_number_right_even, inter); case 1: //dbg(0,"interpolate 11 1"); if ((hn=search_interpolate(inter))) @@ -849,7 +850,7 @@ } //dbg(0,"interpolate 33"); search_list_common_new(item, &ret->common); - ret->common.c=search_house_number_coordinate(item, ret->interpolation?inter:NULL); + ret->common.c=search_house_number_coordinate(item, ret->house_number_interpolation?inter:NULL); //dbg(0,"interpolate 44"); return ret; } @@ -1163,13 +1164,13 @@ p=search_list_house_number_new(this_->item, &this_->inter, le->attr->u.str, le->partial); if (!p) { - interpolation_clear(&this_->inter); + house_number_interpolation_clear(&this_->inter); this_->item=NULL; continue; } this_->result.house_number=p; - if (!this_->result.house_number->interpolation) + if (!this_->result.house_number->house_number_interpolation) { this_->item=NULL; } else { Modified: trunk/navit/navit/search.h =================================================================== --- trunk/navit/navit/search.h 2014-05-29 13:35:51 UTC (rev 5782) +++ trunk/navit/navit/search.h 2014-05-29 13:36:03 UTC (rev 5783) @@ -59,7 +59,7 @@ struct search_list_house_number { struct search_list_common common; char *house_number; - int interpolation; + int house_number_interpolation; }; struct search_list_result { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sl...@us...> - 2014-05-29 13:35:56
|
Revision: 5782 http://sourceforge.net/p/navit/code/5782 Author: sleske Date: 2014-05-29 13:35:51 +0000 (Thu, 29 May 2014) Log Message: ----------- Refactor:core:Use GLib define, use g_hash_table_new. Modified Paths: -------------- trunk/navit/navit/event_glib.c trunk/navit/navit/maptool/osm_relations.c Modified: trunk/navit/navit/event_glib.c =================================================================== --- trunk/navit/navit/event_glib.c 2014-05-29 13:35:39 UTC (rev 5781) +++ trunk/navit/navit/event_glib.c 2014-05-29 13:35:51 UTC (rev 5782) @@ -145,7 +145,7 @@ { struct event_idle *ret=g_new0(struct event_idle, 1); ret->cb=cb; - ret->source = g_idle_add_full(priority+100, (GSourceFunc)event_glib_call_idle, (gpointer)ret, NULL); + ret->source = g_idle_add_full(G_PRIORITY_HIGH_IDLE+priority, (GSourceFunc)event_glib_call_idle, (gpointer)ret, NULL); return ret; } Modified: trunk/navit/navit/maptool/osm_relations.c =================================================================== --- trunk/navit/navit/maptool/osm_relations.c 2014-05-29 13:35:39 UTC (rev 5781) +++ trunk/navit/navit/maptool/osm_relations.c 2014-05-29 13:35:51 UTC (rev 5782) @@ -59,7 +59,7 @@ int i; for (i = 0 ; i < 3 ; i++) - ret->member_hash[i]=g_hash_table_new_full(relations_member_hash, relations_member_equal, NULL, NULL); + ret->member_hash[i]=g_hash_table_new(relations_member_hash, relations_member_equal); return ret; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |