navit  0.5.3-trunk
osm.c File Reference
#include "navit_lfs.h"
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include "maptool.h"
#include "debug.h"
#include "linguistics.h"
#include "country.h"
#include "file.h"
#include "profile.h"
#include "types.h"
#include "transform.h"

Data Structures

struct  attr_mapping
 
struct  country_table
 
struct  town_country
 
struct  relation_member
 
struct  associated_street
 
struct  process_relation_member_func_priv
 
struct  house_number_interpolation
 
struct  multipolygon
 
struct  process_multipolygon_setup_thread
 worker thread private storage More...
 
struct  turn_restriction
 
struct  process_turn_restrictions_setup_thread
 worker thread private storage More...
 

Macros

#define M_PI   3.14159265358979323846
 
#define M_PI_4   0.785398163397448309616
 
#define MAX_COORD_COUNT   65536
 
#define REF_MARKER   (1ull << 30)
 
#define REF_MASK   (3ull << 30)
 
#define IS_REF(c)   (((c).x & REF_MASK)==REF_MARKER)
 
#define GET_REF(c)   ((((osmid)(c).x & ~REF_MARKER)<<31) + (c).y )
 
#define SET_REF(c, ref)   do { (c).x = REF_MARKER | ((osmid)(ref)>>31); (c).y = (osmid)(ref) & 0x7fffffffull; } while(0)
 
#define MAX_TOWN_ADMIN_LEVELS   11
 

Enumerations

enum  attr_strings_type {
  attr_string_phone , attr_string_fax , attr_string_email , attr_string_url ,
  attr_string_district_name , attr_string_street_name , attr_string_street_name_systematic , attr_string_street_name_systematic_nat ,
  attr_string_street_name_systematic_int , attr_string_ref , attr_string_exit_to , attr_string_street_destination ,
  attr_string_street_destination_forward , attr_string_street_destination_backward , attr_string_house_number , attr_string_label ,
  attr_string_postal , attr_string_population , attr_string_county_name , attr_string_last
}
 

Functions

static void nodes_ref_item_bin (struct item_bin *ib)
 
static int attr_longest_match (struct attr_mapping **mapping, int mapping_count, enum item_type *types, int types_count)
 
static void attr_longest_match_clear (void)
 
static void build_attrmap_line (char *line)
 
static void build_attrmap (FILE *rule_file)
 
static void build_countrytable (void)
 
static void osm_logv (char *prefix, char *objtype, osmid id, int cont, struct coord_geo *geo, char *fmt, va_list ap)
 
void osm_warning (char *type, osmid id, int cont, char *fmt,...)
 
void osm_info (char *type, osmid id, int cont, char *fmt,...)
 
static void itembin_warning (struct item_bin *ib, int cont, char *fmt,...)
 
static void attr_strings_clear (void)
 
static void attr_strings_save (enum attr_strings_type id, char *str)
 
static osmid item_bin_get_nodeid_from_attr (struct item_bin *ib, enum attr_type attr_type)
 
osmid item_bin_get_nodeid (struct item_bin *ib)
 
osmid item_bin_get_wayid (struct item_bin *ib)
 
osmid item_bin_get_relationid (struct item_bin *ib)
 
osmid item_bin_get_id (struct item_bin *ib)
 
static void relation_add_tag (char *k, char *v)
 
static int access_value (char *v)
 
static void osm_update_attr_present (char *k, char *v)
 
void osm_add_tag (char *k, char *v)
 
static void extend_buffer (struct buffer *b)
 
static void node_buffer_to_hash (void)
 
void flush_nodes (int final)
 
static struct node_itemallocate_node_item_in_buffer (void)
 
static void remove_last_node_item_from_buffer (void)
 
void osm_add_node (osmid id, double lat, double lon)
 
void clear_node_item_buffer (void)
 
static long long node_item_find_index_in_ordered_list (osmid id)
 
static struct node_itemnode_item_get (osmid id)
 
void osm_add_way (osmid id)
 
void osm_add_relation (osmid id)
 
static int country_id_from_iso2 (char *iso)
 
static struct country_tablecountry_from_countryid (int id)
 
struct country_tablecountry_from_iso2 (char *iso)
 
static int filter_unknown (struct item_bin *ib)
 
static void osm_end_relation_multipolygon (struct maptool_osm *osm)
 
void osm_end_relation (struct maptool_osm *osm)
 
void osm_add_member (enum relation_member_type type, osmid ref, char *role)
 
void osm_end_way (struct maptool_osm *osm)
 
void osm_end_node (struct maptool_osm *osm)
 
static struct town_countrytown_country_new (struct country_table *country)
 
static void town_country_destroy (struct town_country *tc)
 
static struct town_countrytown_country_list_insert_if_new (GList **town_country_list, struct country_table *country)
 
