Diff of /trunk/src/osm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 161 by harbaum, Sat Apr 11 11:28:56 2009 UTC revision 171 by harbaum, Tue Apr 28 10:29:52 2009 UTC
# Line 1215  static char *osm_generate_xml(osm_t *osm Line 1215  static char *osm_generate_xml(osm_t *osm
1215    
1216    xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");    xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
1217    xmlNodePtr root_node = xmlNewNode(NULL, BAD_CAST "osm");    xmlNodePtr root_node = xmlNewNode(NULL, BAD_CAST "osm");
 #ifndef API06  
   xmlNewProp(root_node, BAD_CAST "version", BAD_CAST "0.5");  
   xmlNewProp(root_node, BAD_CAST "generator", BAD_CAST PACKAGE " v" VERSION);  
 #endif  
1218    xmlDocSetRootElement(doc, root_node);    xmlDocSetRootElement(doc, root_node);
1219    
1220    switch(type) {    switch(type) {
# Line 1232  static char *osm_generate_xml(osm_t *osm Line 1228  static char *osm_generate_xml(osm_t *osm
1228          snprintf(str, sizeof(str), "%u", (unsigned)node->id);          snprintf(str, sizeof(str), "%u", (unsigned)node->id);
1229          xmlNewProp(node_node, BAD_CAST "id", BAD_CAST str);          xmlNewProp(node_node, BAD_CAST "id", BAD_CAST str);
1230        }        }
 #ifdef API06  
1231        snprintf(str, sizeof(str), "%u", (unsigned)node->version);        snprintf(str, sizeof(str), "%u", (unsigned)node->version);
1232        xmlNewProp(node_node, BAD_CAST "version", BAD_CAST str);        xmlNewProp(node_node, BAD_CAST "version", BAD_CAST str);
1233        snprintf(str, sizeof(str), "%u", (unsigned)changeset);        snprintf(str, sizeof(str), "%u", (unsigned)changeset);
1234        xmlNewProp(node_node, BAD_CAST "changeset", BAD_CAST str);        xmlNewProp(node_node, BAD_CAST "changeset", BAD_CAST str);
 #endif  
1235        g_ascii_formatd(str, sizeof(str), LL_FORMAT, node->pos.lat);        g_ascii_formatd(str, sizeof(str), LL_FORMAT, node->pos.lat);
1236        xmlNewProp(node_node, BAD_CAST "lat", BAD_CAST str);        xmlNewProp(node_node, BAD_CAST "lat", BAD_CAST str);
1237        g_ascii_formatd(str, sizeof(str), LL_FORMAT, node->pos.lon);        g_ascii_formatd(str, sizeof(str), LL_FORMAT, node->pos.lon);
# Line 1252  static char *osm_generate_xml(osm_t *osm Line 1246  static char *osm_generate_xml(osm_t *osm
1246        xmlNodePtr way_node = xmlNewChild(root_node, NULL, BAD_CAST "way", NULL);        xmlNodePtr way_node = xmlNewChild(root_node, NULL, BAD_CAST "way", NULL);
1247        snprintf(str, sizeof(str), "%u", (unsigned)way->id);        snprintf(str, sizeof(str), "%u", (unsigned)way->id);
1248        xmlNewProp(way_node, BAD_CAST "id", BAD_CAST str);        xmlNewProp(way_node, BAD_CAST "id", BAD_CAST str);
 #ifdef API06  
1249        snprintf(str, sizeof(str), "%u", (unsigned)way->version);        snprintf(str, sizeof(str), "%u", (unsigned)way->version);
1250        xmlNewProp(way_node, BAD_CAST "version", BAD_CAST str);        xmlNewProp(way_node, BAD_CAST "version", BAD_CAST str);
1251        snprintf(str, sizeof(str), "%u", (unsigned)changeset);        snprintf(str, sizeof(str), "%u", (unsigned)changeset);
1252        xmlNewProp(way_node, BAD_CAST "changeset", BAD_CAST str);        xmlNewProp(way_node, BAD_CAST "changeset", BAD_CAST str);
 #endif  
1253    
1254        node_chain_t *node_chain = way->node_chain;        node_chain_t *node_chain = way->node_chain;
1255        while(node_chain) {        while(node_chain) {
# Line 1279  static char *osm_generate_xml(osm_t *osm Line 1271  static char *osm_generate_xml(osm_t *osm
1271                                          BAD_CAST "relation", NULL);                                          BAD_CAST "relation", NULL);
1272        snprintf(str, sizeof(str), "%u", (unsigned)relation->id);        snprintf(str, sizeof(str), "%u", (unsigned)relation->id);
1273        xmlNewProp(rel_node, BAD_CAST "id", BAD_CAST str);        xmlNewProp(rel_node, BAD_CAST "id", BAD_CAST str);
 #ifdef API06  
1274        snprintf(str, sizeof(str), "%u", (unsigned)relation->version);        snprintf(str, sizeof(str), "%u", (unsigned)relation->version);
1275        xmlNewProp(rel_node, BAD_CAST "version", BAD_CAST str);        xmlNewProp(rel_node, BAD_CAST "version", BAD_CAST str);
1276        snprintf(str, sizeof(str), "%u", (unsigned)changeset);        snprintf(str, sizeof(str), "%u", (unsigned)changeset);
1277        xmlNewProp(rel_node, BAD_CAST "changeset", BAD_CAST str);        xmlNewProp(rel_node, BAD_CAST "changeset", BAD_CAST str);
 #endif  
1278    
1279        member_t *member = relation->member;        member_t *member = relation->member;
1280        while(member) {        while(member) {
# Line 1531  node_t *osm_node_new(osm_t *osm, gint x, Line 1521  node_t *osm_node_new(osm_t *osm, gint x,
1521    node->visible = TRUE;    node->visible = TRUE;
1522    node->time = time(NULL);    node->time = time(NULL);
1523    
 #ifndef API06  
   /* add created_by tag */  
   node->tag = g_new0(tag_t, 1);  
   node->tag->key = g_strdup("created_by");  
   node->tag->value = g_strdup(PACKAGE " v" VERSION);  
 #endif  
   
1524    /* convert screen position back to ll */    /* convert screen position back to ll */
1525    lpos2pos(osm->bounds, &node->lpos, &node->pos);    lpos2pos(osm->bounds, &node->lpos, &node->pos);
1526    
# Line 1578  way_t *osm_way_new(void) { Line 1561  way_t *osm_way_new(void) {
1561    way->flags = OSM_FLAG_NEW;    way->flags = OSM_FLAG_NEW;
1562    way->time = time(NULL);    way->time = time(NULL);
1563    
 #ifndef API06  
   /* add created_by tag */  
   way->tag = g_new0(tag_t, 1);  
   way->tag->key = g_strdup("created_by");  
   way->tag->value = g_strdup(PACKAGE " v" VERSION);  
 #endif  
   
1564    return way;    return way;
1565  }  }
1566    
# Line 1857  relation_t *osm_relation_new(void) { Line 1833  relation_t *osm_relation_new(void) {
1833    relation->flags = OSM_FLAG_NEW;    relation->flags = OSM_FLAG_NEW;
1834    relation->time = time(NULL);    relation->time = time(NULL);
1835    
 #ifndef API06  
   /* add created_by tag */  
   relation->tag = g_new0(tag_t, 1);  
   relation->tag->key = g_strdup("created_by");  
   relation->tag->value = g_strdup(PACKAGE " v" VERSION);  
 #endif  
   
1836    return relation;    return relation;
1837  }  }
1838    

Legend:
Removed from v.161  
changed lines
  Added in v.171