summaryrefslogtreecommitdiff
path: root/navit/maptool
diff options
context:
space:
mode:
authorsleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2014-07-07 14:28:46 +0000
committersleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2014-07-07 14:28:46 +0000
commit5eadb2061734ad3473654c5a1b3d51c4113b57ab (patch)
tree70cf9d5b658e5982ea3de70ad04b997d79dc566d /navit/maptool
parentfac9c55436bd8ea57a5d4336d7623ba943bf883b (diff)
downloadnavit-svn-5eadb2061734ad3473654c5a1b3d51c4113b57ab.tar.gz
Refactor:maptool:Rename methods, add Doxygen commments.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5808 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/maptool')
-rw-r--r--navit/maptool/boundaries.c2
-rw-r--r--navit/maptool/maptool.c1
-rw-r--r--navit/maptool/maptool.h2
-rw-r--r--navit/maptool/osm.c30
-rw-r--r--navit/maptool/osm_relations.c29
5 files changed, 35 insertions, 29 deletions
diff --git a/navit/maptool/boundaries.c b/navit/maptool/boundaries.c
index ca91fa82..7af41311 100644
--- a/navit/maptool/boundaries.c
+++ b/navit/maptool/boundaries.c
@@ -134,7 +134,7 @@ process_boundaries_setup(FILE *boundaries, struct relations *relations)
osm_warning("way",osm_id,1,"\n");
role=geom_poly_segment_type_none;
}
- relations_add_func(relations, relations_func, boundary, (gpointer)role, 2, osm_id);
+ relations_add_relation_member_entry(relations, relations_func, boundary, (gpointer)role, 2, osm_id);
}
if(member_type==3) {
if (!strcmp(rolestr,"outer") || !strcmp(rolestr,"exclave") || !strcmp(rolestr,"inner") || !strcmp(rolestr,"enclave"))
diff --git a/navit/maptool/maptool.c b/navit/maptool/maptool.c
index a79face7..fbc7c09a 100644
--- a/navit/maptool/maptool.c
+++ b/navit/maptool/maptool.c
@@ -959,6 +959,7 @@ int main(int argc, char **argv)
}
}
if (p.process_relations && p.process_ways && p.process_nodes && start_phase(&p,"processing house number interpolations")) {
+ // OSM house number interpolations are handled like a relation.
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);
diff --git a/navit/maptool/maptool.h b/navit/maptool/maptool.h
index 9bcbe745..aaf91573 100644
--- a/navit/maptool/maptool.h
+++ b/navit/maptool/maptool.h
@@ -323,7 +323,7 @@ int osm_protobufdb_load(FILE *in, char *dir);
/* osm_relations.c */
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_add_relation_member_entry(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);
void relations_destroy(struct relations *rel);
diff --git a/navit/maptool/osm.c b/navit/maptool/osm.c
index 16d0d63c..3714e802 100644
--- a/navit/maptool/osm.c
+++ b/navit/maptool/osm.c
@@ -2289,7 +2289,7 @@ struct process_relation_member_func_priv {
};
static void
-process_associated_street_member(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv)
+process_associated_street_member(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv_unused)
{
struct process_relation_member_func_priv *fp=func_priv;
struct associated_street *rel=relation_priv;
@@ -2324,7 +2324,7 @@ struct house_number_interpolation {
};
static void
-process_house_number_interpolation_member(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv)
+process_house_number_interpolation_member(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv_unused)
{
struct process_relation_member_func_priv *fp=func_priv;
struct house_number_interpolation *rel=relation_priv;
@@ -2375,7 +2375,7 @@ process_house_number_interpolation_member(void *func_priv, void *relation_priv,
}
static void
-relation_func_writethrough(void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv)
+relation_func_writethrough(void *func_priv, void *relation_priv_unused, struct item_bin *member, void *member_priv_unused)
{
FILE *out=*(FILE **)func_priv;
if(out)
@@ -2407,23 +2407,23 @@ process_associated_streets_setup(FILE *in, struct relations *relations, struct p
min_count=0;
while(search_relation_member(ib, "street",&relm,&min_count)) {
if(relm.type==2)
- relations_add_func(relations, relations_func, rel, NULL, relm.type, relm.id);
+ relations_add_relation_member_entry(relations, relations_func, rel, NULL, relm.type, relm.id);
}
min_count=0;
while(search_relation_member(ib, "house",&relm,&min_count)) {
- relations_add_func(relations, relations_func, rel, NULL, relm.type, relm.id);
+ relations_add_relation_member_entry(relations, relations_func, rel, NULL, relm.type, relm.id);
}
min_count=0;
while(search_relation_member(ib, "addr:houselink",&relm,&min_count)) {
- relations_add_func(relations, relations_func, rel, NULL, relm.type, relm.id);
+ relations_add_relation_member_entry(relations, relations_func, rel, NULL, relm.type, relm.id);
}
min_count=0;
while(search_relation_member(ib, "address",&relm,&min_count)) {
- relations_add_func(relations, relations_func, rel, NULL, relm.type, relm.id);
+ relations_add_relation_member_entry(relations, relations_func, rel, NULL, relm.type, relm.id);
}
}
relations_func=relations_func_new(relation_func_writethrough, &fp->out);
- relations_add_func(relations, relations_func, NULL, NULL, -1, 0);
+ relations_add_relation_member_entry(relations, relations_func, NULL, NULL, -1, 0);
}
void
@@ -2472,11 +2472,11 @@ process_house_number_interpolations_setup(FILE *in, struct relations *relations,
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_relation_member_entry(relations, relations_func_process_hn_interpol, hn_interpol, NULL, 1, hn_interpol->nodeid_first_node);
+ relations_add_relation_member_entry(relations, relations_func_process_hn_interpol, hn_interpol, NULL, 1, hn_interpol->nodeid_last_node);
+ relations_add_relation_member_entry(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);
+ relations_add_relation_member_entry(relations, relations_func_new(relation_func_writethrough, &fp->out), NULL, NULL, -1, 0);
}
void
@@ -2707,9 +2707,9 @@ process_turn_restrictions_setup(FILE *in, struct relations *relations)
turn_restriction->type=ib->type;
turn_restriction->r.l.x=1<<30;
turn_restriction->order=255;
- relations_add_func(relations, relations_func, turn_restriction, (gpointer) 0, fromm.type, fromm.id);
- relations_add_func(relations, relations_func, turn_restriction, (gpointer) 1, viam.type, viam.id);
- relations_add_func(relations, relations_func, turn_restriction, (gpointer) 2, tom.type, tom.id);
+ relations_add_relation_member_entry(relations, relations_func, turn_restriction, (gpointer) 0, fromm.type, fromm.id);
+ relations_add_relation_member_entry(relations, relations_func, turn_restriction, (gpointer) 1, viam.type, viam.id);
+ relations_add_relation_member_entry(relations, relations_func, turn_restriction, (gpointer) 2, tom.type, tom.id);
turn_restrictions=g_list_append(turn_restrictions, turn_restriction);
}
return turn_restrictions;
diff --git a/navit/maptool/osm_relations.c b/navit/maptool/osm_relations.c
index 10174df3..960afa94 100644
--- a/navit/maptool/osm_relations.c
+++ b/navit/maptool/osm_relations.c
@@ -73,18 +73,21 @@ relations_func_new(void (*func)(void *func_priv, void *relation_priv, struct ite
}
/*
- * @brief Add a relation member to relations collection.
- * @param in rel relations collection to add the new member to.
- * @param in funct structure defining function to call when this member is read
- * @param in relation_priv parameter describing relation. Will be passed to funct function
- * @param in member_priv parameter describing member function. Will be passed to funct function
- * @param in type This member type: 1 - node, 2 - way, 3 - relation.
- * Set to -1 to add a default member action which matches any item of any type which is not a member of any relation.
- * @param in osmid This member id
- * @param unused relations
+ * @brief Add an entry for a relation member to the relations collection.
+ * This function fills the relations collection, which is then passed to relations_process for
+ * processing.
+ * @param in rel relations collection to add the new member to
+ * @param in func structure defining function to call when this member is read
+ * @param in relation_priv parameter describing relation, or NULL. Will be passed to func function.
+ * @param in member_priv parameter describing relation member, or NULL. Will be passed to func function.
+ * @param in type This member type: 1 - node, 2 - way, 3 - relation.
+ * Set to -1 to add a default member entry which matches any map item of any type which
+ * is not a member of any relation.
+ * @param in id OSM ID of relation member.
*/
void
-relations_add_func(struct relations *rel, struct relations_func *func, void *relation_priv, void *member_priv, int type, osmid id)
+relations_add_relation_member_entry(struct relations *rel, struct relations_func *func, void
+ *relation_priv, void *member_priv, int type, osmid id)
{
struct relations_member *memb=g_new(struct relations_member, 1);
@@ -100,8 +103,10 @@ relations_add_func(struct relations *rel, struct relations_func *func, void *rel
}
/*
- * @brief Process relations members from the file.
- * @param in rel struct relations storing pre-processed relations info
+ * @brief The actual relations processing: Loop through raw data and process any relations members.
+ * This function reads through all nodes and ways passed in, and looks up each item in the
+ * relations collection. For each relation member found, its processing function is called.
+ * @param in rel relations collection storing pre-processed relations. Built using relations_add_relation_member_entry.
* @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.
*/