static GListosm_process_town_unknown_country (void)
 
static char * osm_process_town_get_town_name_from_is_in (struct item_bin *ib, GHashTable *town_hash)
 
static GListosm_process_town_by_is_in (struct item_bin *ib)
 
static void osm_process_town_by_boundary_update_attrs (struct item_bin *town, struct town_country *tc, GList *matches)
 
static GListosm_process_town_by_boundary (GList *bl, struct item_bin *town, struct coord *c)
 
static void osm_town_relations_to_poly (GList *boundaries, FILE *towns_poly)
 
void osm_process_towns (FILE *in, FILE *boundaries, FILE *ways, char *suffix)
 
void sort_countries (int keep_tmpfiles)
 
static void parse_relation_member_string (char *relation_member_string, struct relation_member *memb)
 
static int search_relation_member (struct item_bin *ib, char *role, struct relation_member *memb, int *min_count)
 
static void process_associated_street_member (void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv_unused)
 
static void process_house_number_interpolation_member (void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv_unused)
 
static void relation_func_writethrough (void *func_priv, void *relation_priv_unused, struct item_bin *member, void *member_priv_unused)
 
static void process_associated_streets_setup (FILE *in, struct relations *relations, struct process_relation_member_func_priv *fp)
 
static void g_free_helper (void *data, void *user_data)
 
void process_associated_streets (FILE *in, struct files_relation_processing *files_relproc)
 
static void process_house_number_interpolations_setup (FILE *in, struct relations *relations, struct process_relation_member_func_priv *fp)
 
void process_house_number_interpolations (FILE *in, struct files_relation_processing *files_relproc)
 
static int process_multipolygons_find_match (struct item_bin *part, int part_used, int in_count, struct item_bin **parts, int *used)
 find the nect matching polygon segment This can be used to find the next matching "line" to form a polygon. More...
 
static int is_loop (struct item_bin *start_part, int start_used, struct item_bin *end_part, int end_used)
 
static int process_multipolygons_find_loop (int in_count, struct item_bin **parts, int *sequence, int *used)
 
int process_multipolygons_find_loops (osmid relid, int in_count, struct item_bin **parts, int **scount, int ***sequences, int **direction)
 
int process_multipolygons_loop_dump (struct item_bin **bin, int scount, int *sequence, int *direction, struct coord *buffer)
 
int process_multipolygons_loop_count (struct item_bin **bin, int scount, int *sequence)
 get number of coordinates inside a sequence calculated by process_multipolygon_find_loop More...
 
static void dump_sequence (const char *string, int loop_count, int *scount, int **sequences, int *direction)
 
static void process_multipolygons_finish (GList *tr, FILE *out)
 
static void process_multipolygons_member (void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv)
 
static void process_multipolygons_setup_one (struct item_bin *ib, struct relations *relations, struct relations_func *relations_func, GList **multipolygons)
 prepare one multipolygon relation for relattion processing More...
 
static gpointer process_multipolygons_setup_worker (gpointer data)
 multipolygons setup worker thread. More...
 
static GList ** process_multipolygons_setup (FILE *in, int thread_count, struct relations **relations)
 prepare multipolygon way matching More...
 
void process_multipolygons (FILE *in, FILE *coords, FILE *ways, FILE *ways_index, FILE *out)
 
static void process_turn_restrictions_member (void *func_priv, void *relation_priv, struct item_bin *member, void *member_priv)
 
static void process_turn_restrictions_fromto (struct turn_restriction *t, int type, struct coord **c)
 
static void process_turn_restrictions_dump_coord (struct coord *c, int count)
 
static void process_turn_restrictions_finish (GList *tr, FILE *out)
 
static void process_turn_restrictions_setup_one (struct item_bin *ib, struct relations *relations, struct relations_func *relations_func, GList **turn_restrictions)
 prepare one multipolygon relation for relattion processing More...
 
static gpointer process_turn_restrictions_setup_worker (gpointer data)
 turn restrictions setup worker thread. More...
 
static GList ** process_turn_restrictions_setup (FILE *in, int thread_count, struct relations **relations)
 prepare turn restriction way matching More...
 
void process_turn_restrictions (FILE *in, FILE *coords, FILE *ways, FILE *ways_index, FILE *out)
 
static void node_ref_way (osmid node)
 
void osm_add_nd (osmid ref)
 
static void write_item_way_subsection_index (FILE *out, FILE *out_index, FILE *out_graph, struct item_bin *orig, long long *last_id)
 
static void write_item_way_subsection (FILE *out, FILE *out_index, FILE *out_graph, struct item_bin *orig, int first, int last, long long *last_id)
 
void ref_ways (FILE *in)
 
void resolve_ways (FILE *in, FILE *out)
 
void process_way2poi (FILE *in, FILE *out, int type)
 
