navit  0.5.3-trunk
itembin.c File Reference
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "maptool.h"
#include "linguistics.h"
#include "file.h"
#include "debug.h"

Data Structures

struct  population_table
 

Functions

int item_bin_read (struct item_bin *ib, FILE *in)
 
void item_bin_set_type (struct item_bin *ib, enum item_type type)
 
void item_bin_init (struct item_bin *ib, enum item_type type)
 
void item_bin_add_coord (struct item_bin *ib, struct coord *coords_to_add, int count)
 
void item_bin_add_coord_reverse (struct item_bin *ib, struct coord *c, int count)
 
void item_bin_bbox (struct item_bin *ib, struct rect *r)
 
void item_bin_copy_coord (struct item_bin *ib, struct item_bin *from, int dir)
 
void item_bin_copy_attr (struct item_bin *ib, struct item_bin *from, enum attr_type attr)
 
void item_bin_add_coord_rect (struct item_bin *ib, struct rect *r)
 
int attr_bin_write_data (struct attr_bin *ab, enum attr_type type, void *data, int size)
 
int attr_bin_write_attr (struct attr_bin *ab, struct attr *attr)
 
void item_bin_add_attr_data (struct item_bin *ib, enum attr_type type, void *data, int size)
 
void item_bin_add_attr (struct item_bin *ib, struct attr *attr)
 
void item_bin_remove_attr (struct item_bin *ib, void *ptr)
 
void item_bin_add_attr_int (struct item_bin *ib, enum attr_type type, int val)
 
void * item_bin_get_attr (struct item_bin *ib, enum attr_type type, void *last)
 
struct attr_binitem_bin_get_attr_bin (struct item_bin *ib, enum attr_type type, void *last)
 
struct attr_binitem_bin_get_attr_bin_last (struct item_bin *ib)
 
void item_bin_add_attr_longlong (struct item_bin *ib, enum attr_type type, long long val)
 
void item_bin_add_attr_string (struct item_bin *ib, enum attr_type type, char *str)
 
void item_bin_add_attr_range (struct item_bin *ib, enum attr_type type, short min, short max)
 
void item_bin_add_hole (struct item_bin *ib, struct coord *coord, int ccount)
 add a "hole" to an item More...
 
void item_bin_write (struct item_bin *ib, FILE *out)
 
struct item_binitem_bin_dup (struct item_bin *ib)
 
void item_bin_write_clipped (struct item_bin *ib, struct tile_parameter *param, struct item_bin_sink *out)
 
static char * coord_to_str (struct coord *c)
 
static void dump_coord (struct coord *c, FILE *out)
 
void item_bin_dump (struct item_bin *ib, FILE *out)
 
void dump_itembin (struct item_bin *ib)
 
void item_bin_set_type_by_population (struct item_bin *ib, int population)
 
void item_bin_write_match (struct item_bin *ib, enum attr_type type, enum attr_type match, int maxdepth, FILE *out)
 
static int item_bin_sort_compare (const void *p1, const void *p2)
 
int item_bin_sort_file (char *in_file, char *out_file, struct rect *r, int *size)
 
struct geom_poly_segmentitem_bin_to_poly_segment (struct item_bin *ib, int type)
 
void clip_line (struct item_bin *ib, struct rect *r, struct tile_parameter *param, struct item_bin_sink *out)
 
void clip_polygon (struct item_bin *ib, struct rect *r, struct tile_parameter *param, struct item_bin_sink *out)
 

Variables

static struct population_table town_population []
 
static struct population_table district_population []
 

Function Documentation

◆ attr_bin_write_attr()

int attr_bin_write_attr ( struct attr_bin ab,
struct attr attr 
)

◆ attr_bin_write_data()

int attr_bin_write_data ( struct attr_bin ab,
enum attr_type  type,
void *  data,
int  size 
)

◆ clip_line()

◆ clip_polygon()

void clip_polygon ( struct item_bin ib,
struct rect r,
struct tile_parameter param,
struct item_bin_sink out 
)

Referenced by item_bin_write_clipped().

◆ coord_to_str()

static char* coord_to_str ( struct coord c)
static

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

Referenced by dump_coord().

◆ dump_coord()

static void dump_coord ( struct coord c,
FILE *  out 
)
static

References c, and coord_to_str().

Referenced by item_bin_dump().

◆ dump_itembin()

void dump_itembin ( struct item_bin ib)

Referenced by dump(), and write_item().

◆ item_bin_add_attr()

◆ item_bin_add_attr_data()

void item_bin_add_attr_data ( struct item_bin ib,
enum attr_type  type,
void *  data,
int  size 
)

◆ item_bin_add_attr_int()

void item_bin_add_attr_int ( struct item_bin ib,
enum attr_type  type,
int  val 
)

◆ item_bin_add_attr_longlong()

◆ item_bin_add_attr_range()

