navit  0.5.3-trunk
garmin.c File Reference
#include <glib.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "config.h"
#include "plugin.h"
#include "data.h"
#include "projection.h"
#include "item.h"
#include "debug.h"
#include "map.h"
#include "maptype.h"
#include "attr.h"
#include "coord.h"
#include "transform.h"
#include <libgarmin.h>
#include "garmin.h"
#include "gar2navit.h"

Data Structures

struct  map_priv
 Represents the map from a single binfile. More...
 
struct  map_rect_priv
 Implementation-specific map rect data. More...
 
struct  gscale
 
struct  nl2gl_t
 

Macros

#define max(a, b)   ((a) > (b) ? (a) : (b))
 

Functions

void logfn (char *file, int line, int level, char *fmt,...)
 
static int garmin_object_label (struct gobject *o, struct attr *attr)
 
static int garmin_object_debug (struct gobject *o, struct attr *attr)
 
static struct map_search_privgmap_search_new (struct map_priv *map, struct item *item, struct attr *search, int partial)
 
static void coord_rewind (void *priv_data)
 
static void attr_rewind (void *priv_data)
 
static int point_coord_get (void *priv_data, struct coord *c, int count)
 
static int coord_is_node (void *priv_data)
 
static int poly_coord_get (void *priv_data, struct coord *c, int count)
 
static int point_attr_get (void *priv_data, enum attr_type attr_type, struct attr *attr)
 
static int search_attr_get (void *priv_data, enum attr_type attr_type, struct attr *attr)
 
static int search_coord_get (void *priv_data, struct coord *c, int count)
 
static struct itemgarmin_poi2item (struct map_rect_priv *mr, struct gobject *o, unsigned short otype)
 
static struct itemgarmin_pl2item (struct map_rect_priv *mr, struct gobject *o, unsigned short otype)
 
static struct itemgarmin_pg2item (struct map_rect_priv *mr, struct gobject *o, unsigned short otype)
 
static struct itemgarmin_srch2item (struct map_rect_priv *mr, struct gobject *o, unsigned short otype)
 
static struct itemgarmin_obj2item (struct map_rect_priv *mr, struct gobject *o)
 
static struct itemgmap_rect_get_item_byid (struct map_rect_priv *mr, int id_hi, int id_lo)
 
static struct itemgmap_rect_get_item (struct map_rect_priv *mr)
 
static int get_level (struct map_selection *sel)
 
static int garmin_get_selection (struct map_rect_priv *map, struct map_selection *sel)
 
static struct map_rect_privgmap_rect_new (struct map_priv *map, struct map_selection *sel)
 
static void gmap_rect_destroy (struct map_rect_priv *mr)
 
static void gmap_search_destroy (struct map_search_priv *ms)
 
static void gmap_destroy (struct map_priv *m)
 
static struct map_privgmap_new (struct map_methods *meth, struct attr **attrs, struct callback_list *cbl)
 
void plugin_init (void)
 

Variables

static int map_id
 
int garmin_debug = 10
 
static struct gscale mapscales []
 
static struct item_methods methods_garmin_point
 
static struct item_methods methods_garmin_poly
 
static struct item_methods methods_garmin_search
 
struct nl2gl_t nl2gl_1 []
 
struct nl2gl_t nl2gl []
 
static struct map_methods map_methods
 

Macro Definition Documentation

◆ max

#define max (   a,
 
)    ((a) > (b) ? (a) : (b))

Function Documentation

◆ attr_rewind()

static void attr_rewind ( void *  priv_data)
static

◆ coord_is_node()

static int coord_is_node ( void *  priv_data)
static

◆ coord_rewind()

static void coord_rewind ( void *  priv_data)
static

◆ garmin_get_selection()

static int garmin_get_selection ( struct map_rect_priv map,
struct map_selection sel 
)
static

◆ garmin_obj2item()

static struct item* garmin_obj2item ( struct map_rect_priv mr,
struct gobject *  o 
)
static

◆ garmin_object_debug()

static int garmin_object_debug ( struct gobject *  o,
struct attr attr 
)
static

References dlog, map_rect_priv::label, attr::str, and attr::u.

Referenced by search_attr_get().

◆ garmin_object_label()

static int garmin_object_label ( struct gobject *  o,
struct attr attr 
)
static

References dlog, map_rect_priv::label, label, attr::str, and attr::u.

Referenced by search_attr_get().

◆ garmin_pg2item()

static struct item* garmin_pg2item ( struct map_rect_priv mr,
struct gobject *  o,
unsigned short  otype 
)
static

◆ garmin_pl2item()

static struct item* garmin_pl2item ( struct map_rect_priv mr,
struct gobject *  o,
unsigned short  otype 
)
static

◆ garmin_poi2item()

static struct item* garmin_poi2item ( struct map_rect_priv mr,
struct gobject *  o,
unsigned short  otype 
)
static

◆ garmin_srch2item()

static struct item* garmin_srch2item ( struct map_rect_priv mr,
struct gobject *  o,
unsigned short  otype 
)
static

◆ get_level()

static int get_level ( struct map_selection sel)
static

References map_selection::order.

Referenced by garmin_get_selection().

◆ gmap_destroy()

static void gmap_destroy ( struct map_priv m)
static

◆ gmap_new()

static struct map_priv* gmap_new ( struct map_methods meth,
struct attr **  attrs,
struct callback_list cbl 
)
static

◆ gmap_rect_destroy()

static void gmap_rect_destroy ( struct map_rect_priv mr)
static

◆ gmap_rect_get_item()

static struct item* gmap_rect_get_item ( struct map_rect_priv mr)
static

◆ gmap_rect_get_item_byid()