int map_resolve_coords_and_split_at_intersections (FILE *in, FILE *out, FILE *out_index, FILE *out_graph, FILE *out_coastline, int final)
 
static void index_country_add (struct zip_info *info, int country_id, char *first_key, char *last_key, char *tile, char *filename, int size, FILE *out)
 
void write_countrydir (struct zip_info *zip_info, int max_index_size)
 
void load_countries (void)
 
void remove_countryfiles (void)
 
void osm_init (FILE *rule_file)
 

Variables

static int in_way
 
static int in_node
 
static int in_relation
 
osmid nodeid
 
osmid wayid
 
static GHashTable * attr_hash
 
static GHashTable * country_table_hash
 
static char * attr_present
 
static int attr_present_count
 
static struct item_bin item
 
int maxspeed_attr_value
 
char debug_attr_buffer [BUFFER_SIZE]
 
int flags [4]
 
int flagsa [4]
 
int flags_attr_value
 
struct attr_bin osmid_attr
 
long long osmid_attr_value
 
char is_in_buffer [BUFFER_SIZE]
 
char attr_strings_buffer [BUFFER_SIZE *16]
 
int attr_strings_buffer_free_offset
 
struct coord coord_buffer [MAX_COORD_COUNT]
 
static struct attr_mapping ** attr_mapping_node
 
static int attr_mapping_node_count
 
static struct attr_mapping ** attr_mapping_way
 
static int attr_mapping_way_count
 
static struct attr_mapping ** attr_mapping_way2poi
 
static int attr_mapping_way2poi_count
 
static struct attr_mapping ** attr_mapping_rel2poly_place
 
static int attr_mapping_rel2poly_place_count
 
char * attr_strings [attr_string_last]
 
char * osm_types [] = {"unknown","node","way","relation"}
 
struct country_table country_table []
 
static char * attrmap
 
static int node_is_tagged
 
int coord_count
 
static struct node_itemcurrent_node
 
osmid id_last_node
 
GHashTable * node_hash
 
GHashTable * way_hash
 
char relation_type [BUFFER_SIZE]
 
char iso_code [BUFFER_SIZE]
 
int boundary
 
static struct item_bin killer
 dummy memory location to pass a end condition to worker threads, as NULL cannot be passed. More...
 

Macro Definition Documentation

◆ GET_REF

#define GET_REF (   c)    ((((osmid)(c).x & ~REF_MARKER)<<31) + (c).y )

◆ IS_REF

#define IS_REF (   c)    (((c).x & REF_MASK)==REF_MARKER)

◆ M_PI

#define M_PI   3.14159265358979323846

◆ M_PI_4

#define M_PI_4   0.785398163397448309616

◆ MAX_COORD_COUNT

#define MAX_COORD_COUNT   65536

◆ MAX_TOWN_ADMIN_LEVELS

#define MAX_TOWN_ADMIN_LEVELS   11

◆ REF_MARKER

#define REF_MARKER   (1ull << 30)

◆ REF_MASK

#define REF_MASK   (3ull << 30)

◆ SET_REF

#define SET_REF (   c,
  ref 
)    do { (c).x = REF_MARKER | ((osmid)(ref)>>31); (c).y = (osmid)(ref) & 0x7fffffffull; } while(0)

Enumeration Type Documentation

◆ attr_strings_type

Enumerator
attr_string_phone 
attr_string_fax 
attr_string_email 
attr_string_url 
attr_string_district_name 
attr_string_street_name 
attr_string_street_name_systematic 
attr_string_street_name_systematic_nat 
attr_string_street_name_systematic_int 
attr_string_ref 
attr_string_exit_to 
attr_string_street_destination 
attr_string_street_destination_forward 
attr_string_street_destination_backward 
attr_string_house_number 
attr_string_label 
attr_string_postal 
attr_string_population 
attr_string_county_name 
attr_string_last 

Function Documentation

◆ access_value()

static int access_value ( char *  v)
static

Referenced by osm_add_tag().

◆ allocate_node_item_in_buffer()

static struct node_item* allocate_node_item_in_buffer ( void  )
static

◆ attr_longest_match()

static int attr_longest_match ( struct attr_mapping **  mapping,
int  mapping_count,
enum item_type types,
int  types_count 
)
static

◆ attr_longest_match_clear()

static void attr_longest_match_clear ( void  )
static

◆ attr_strings_clear()

static void attr_strings_clear ( void  )
static

◆ attr_strings_save()

static void attr_strings_save ( enum attr_strings_type  id,
char *  str 
)
static

◆ build_attrmap()

static void build_attrmap ( FILE *  rule_file)
static

◆ build_attrmap_line()

◆ build_countrytable()

static void build_countrytable ( void  )
static

◆ clear_node_item_buffer()