void item_bin_add_attr_range ( struct item_bin ib,
enum attr_type  type,
short  min,
short  max 
)

◆ item_bin_add_attr_string()

◆ item_bin_add_coord()

◆ item_bin_add_coord_rect()

void item_bin_add_coord_rect ( struct item_bin ib,
struct rect r 
)

References rect::h, and item_bin_add_coord().

Referenced by index_submap_add(), and write_tilesdir().

◆ item_bin_add_coord_reverse()

void item_bin_add_coord_reverse ( struct item_bin ib,
struct coord c,
int  count 
)

References c, and item_bin_add_coord().

◆ item_bin_add_hole()

void item_bin_add_hole ( struct item_bin ib,
struct coord coord,
int  ccount 
)

add a "hole" to an item

This function adds a "hole" (attr_poly_hole) to a map item. It adds the coordinates and the coordinate count to the existing item. WARNING: It does NOT allocate any memory, so the memory after the item must be already allocated for that purpose.

Parameters
[in,out]ibitem - to add hole to
[in]coord- hole coordinate array
[in]ccount- number of coordinates in coord

References item_bin::len, and attr::type.

Referenced by itembin_write_slice_result().

◆ item_bin_bbox()

void item_bin_bbox ( struct item_bin ib,
struct rect r 
)

◆ item_bin_copy_attr()

void item_bin_copy_attr ( struct item_bin ib,
struct item_bin from,
enum attr_type  attr 
)

◆ item_bin_copy_coord()

void item_bin_copy_coord ( struct item_bin ib,
struct item_bin from,
int  dir 
)

◆ item_bin_dump()

◆ item_bin_dup()

◆ item_bin_get_attr()

◆ item_bin_get_attr_bin()

struct attr_bin* item_bin_get_attr_bin ( struct item_bin ib,
enum attr_type  type,
void *  last 
)

◆ item_bin_get_attr_bin_last()

struct attr_bin* item_bin_get_attr_bin_last ( struct item_bin ib)

◆ item_bin_init()

◆ item_bin_read()

int item_bin_read ( struct item_bin ib,
FILE *  in 
)

References item_bin::len.

Referenced by read_item(), and write_countrydir().

◆ item_bin_remove_attr()

void item_bin_remove_attr ( struct item_bin ib,
void *  ptr 
)

◆ item_bin_set_type()

void item_bin_set_type ( struct item_bin ib,
enum item_type  type 
)

◆ item_bin_set_type_by_population()

void item_bin_set_type_by_population ( struct item_bin ib,
int  population 
)

◆ item_bin_sort_compare()

static int item_bin_sort_compare ( const void *  p1,
const void *  p2 
)
static

◆ item_bin_sort_file()

int item_bin_sort_file ( char *  in_file,
char *  out_file,
struct rect r,
int *  size 
)

◆ item_bin_to_poly_segment()

◆ item_bin_write()

◆ item_bin_write_clipped()

◆ item_bin_write_match()

Variable Documentation

◆ district_population

struct population_table district_population[]
static
Initial value:
= {
{type_district_label_0e0,0},
{type_district_label_1e0,1},
{type_district_label_2e0,2},
{type_district_label_5e0,5},
{type_district_label_1e1,10},
{type_district_label_2e1,20},
{type_district_label_5e1,50},
{type_district_label_1e2,100},
{type_district_label_2e2,200},
{type_district_label_5e2,500},
{type_district_label_1e3,1000},
{type_district_label_2e3,2000},
{type_district_label_5e3,5000},
{type_district_label_1e4,10000},
{type_district_label_2e4,20000},
{type_district_label_5e4,50000},
{type_district_label_1e5,100000},
{type_district_label_2e5,200000},
{type_district_label_5e5,500000},
{type_district_label_1e6,1000000},
{type_district_label_2e6,2000000},
{type_district_label_5e6,5000000},
{type_district_label_1e7,10000000},
}

Referenced by item_bin_set_type_by_population().

◆ town_population

struct population_table town_population[]
static
Initial value:
= {
{type_town_label_0e0,0},
{type_town_label_1e0,1},
{type_town_label_2e0,2},
{type_town_label_5e0,5},
{type_town_label_1e1,10},
{type_town_label_2e1,20},
{type_town_label_5e1,50},
{type_town_label_1e2,100},
{type_town_label_2e2,200},
{type_town_label_5e2,500},
{type_town_label_1e3,1000},
{type_town_label_2e3,2000},
{type_town_label_5e3,5000},
{type_town_label_1e4,10000},
{type_town_label_2e4,20000},
{type_town_label_5e4,50000},
{type_town_label_1e5,100000},
{type_town_label_2e5,200000},
{type_town_label_5e5,500000},
{type_town_label_1e6,1000000},
{type_town_label_2e6,2000000},
{type_town_label_5e6,5000000},
{type_town_label_1e7,10000000},
}

Referenced by item_bin_set_type_by_population().