static struct item* gmap_rect_get_item_byid ( struct map_rect_priv mr,
int  id_hi,
int  id_lo 
)
static

◆ gmap_rect_new()

static struct map_rect_priv* gmap_rect_new ( struct map_priv map,
struct map_selection sel 
)
static

◆ gmap_search_destroy()

static void gmap_search_destroy ( struct map_search_priv ms)
static

References gmap_rect_destroy().

◆ gmap_search_new()

static struct map_search_priv* gmap_search_new ( struct map_priv map,
struct item item,
struct attr search,
int  partial 
)
static

◆ logfn()

void logfn ( char *  file,
int  line,
int  level,
char *  fmt,
  ... 
)

References debug_vprintf(), and garmin_debug.

Referenced by gmap_new().

◆ plugin_init()

void plugin_init ( void  )

References gmap_new().

◆ point_attr_get()

static int point_attr_get ( void *  priv_data,
enum attr_type  attr_type,
struct attr attr 
)
static

◆ point_coord_get()

static int point_coord_get ( void *  priv_data,
struct coord c,
int  count 
)
static

◆ poly_coord_get()

static int poly_coord_get ( void *  priv_data,
struct coord c,
int  count 
)
static

◆ search_attr_get()

static int search_attr_get ( void *  priv_data,
enum attr_type  attr_type,
struct attr attr 
)
static

◆ search_coord_get()

static int search_coord_get ( void *  priv_data,
struct coord c,
int  count 
)
static

Variable Documentation

◆ garmin_debug

int garmin_debug = 10

Referenced by gmap_new(), and logfn().

◆ map_id

int map_id
static

Referenced by gmap_new().

◆ map_methods

struct map_methods map_methods
static
Initial value:
= {
"utf-8",
NULL,
}
static struct item * gmap_rect_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo)
Definition: garmin.c:644
static void gmap_rect_destroy(struct map_rect_priv *mr)
Definition: garmin.c:828
static void gmap_search_destroy(struct map_search_priv *ms)
Definition: garmin.c:839
static struct item * gmap_rect_get_item(struct map_rect_priv *mr)
Definition: garmin.c:662
static struct map_search_priv * gmap_search_new(struct map_priv *map, struct item *item, struct attr *search, int partial)
Definition: garmin.c:190
static void gmap_destroy(struct map_priv *m)
Definition: garmin.c:843
static struct map_rect_priv * gmap_rect_new(struct map_priv *map, struct map_selection *sel)
Definition: garmin.c:803
@ projection_garmin
Definition: projection.h:26

Referenced by gmap_new().

◆ mapscales

struct gscale mapscales[]
static

◆ methods_garmin_point

struct item_methods methods_garmin_point
static
Initial value:
= {
}
static int point_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
Definition: garmin.c:335
static void attr_rewind(void *priv_data)
Definition: garmin.c:258
static void coord_rewind(void *priv_data)
Definition: garmin.c:252
static int point_coord_get(void *priv_data, struct coord *c, int count)
Definition: garmin.c:264

Referenced by garmin_poi2item().

◆ methods_garmin_poly

struct item_methods methods_garmin_poly
static
Initial value:
= {
}
static int coord_is_node(void *priv_data)
Definition: garmin.c:287
static int poly_coord_get(void *priv_data, struct coord *c, int count)
Definition: garmin.c:294

Referenced by garmin_pg2item(), and garmin_pl2item().

◆ methods_garmin_search

struct item_methods methods_garmin_search
static
Initial value:
= {
}
static int search_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
Definition: garmin.c:423
static int search_coord_get(void *priv_data, struct coord *c, int count)
Definition: garmin.c:556

Referenced by garmin_srch2item().

◆ nl2gl

struct nl2gl_t nl2gl[]
Initial value:
= {
{ .g = 9, .descr = "0-120m", },
{ .g = 9, .descr = "0-120m", },
{ .g = 8, .descr = "0-120m", },
{ .g = 8, .descr = "0-120m", },
{ .g = 7, .descr = "0-120m", },
{ .g = 7, .descr = "0-120m", },
{ .g = 6, .descr = "0-120m", },
{ .g = 6, .descr = "0-120m", },
{ .g = 5, .descr = "0-120m", },
{ .g = 5, .descr = "0-120m", },
{ .g = 4, .descr = "0-120m", },
{ .g = 4, .descr = "0-120m", },
{ .g = 3, .descr = "0-120m", },
{ .g = 3, .descr = "0-120m", },
{ .g = 2, .descr = "0-120m", },
{ .g = 2, .descr = "0-120m", },
{ .g = 1, .descr = "0-120m", },
{ .g = 1, .descr = "0-120m", },
{ .g = 0, .descr = "0-120m", },
}

◆ nl2gl_1

struct nl2gl_t nl2gl_1[]
Initial value:
= {
{ .g = 12, .descr = "0-120m", },
{ .g = 11, .descr = "0-120m", },
{ .g = 10, .descr = "0-120m", },
{ .g = 9, .descr = "0-120m", },
{ .g = 8, .descr = "0-120m", },
{ .g = 7, .descr = "0-120m", },
{ .g = 6, .descr = "0-120m", },
{ .g = 5, .descr = "0-120m", },
{ .g = 4, .descr = "0-120m", },
{ .g = 4, .descr = "0-120m", },
{ .g = 3, .descr = "0-120m", },
{ .g = 3, .descr = "0-120m", },
{ .g = 2, .descr = "0-120m", },
{ .g = 2, .descr = "0-120m", },
{ .g = 2, .descr = "0-120m", },
{ .g = 1, .descr = "0-120m", },
{ .g = 1, .descr = "0-120m", },
{ .g = 1, .descr = "0-120m", },
{ .g = 0, .descr = "0-120m", },
}