void clear_node_item_buffer ( void  )

◆ country_from_countryid()

static struct country_table* country_from_countryid ( int  id)
static

◆ country_from_iso2()

struct country_table* country_from_iso2 ( char *  iso)

◆ country_id_from_iso2()

◆ dump_sequence()

static void dump_sequence ( const char *  string,
int  loop_count,
int *  scount,
int **  sequences,
int *  direction 
)
inlinestatic

◆ extend_buffer()

static void extend_buffer ( struct buffer b)
static

◆ filter_unknown()

static int filter_unknown ( struct item_bin ib)
inlinestatic

◆ flush_nodes()

void flush_nodes ( int  final)

◆ g_free_helper()

static void g_free_helper ( void *  data,
void *  user_data 
)
static

◆ index_country_add()

static void index_country_add ( struct zip_info info,
int  country_id,
char *  first_key,
char *  last_key,
char *  tile,
char *  filename,
int  size,
FILE *  out 
)
static

◆ is_loop()

static int is_loop ( struct item_bin start_part,
int  start_used,
struct item_bin end_part,
int  end_used 
)
static

◆ item_bin_get_id()

osmid item_bin_get_id ( struct item_bin ib)

◆ item_bin_get_nodeid()

osmid item_bin_get_nodeid ( struct item_bin ib)

◆ item_bin_get_nodeid_from_attr()

static osmid item_bin_get_nodeid_from_attr ( struct item_bin ib,
enum attr_type  attr_type 
)
static

◆ item_bin_get_relationid()

◆ item_bin_get_wayid()

◆ itembin_warning()

static void itembin_warning ( struct item_bin ib,
int  cont,
char *  fmt,
  ... 
)
static

◆ load_countries()

◆ map_resolve_coords_and_split_at_intersections()

int map_resolve_coords_and_split_at_intersections ( FILE *  in,
FILE *  out,
FILE *  out_index,
FILE *  out_graph,
FILE *  out_coastline,
int  final 
)

◆ node_buffer_to_hash()

static void node_buffer_to_hash ( void  )
static

◆ node_item_find_index_in_ordered_list()

static long long node_item_find_index_in_ordered_list ( osmid  id)
static

◆ node_item_get()

◆ node_ref_way()

static void node_ref_way ( osmid  node)
static

References node_item_get(), and node_item::ref_way.

Referenced by nodes_ref_item_bin().

◆ nodes_ref_item_bin()

static void nodes_ref_item_bin ( struct item_bin ib)
static

References c, item_bin::clen, GET_REF, and node_ref_way().

Referenced by osm_end_way(), and ref_ways().

◆ osm_add_member()

void osm_add_member ( enum relation_member_type  type,
osmid  ref,
char *  role 
)

◆ osm_add_nd()

void osm_add_nd ( osmid  ref)

◆ osm_add_node()

◆ osm_add_relation()

◆ osm_add_tag()

void osm_add_tag ( char *  k,
char *  v 
)

Sometimes there is no is_in tag, only is_in:country. I put this here so it can be overwritten by the previous if clause if there IS an is_in tag.

Ireland uses the place_county OSM tag to describe what county a town is in. This would be equivalent to is_in: Town; Locality; Country A real world example would be Node: Moycullen (52234625) The tag is processed as Moycullen; Galway; Ireland where Galway is the county

References access_value(), AF_BIKE, AF_CAR, AF_DANGEROUS_GOODS, AF_DELIVERY_TRUCK, AF_EMERGENCY_VEHICLES, AF_HIGH_OCCUPANCY_CAR, AF_HIGH_OCCUPANCY_CAR_ONLY, AF_HORSE, AF_MOPED, AF_MOTORCYCLE, AF_ONEWAY, AF_ONEWAYREV, AF_PEDESTRIAN, AF_PUBLIC_BUS, AF_ROUNDABOUT, AF_ROUNDABOUT_VALID, AF_SPEED_LIMIT, AF_TAXI, AF_THROUGH_TRAFFIC_LIMIT, AF_TOLL, AF_TRANSPORT_TRUCK, AF_UNDERGROUND, attr_debug_level, attr_string_county_name, attr_string_district_name, attr_string_email, attr_string_exit_to, attr_string_fax, attr_string_house_number, attr_string_label, attr_string_phone, attr_string_population, attr_string_postal, attr_string_ref, attr_string_street_destination, attr_string_street_destination_backward, attr_string_street_destination_forward, attr_string_street_name, attr_string_street_name_systematic, attr_string_street_name_systematic_int, attr_string_street_name_systematic_nat, attr_strings, attr_strings_save(), debug_attr_buffer, flagsa, in_relation, in_way, is_in_buffer, maxspeed_attr_value, node_is_tagged, osm_update_attr_present(), and relation_add_tag().

