47 |
xmlNewProp(node, BAD_CAST "state", BAD_CAST "new"); |
xmlNewProp(node, BAD_CAST "state", BAD_CAST "new"); |
48 |
|
|
49 |
/* all items need an id */ |
/* all items need an id */ |
50 |
char *id_str = g_strdup_printf("%ld", id); |
char *id_str = g_strdup_printf(ITEM_ID_FORMAT, id); |
51 |
xmlNewProp(node, BAD_CAST "id", BAD_CAST id_str); |
xmlNewProp(node, BAD_CAST "id", BAD_CAST id_str); |
52 |
g_free(id_str); |
g_free(id_str); |
53 |
} |
} |
69 |
xmlNewProp(node_node, BAD_CAST "lat", BAD_CAST str); |
xmlNewProp(node_node, BAD_CAST "lat", BAD_CAST str); |
70 |
g_ascii_formatd(str, sizeof(str), LL_FORMAT, node->pos.lon); |
g_ascii_formatd(str, sizeof(str), LL_FORMAT, node->pos.lon); |
71 |
xmlNewProp(node_node, BAD_CAST "lon", BAD_CAST str); |
xmlNewProp(node_node, BAD_CAST "lon", BAD_CAST str); |
72 |
snprintf(str, sizeof(str), "%ld", node->time); |
snprintf(str, sizeof(str), "%lu", node->time); |
73 |
xmlNewProp(node_node, BAD_CAST "time", BAD_CAST str); |
xmlNewProp(node_node, BAD_CAST "time", BAD_CAST str); |
74 |
|
|
75 |
diff_save_tags(node->tag, node_node); |
diff_save_tags(node->tag, node_node); |
101 |
while(node_chain) { |
while(node_chain) { |
102 |
xmlNodePtr node_node = xmlNewChild(node_way, NULL, |
xmlNodePtr node_node = xmlNewChild(node_way, NULL, |
103 |
BAD_CAST "nd", NULL); |
BAD_CAST "nd", NULL); |
104 |
char *id = g_strdup_printf("%ld", node_chain->node->id); |
char *id = g_strdup_printf(ITEM_ID_FORMAT, node_chain->node->id); |
105 |
xmlNewProp(node_node, BAD_CAST "ref", BAD_CAST id); |
xmlNewProp(node_node, BAD_CAST "ref", BAD_CAST id); |
106 |
g_free(id); |
g_free(id); |
107 |
node_chain = node_chain->next; |
node_chain = node_chain->next; |
135 |
switch(member->object.type) { |
switch(member->object.type) { |
136 |
case NODE: |
case NODE: |
137 |
xmlNewProp(node_member, BAD_CAST "type", BAD_CAST "node"); |
xmlNewProp(node_member, BAD_CAST "type", BAD_CAST "node"); |
138 |
ref = g_strdup_printf("%ld", member->object.node->id); |
ref = g_strdup_printf(ITEM_ID_FORMAT, member->object.node->id); |
139 |
break; |
break; |
140 |
case WAY: |
case WAY: |
141 |
xmlNewProp(node_member, BAD_CAST "type", BAD_CAST "way"); |
xmlNewProp(node_member, BAD_CAST "type", BAD_CAST "way"); |
142 |
ref = g_strdup_printf("%ld", member->object.way->id); |
ref = g_strdup_printf(ITEM_ID_FORMAT, member->object.way->id); |
143 |
break; |
break; |
144 |
case RELATION: |
case RELATION: |
145 |
xmlNewProp(node_member, BAD_CAST "type", BAD_CAST "relation"); |
xmlNewProp(node_member, BAD_CAST "type", BAD_CAST "relation"); |
146 |
ref = g_strdup_printf("%ld", member->object.relation->id); |
ref = g_strdup_printf(ITEM_ID_FORMAT, member->object.relation->id); |
147 |
break; |
break; |
148 |
|
|
149 |
/* XXX_ID's are used if this is a reference to an item not */ |
/* XXX_ID's are used if this is a reference to an item not */ |
150 |
/* stored in this xml data set */ |
/* stored in this xml data set */ |
151 |
case NODE_ID: |
case NODE_ID: |
152 |
xmlNewProp(node_member, BAD_CAST "type", BAD_CAST "node"); |
xmlNewProp(node_member, BAD_CAST "type", BAD_CAST "node"); |
153 |
ref = g_strdup_printf("%ld", member->object.id); |
ref = g_strdup_printf(ITEM_ID_FORMAT, member->object.id); |
154 |
break; |
break; |
155 |
case WAY_ID: |
case WAY_ID: |
156 |
xmlNewProp(node_member, BAD_CAST "type", BAD_CAST "way"); |
xmlNewProp(node_member, BAD_CAST "type", BAD_CAST "way"); |
157 |
ref = g_strdup_printf("%ld", member->object.id); |
ref = g_strdup_printf(ITEM_ID_FORMAT, member->object.id); |
158 |
break; |
break; |
159 |
case RELATION_ID: |
case RELATION_ID: |
160 |
xmlNewProp(node_member, BAD_CAST "type", BAD_CAST "relation"); |
xmlNewProp(node_member, BAD_CAST "type", BAD_CAST "relation"); |
161 |
ref = g_strdup_printf("%ld", member->object.id); |
ref = g_strdup_printf(ITEM_ID_FORMAT, member->object.id); |
162 |
break; |
break; |
163 |
|
|
164 |
default: |
default: |