1394 |
#ifdef OSM_QND_XML_PARSER |
#ifdef OSM_QND_XML_PARSER |
1395 |
/* -------------------------- qnd-xml parser tests ------------------- */ |
/* -------------------------- qnd-xml parser tests ------------------- */ |
1396 |
|
|
1397 |
|
#ifdef USE_FLOAT |
1398 |
|
#define GET_PROP_POS(a,b,c) qnd_xml_get_prop_float(a, b, c) |
1399 |
|
#else |
1400 |
|
#define GET_PROP_POS(a,b,c) qnd_xml_get_prop_double(a, b, c) |
1401 |
|
#endif |
1402 |
|
|
1403 |
gboolean osm_bounds_cb(qnd_xml_stack_t *stack, |
gboolean osm_bounds_cb(qnd_xml_stack_t *stack, |
1404 |
qnd_xml_attribute_t *attributes, gpointer data) { |
qnd_xml_attribute_t *attributes, gpointer data) { |
1405 |
|
|
1416 |
bounds->ll_min.lat = bounds->ll_min.lon = NAN; |
bounds->ll_min.lat = bounds->ll_min.lon = NAN; |
1417 |
bounds->ll_max.lat = bounds->ll_max.lon = NAN; |
bounds->ll_max.lat = bounds->ll_max.lon = NAN; |
1418 |
|
|
1419 |
qnd_xml_get_prop_double(attributes, "minlat", &bounds->ll_min.lat); |
GET_PROP_POS(attributes, "minlat", &bounds->ll_min.lat); |
1420 |
qnd_xml_get_prop_double(attributes, "minlon", &bounds->ll_min.lon); |
GET_PROP_POS(attributes, "minlon", &bounds->ll_min.lon); |
1421 |
qnd_xml_get_prop_double(attributes, "maxlat", &bounds->ll_max.lat); |
GET_PROP_POS(attributes, "maxlat", &bounds->ll_max.lat); |
1422 |
qnd_xml_get_prop_double(attributes, "maxlon", &bounds->ll_max.lon); |
GET_PROP_POS(attributes, "maxlon", &bounds->ll_max.lon); |
1423 |
|
|
1424 |
if(isnan(bounds->ll_min.lat) || isnan(bounds->ll_min.lon) || |
if(isnan(bounds->ll_min.lat) || isnan(bounds->ll_min.lon) || |
1425 |
isnan(bounds->ll_max.lat) || isnan(bounds->ll_max.lon)) { |
isnan(bounds->ll_max.lat) || isnan(bounds->ll_max.lon)) { |
1489 |
stack->prev->userdata[1] = &node->next; |
stack->prev->userdata[1] = &node->next; |
1490 |
|
|
1491 |
qnd_xml_get_prop_gulong(attributes, "id", &node->id); |
qnd_xml_get_prop_gulong(attributes, "id", &node->id); |
1492 |
qnd_xml_get_prop_double(attributes, "lat", &node->pos.lat); |
GET_PROP_POS(attributes, "lat", &node->pos.lat); |
1493 |
qnd_xml_get_prop_double(attributes, "lon", &node->pos.lon); |
GET_PROP_POS(attributes, "lon", &node->pos.lon); |
1494 |
node->user = osm_user(osm, qnd_xml_get_prop(attributes, "user")); |
node->user = osm_user(osm, qnd_xml_get_prop(attributes, "user")); |
1495 |
node->visible = qnd_xml_get_prop_is(attributes, "visible", "true"); |
node->visible = qnd_xml_get_prop_is(attributes, "visible", "true"); |
1496 |
node->time = convert_iso8601(qnd_xml_get_prop(attributes, "timestamp")); |
node->time = convert_iso8601(qnd_xml_get_prop(attributes, "timestamp")); |