Referenced by map_collect_data_osm_o5m(), parse_tag(), and process_tag().

◆ osm_add_way()

◆ osm_end_node()

◆ osm_end_relation()

◆ osm_end_relation_multipolygon()

◆ osm_end_way()

◆ osm_info()

void osm_info ( char *  type,
osmid  id,
int  cont,
char *  fmt,
  ... 
)

References osm_logv(), and type.

Referenced by itembin_nicer_slicer(), and process_boundaries_setup().

◆ osm_init()

void osm_init ( FILE *  rule_file)

Referenced by maptool_init().

◆ osm_logv()

static void osm_logv ( char *  prefix,
char *  objtype,
osmid  id,
int  cont,
struct coord_geo geo,
char *  fmt,
va_list  ap 
)
static

◆ osm_process_town_by_boundary()

static GList* osm_process_town_by_boundary ( GList bl,
struct item_bin town,
struct coord c 
)
static

Find country which town belongs to. Find town administrative hierarchy attributes.

Parameters
inbl list of administrative boundaries (data is struct boundary *)
intown item_bin structure holding town information
inc town center coordinates
Returns
refernce to the list of town_country structures

References boundary_find_matches(), c, match(), osm_process_town_by_boundary_update_attrs(), and town_country_list_insert_if_new().

Referenced by osm_process_towns().

◆ osm_process_town_by_boundary_update_attrs()

static void osm_process_town_by_boundary_update_attrs ( struct item_bin town,
struct town_country tc,
GList matches 
)
static

Update town attributes based on its administrative parents.

Parameters
intown town initial item_bin data
in/outtc town_country structure holding country information and town attributes to add to town item_bin
inmatches list of administrative boundaries the town belongs to (data is struct boundary *)
Returns
nothing

References boundary::admin_centre, country_table::admin_levels, town_country::attrs, town_country::country, boundary::ib, item_bin_get_attr(), name, nodeid, osm_tag_value(), attr::str, attr::type, item_bin::type, and attr::u.

Referenced by osm_process_town_by_boundary().

◆ osm_process_town_by_is_in()

static GList* osm_process_town_by_is_in ( struct item_bin ib)
static

Find list of countries which town or district belongs to.

Parameters
inib pointer to item_bin structure holding town information
Returns
refernce to a list of struct town_country* the town belongs to

References country, country_table_hash, item_bin_get_attr(), and town_country_list_insert_if_new().

Referenced by osm_process_towns().

◆ osm_process_town_get_town_name_from_is_in()

static char* osm_process_town_get_town_name_from_is_in ( struct item_bin ib,
GHashTable *  town_hash 
)
static

Get town name from district is_in attribute if possible.

Parameters
inib pointer to item_bin structure holding district information
intown_hash hash of all town names
Returns
refernce to a list of struct town_country* the town belongs to

References item_bin_get_attr().

Referenced by osm_process_towns().

◆ osm_process_town_unknown_country()

static GList* osm_process_town_unknown_country ( void  )
static

◆ osm_process_towns()

◆ osm_town_relations_to_poly()

◆ osm_update_attr_present()

static void osm_update_attr_present ( char *  k,
char *  v 
)
static

◆ osm_warning()

◆ parse_relation_member_string()

static void parse_relation_member_string ( char *  relation_member_string,
struct relation_member memb 
)
static

◆ process_associated_street_member()

static void process_associated_street_member ( void *  func_priv,
void *  relation_priv,
struct item_bin member,
void *  member_priv_unused 
)
static

◆ process_associated_streets()

◆ process_associated_streets_setup()

◆ process_house_number_interpolation_member()

◆ process_house_number_interpolations()

◆ process_house_number_interpolations_setup()

◆ process_multipolygons()

void process_multipolygons ( FILE *  in,
FILE *  coords,
FILE *  ways,
FILE *  ways_index,
FILE *  out 
)

◆ process_multipolygons_find_loop()

static int process_multipolygons_find_loop ( int  in_count,
struct item_bin **  parts,
int *  sequence,
int *  used 
)
static

◆ process_multipolygons_find_loops()

int process_multipolygons_find_loops ( osmid  relid,
int  in_count,
struct item_bin **  parts,
int **  scount,
int ***  sequences,
int **  direction 
)

◆ process_multipolygons_find_match()

static int process_multipolygons_find_match ( struct item_bin part,
int  part_used,
int  in_count,
struct item_bin **  parts,
int *  used 
)
static

find the nect matching polygon segment This can be used to find the next matching "line" to form a polygon.

Parameters
partcurrent line part
part_usedhow this part was used
in_countnumber of lines passed in parts @parts array of item_bin pointers giving the single parts @parts used int array, one for each part, indicating wheather the part was already used. This function sets the usage for the mathcing part if one is found. Usage is 0: not used, 1: used forward 2: used reverse
Returns
: index of matching part, -1 if none matches or all are consumed already.

