322FUNCTION readosm_parse_f(osm_handle, user_data, node_fnct, way_fnct, &
330 TYPE(readosm_node) :: node
331 INTEGER(kind=c_int) :: node_fnct
332 END FUNCTION node_fnct
337 FUNCTION way_fnct(user_data, way)
BIND(C)
339 TYPE(c_ptr),
VALUE :: user_data
341 INTEGER(kind=c_int) :: way_fnct
342 END FUNCTION way_fnct
347 FUNCTION relation_fnct(user_data, relation)
BIND(C)
349 TYPE(c_ptr),
VALUE :: user_data
351 INTEGER(kind=c_int) :: relation_fnct
352 END FUNCTION relation_fnct
357OPTIONAL :: relation_fnct
358INTEGER(kind=c_int) :: readosm_parse_f
360TYPE(c_funptr) :: nf, wf, rf
362IF (
present(node_fnct))
THEN
363 nf = c_funloc(node_fnct)
367IF (
present(way_fnct))
THEN
368 wf = c_funloc(way_fnct)
372IF (
present(relation_fnct))
THEN
373 rf = c_funloc(relation_fnct)
378readosm_parse_f =
readosm_parse(osm_handle, user_data, nf, wf, rf)
380END FUNCTION readosm_parse_f
386SUBROUTINE readosm_object_f_tags(tags, tag_count, f_type)
388INTEGER(kind=c_int) :: tag_count;
395IF (tag_count > 0 .AND. c_associated(tags))
THEN
396 CALL c_f_pointer(tags, tmptags, (/tag_count/))
397 ALLOCATE(f_type(tag_count))
399 f_type(i)%key = tmptags(i)%key
400 f_type(i)%value = tmptags(i)%value
406END SUBROUTINE readosm_object_f_tags
412SUBROUTINE readosm_object_f_members(members, member_count, f_type)
413TYPE(c_ptr) :: members
414INTEGER(kind=c_int) :: member_count;
421IF (member_count > 0 .AND. c_associated(members))
THEN
422 CALL c_f_pointer(members, tmpmembers, (/member_count/))
423 ALLOCATE(f_type(member_count))
424 DO i = 1, member_count
425 f_type(i)%member_type = tmpmembers(i)%member_type
426 f_type(i)%id = tmpmembers(i)%id
427 f_type(i)%role = tmpmembers(i)%role
433END SUBROUTINE readosm_object_f_members
436FUNCTION readosm_object_f_node(c_type)
RESULT(f_type)
442f_type%latitude = c_type%latitude
443f_type%longitude = c_type%longitude
444f_type%version = c_type%version
445f_type%changeset = c_type%changeset
447f_type%uid = c_type%uid
449CALL readosm_object_f_tags(c_type%tags, c_type%tag_count, f_type%tags)
452END FUNCTION readosm_object_f_node
455FUNCTION readosm_object_f_way(c_type)
RESULT(f_type)
460INTEGER(kind=c_long_long),
POINTER :: node_refs(:)
463f_type%version = c_type%version
464f_type%changeset = c_type%changeset
466f_type%uid = c_type%uid
468IF (c_type%node_ref_count > 0 .AND. c_associated(c_type%node_refs))
THEN
469 CALL c_f_pointer(c_type%node_refs, node_refs, (/c_type%node_ref_count/))
470 f_type%node_refs = node_refs
472 ALLOCATE(f_type%node_refs(0))
474CALL readosm_object_f_tags(c_type%tags, c_type%tag_count, f_type%tags)
477END FUNCTION readosm_object_f_way
480FUNCTION readosm_object_f_relation(c_type)
RESULT(f_type)
486f_type%version = c_type%version
487f_type%changeset = c_type%changeset
489f_type%uid = c_type%uid
491CALL readosm_object_f_members(c_type%members, c_type%member_count, f_type%members)
492CALL readosm_object_f_tags(c_type%tags, c_type%tag_count, f_type%tags)
495END FUNCTION readosm_object_f_relation
501#undef ARRAYOF_ORIGTYPE
503#define ARRAYOF_ORIGTYPE TYPE(readosm_node_f)
504#define ARRAYOF_TYPE arrayof_readosm_node_f
505#include "arrayof_post.F90"
507#undef ARRAYOF_ORIGTYPE
509#define ARRAYOF_ORIGTYPE TYPE(readosm_way_f)
510#define ARRAYOF_TYPE arrayof_readosm_way_f
511#include "arrayof_post.F90"
513#undef ARRAYOF_ORIGTYPE
515#define ARRAYOF_ORIGTYPE TYPE(readosm_relation_f)
516#define ARRAYOF_TYPE arrayof_readosm_relation_f
517#include "arrayof_post.F90"
529FUNCTION readosm_parse_full_f(osm_handle, fulldata)
530TYPE(c_ptr),
VALUE :: osm_handle
531TYPE(readosm_full_f),
INTENT(inout),
TARGET :: fulldata
532INTEGER :: readosm_parse_full_f
535readosm_parse_full_f =
readosm_parse(osm_handle, c_loc(fulldata), &
536 readosm_full_node, readosm_full_way, readosm_full_relation)
542END FUNCTION readosm_parse_full_f
548FUNCTION readosm_full_node(user_data, node)
BIND(C)
549TYPE(c_ptr),
VALUE :: user_data
550TYPE(readosm_node) :: node
551INTEGER(kind=c_int) :: readosm_full_node
553TYPE(readosm_full_f),
POINTER :: fulldata
557CALL c_f_pointer(user_data, fulldata)
558CALL insert(fulldata%nodes, readosm_object_f(node))
560readosm_full_node = readosm_ok
562END FUNCTION readosm_full_node
568FUNCTION readosm_full_way(user_data, way)
BIND(C)
569TYPE(c_ptr),
VALUE :: user_data
571INTEGER(kind=c_int) :: readosm_full_way
577CALL c_f_pointer(user_data, fulldata)
578CALL insert(fulldata%ways, readosm_object_f(way))
580readosm_full_way = readosm_ok
582END FUNCTION readosm_full_way
588FUNCTION readosm_full_relation(user_data, relation)
BIND(C)
589TYPE(c_ptr),
VALUE :: user_data
591INTEGER(kind=c_int) :: readosm_full_relation
597CALL c_f_pointer(user_data, fulldata)
598CALL insert(fulldata%relations, readosm_object_f(relation))
600readosm_full_relation = readosm_ok
602END FUNCTION readosm_full_relation