References item_bin::clen, part, coord::x, and coord::y.

Referenced by process_multipolygons_find_loop().

◆ process_multipolygons_finish()

◆ process_multipolygons_loop_count()

int process_multipolygons_loop_count ( struct item_bin **  bin,
int  scount,
int *  sequence 
)

get number of coordinates inside a sequence calculated by process_multipolygon_find_loop

Parameters
binthe array of all raw members of this multipolygon
scountnumber of members inside this sequence
sequencesequence calculated by process_multipolygon_find_loop
Returns
number of coords

References process_multipolygons_loop_dump().

Referenced by itembin_loop_combiner(), and process_multipolygons_finish().

◆ process_multipolygons_loop_dump()

int process_multipolygons_loop_dump ( struct item_bin **  bin,
int  scount,
int *  sequence,
int *  direction,
struct coord buffer 
)

◆ process_multipolygons_member()

static void process_multipolygons_member ( void *  func_priv,
void *  relation_priv,
struct item_bin member,
void *  member_priv 
)
static

◆ process_multipolygons_setup()

static GList** process_multipolygons_setup ( FILE *  in,
int  thread_count,
struct relations **  relations 
)
static

prepare multipolygon way matching

This function reads all multipolygon relations and prepares relations structures for later way matching. Since this scales quite ugly, (O^3) i think, we use multiple threads creating their own hash each. This way none of the hashes get's that big, and we can utilize more cpu power.

Parameters
infile containing the relations
thread_countnumber of threads to use
relationsarray of preallocated relations structures. One per thread.
Returns
array of GLists. One per thread containing the resulting structures.

References item_bin_dup(), killer, process_multipolygon_setup_thread::multipolygons, process_multipolygon_setup_thread::number, process_multipolygons_member(), process_multipolygons_setup_worker(), process_multipolygon_setup_thread::queue, read_item(), process_multipolygon_setup_thread::relations, process_multipolygon_setup_thread::relations_func, relations_func_new(), process_multipolygon_setup_thread::thread, and thread_count.

Referenced by process_multipolygons().

◆ process_multipolygons_setup_one()

static void process_multipolygons_setup_one ( struct item_bin ib,
struct relations relations,
struct relations_func relations_func,
GList **  multipolygons 
)
static

prepare one multipolygon relation for relattion processing

Parameters
ibthe relation
relationsthe relation processing structure
relations_funcfunction to use for the members
multipolygonswrite the resulting multipolygons to the list

Referenced by process_multipolygons_setup_worker().

◆ process_multipolygons_setup_worker()

static gpointer process_multipolygons_setup_worker ( gpointer  data)
static

multipolygons setup worker thread.

This thread processes any item passed to it via async queue into it's local relations function.

Parameters
datathis threads local storage

References data, killer, process_multipolygon_setup_thread::multipolygons, process_multipolygon_setup_thread::number, process_multipolygons_setup_one(), processed_relations, process_multipolygon_setup_thread::queue, process_multipolygon_setup_thread::relations, and process_multipolygon_setup_thread::relations_func.

Referenced by process_multipolygons_setup().

◆ process_turn_restrictions()

void process_turn_restrictions ( FILE *  in,
FILE *  coords,
FILE *  ways,
FILE *  ways_index,
FILE *  out 
)

◆ process_turn_restrictions_dump_coord()

static void process_turn_restrictions_dump_coord ( struct coord c,
int  count 
)
static

References c, coord::x, and coord::y.

Referenced by process_turn_restrictions_finish().

◆ process_turn_restrictions_finish()

◆ process_turn_restrictions_fromto()

static void process_turn_restrictions_fromto ( struct turn_restriction t,
int  type,
struct coord **  c 
)
static

◆ process_turn_restrictions_member()

static void process_turn_restrictions_member ( void *  func_priv,
void *  relation_priv,
struct item_bin member,
void *  member_priv 
)
static

◆ process_turn_restrictions_setup()

static GList** process_turn_restrictions_setup ( FILE *  in,
int  thread_count,
struct relations **  relations 
)
static

prepare turn restriction way matching

This function reads all turn restriction relations and prepares relations structures for later way matching. Since this scales quite ugly, (O^3) i think, we use multiple threads creating their own hash each. This way none of the hashes get's that big, and we can utilize more cpu power.

Parameters
infile containing the relations
thread_countnumber of threads to use
relationsarray of preallocated relations structures. One per thread.
Returns
array of GLists. One per thread containing the resulting structures.

References item_bin_dup(), killer, process_turn_restrictions_setup_thread::number, process_turn_restrictions_member(), process_turn_restrictions_setup_worker(), process_turn_restrictions_setup_thread::queue, read_item(), process_turn_restrictions_setup_thread::relations, process_turn_restrictions_setup_thread::relations_func, relations_func_new(), process_turn_restrictions_setup_thread::thread, thread_count, and process_turn_restrictions_setup_thread::turn_restrictions.

Referenced by process_turn_restrictions().

◆ process_turn_restrictions_setup_one()

static void process_turn_restrictions_setup_one ( struct item_bin ib,
struct relations relations,
struct relations_func relations_func,
GList **  turn_restrictions 
)
static

prepare one multipolygon relation for relattion processing

Parameters
ibthe relation
relationsthe relation processing structure
relations_funcfunction to use for the members
turn_restrictionswrite the resulting turn_restriction to the list

References relation_member::id, item_bin_get_relationid(), turn_restriction::order, osm_types, osm_warning(), turn_restriction::r, rel_member_node, rel_member_way, relations_add_relation_member_entry(), turn_restriction::relid, search_relation_member(), item_bin::type, relation_member::type, and turn_restriction::type.

Referenced by process_turn_restrictions_setup_worker().

◆ process_turn_restrictions_setup_worker()

static gpointer process_turn_restrictions_setup_worker ( gpointer  data)
static

◆ process_way2poi()

void process_way2poi ( FILE *  in,
FILE *  out,
int  type 
)

Get POI coordinates from area/line coordinates.

Parameters
in*in input file with area/line coordinates.
in*out output file with POI coordinates
intype input file original contents type: type_line or type_area
Returns
nothing

References c, c1, c2, item_bin::clen, geom_line_middle(), geom_poly_centroid(), geom_poly_closest_point(), geom_poly_point_inside(), item_bin_get_wayid(), osm_warning(), read_item(), type, item_bin::type, and write_item_way_subsection().

Referenced by osm_process_way2poi().

◆ ref_ways()

void ref_ways ( FILE *  in)

References nodes_ref_item_bin(), and read_item().

Referenced by osm_count_references().

◆ relation_add_tag()

◆ relation_func_writethrough()

static void relation_func_writethrough ( void *  func_priv,
void *  relation_priv_unused,
struct item_bin member,
void *  member_priv_unused 
)
static

◆ remove_countryfiles()

◆ remove_last_node_item_from_buffer()

static void remove_last_node_item_from_buffer ( void  )
static

References node_buffer, and buffer::size.

Referenced by osm_add_node().

◆ resolve_ways()

void resolve_ways ( FILE *  in,
FILE *  out 
)

◆ search_relation_member()

static int search_relation_member ( struct item_bin ib,
char *  role,
struct relation_member memb,
int *  min_count 
)
static

◆ sort_countries()

void sort_countries ( int  keep_tmpfiles)

◆ town_country_destroy()

static void town_country_destroy ( struct town_country tc)
static

Referenced by osm_process_towns().

◆ town_country_list_insert_if_new()

static struct town_country* town_country_list_insert_if_new ( GList **  town_country_list,
struct country_table country 
)
static

Insert a new record into the list of town info structures, if there's no such entry.

Parameters
in/outtown_country_list pointer to GList* of town_country structures.
incountry country to add the town to
Returns
refernce to then new town_country structure added to the list, or NULL if GList already had an entry for the country given

References country, and town_country_new().

Referenced by osm_process_town_by_boundary(), and osm_process_town_by_is_in().

◆ town_country_new()

static struct town_country* town_country_new ( struct country_table country)
static

◆ write_countrydir()

◆ write_item_way_subsection()

static void write_item_way_subsection ( FILE *  out,
FILE *  out_index,
FILE *  out_graph,
struct item_bin orig,
int  first,
int  last,
long long *  last_id 
)
static

◆ write_item_way_subsection_index()

static void write_item_way_subsection_index ( FILE *  out,
FILE *  out_index,
FILE *  out_graph,
struct item_bin orig,
long long *  last_id 
)
static

Variable Documentation

◆ attr_hash

static GHashTable * attr_hash
static

◆ attr_mapping_node

struct attr_mapping** attr_mapping_node
static

Referenced by build_attrmap_line(), and osm_end_node().

◆ attr_mapping_node_count

int attr_mapping_node_count
static

Referenced by build_attrmap_line(), and osm_end_node().

◆ attr_mapping_rel2poly_place

struct attr_mapping** attr_mapping_rel2poly_place
static

◆ attr_mapping_rel2poly_place_count

int attr_mapping_rel2poly_place_count
static

◆ attr_mapping_way

struct attr_mapping** attr_mapping_way
static

◆ attr_mapping_way2poi

struct attr_mapping** attr_mapping_way2poi
static

Referenced by build_attrmap_line(), and osm_end_way().

◆ attr_mapping_way2poi_count

int attr_mapping_way2poi_count
static

Referenced by build_attrmap_line(), and osm_end_way().

◆ attr_mapping_way_count

int attr_mapping_way_count
static

◆ attr_present

◆ attr_present_count

◆ attr_strings

◆ attr_strings_buffer

char attr_strings_buffer[BUFFER_SIZE *16]

Referenced by attr_strings_save().

◆ attr_strings_buffer_free_offset

int attr_strings_buffer_free_offset

◆ attrmap

char* attrmap
static

◆ boundary

int boundary

◆ coord_buffer

struct coord coord_buffer[MAX_COORD_COUNT]

Referenced by osm_add_nd(), and osm_end_way().

◆ coord_count

int coord_count

◆ country_table

◆ country_table_hash

GHashTable * country_table_hash
static

◆ current_node

struct node_item* current_node
static

The node currently being processed.

Referenced by osm_add_node(), and osm_end_node().

◆ debug_attr_buffer

◆ flags

int flags[4]

◆ flags_attr_value

int flags_attr_value

Referenced by osm_add_way(), and osm_end_way().

◆ flagsa

int flagsa[4]

◆ id_last_node

osmid id_last_node

ID of the last node processed.

Referenced by osm_add_node().

◆ in_node

int in_node
static

Referenced by osm_add_node(), and osm_end_node().

◆ in_relation

int in_relation
static

◆ in_way

int in_way
static

◆ is_in_buffer

char is_in_buffer[BUFFER_SIZE]

◆ iso_code

char iso_code[BUFFER_SIZE]

◆ item

struct item_bin item
static

Referenced by bookmarks_load_hash(), bookmarks_store_bookmarks_to_file(), country_id_from_iso2(), destination_address(), display_add(), do_draw(), Backend::get_bookmarks(), Backend::get_pois(), NGQProxyBookmarks::getBookmarks(), graphics_add_selection(), graphics_process_selection_item(), gui_gtk_bookmarks_update(), gui_gtk_destinations_update(), gui_internal_cmd_bookmarks(), gui_internal_cmd_delete_waypoint(), gui_internal_cmd_formerdests(), gui_internal_cmd_load_bookmarks_as_waypoints(), gui_internal_cmd_map_download_do(), gui_internal_cmd_pois(), gui_internal_cmd_pois_item(), gui_internal_cmd_position_do(), gui_internal_cmd_replace_bookmarks_from_waypoints(), gui_internal_cmd_view_attribute_details(), gui_internal_cmd_view_attributes(), gui_internal_cmd_view_in_browser(), gui_internal_create_resultlist_entry(), gui_internal_populate_route_table(), gui_internal_search_list_set_default_country(), gui_internal_select_waypoint(), item_coord_get_within_range(), item_hash_insert(), map_binfile_open(), map_dump_filedesc(), map_route_occluded_bbox(), map_route_occluded_get_buildings(), map_search_new_mg(), mapset_search_new(), model_poi(), navigation_get_attr(), navit_add_former_destinations_from_file(), navit_populate_search_results_map(), navit_speak(), navit_window_roadbook_update(), navit_zoom_to_route(), NGQProxySearch::NGQProxySearch(), osd_speed_warner_draw(), pedestrian_draw_arrows(), phase1_map(), popup_show_item(), quadtree_add(), read_former_destination_map_as_list(), route_find_nearest_street(), route_get_destination_description(), route_graph_add_street(), route_graph_add_traffic_distortion(), route_graph_add_turn_restriction(), route_graph_build_idle(), route_graph_set_traffic_distortion(), search_list_country_new(), search_list_house_number_new(), search_list_street_new(), search_list_town_new(), NGQProxyBookmarks::setPoint(), street_get_data(), street_search_get_item(), tm_dump_to_textfile(), tm_item_ref(), tm_item_unref(), tracking_doupdate_lines(), tracking_get_attr(), traffic_location_get_matching_points(), traffic_location_populate_route_graph(), traffic_message_add_segments(), traffic_message_restore_segments(), and traffic_point_match_segment_attributes().

◆ killer

struct item_bin killer
static

dummy memory location to pass a end condition to worker threads, as NULL cannot be passed.

Referenced by process_multipolygons_setup(), process_multipolygons_setup_worker(), process_turn_restrictions_setup(), and process_turn_restrictions_setup_worker().

◆ maxspeed_attr_value

int maxspeed_attr_value

◆ node_hash

GHashTable* node_hash

◆ node_is_tagged

int node_is_tagged
static

◆ nodeid

◆ osm_types

char* osm_types[] = {"unknown","node","way","relation"}

◆ osmid_attr

struct attr_bin osmid_attr

Referenced by osm_add_node().

◆ osmid_attr_value

◆ relation_type

◆ way_hash

GHashTable * way_hash

◆ wayid

osmid wayid