navit  0.5.3-trunk
pedestrian.c File Reference
#include <math.h>
#include <stdio.h>
#include <glib.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <termios.h>
#include <errno.h>
#include <sys/ioctl.h>
#include "config.h"
#include <navit/item.h>
#include <navit/xmlconfig.h>
#include <navit/main.h>
#include <navit/debug.h>
#include <navit/point.h>
#include <navit/graphics.h>
#include <navit/transform.h>
#include <navit/map.h>
#include <navit/navit.h>
#include <navit/callback.h>
#include <navit/file.h>
#include <navit/color.h>
#include <navit/route.h>
#include <navit/plugin.h>
#include <navit/layout.h>
#include <navit/mapset.h>
#include <navit/osd.h>
#include <navit/event.h>
#include <navit/command.h>
#include <navit/config_.h>
#include <navit/vehicle.h>

Data Structures

struct  pedestrian
 
struct  rocket
 
struct  marker
 
struct  map_priv
 Represents the map from a single binfile. More...
 
struct  map_rect_priv
 Implementation-specific map rect data. More...
 
struct  building
 
struct  tilt_data
 

Macros

#define ORIENTATION_UNKNOWN   0
 
#define ORIENTATION_PORTRAIT   1
 
#define ORIENTATION_LANDSCAPE   2
 
#define ORIENTATION_FLAT   3
 
#define TYPE_ACCELEROMETER   1
 
#define TYPE_MAGNETIC_FIELD   2
 
#define DEBUG_COORD_GET
 

Functions

static void pedestrian_rocket_idle (struct rocket *rocket)
 
static void pedestrian_cmd_pedestrian_rocket (struct rocket *rocket)
 
static void osd_rocket_init (struct navit *nav)
 
static void osd_marker_draw (struct marker *this, struct navit *nav)
 
static void osd_marker_init (struct marker *this, struct navit *nav)
 
static struct osd_priv * osd_marker_new (struct navit *nav, struct osd_methods *meth, struct attr **attrs)
 
static int map_route_occluded_bbox (struct map *map, struct coord_rect *bbox)
 
static void map_route_occluded_buildings_free (void)
 
static void map_route_occluded_get_buildings (struct mapset *mapset, struct coord_rect *r)
 
static int side (struct coord *l0, struct coord *l1, struct coord *p)
 
static void map_route_occluded_check_buildings (struct coord *c0)
 
static int intersect (struct coord *p1, struct coord *p2, struct coord *p3, struct coord *p4, struct coord *i)
 
static int is_visible_line (struct coord *c0, struct coord *c1, struct coord *c2)
 
static void map_route_occluded_coord_rewind (void *priv_data)
 
static void map_route_occluded_attr_rewind (void *priv_data)
 
static int map_route_occluded_attr_get (void *priv_data, enum attr_type attr_type, struct attr *attr)
 
static int coord_next (struct map_rect_priv *mr, struct coord *c)
 
static int map_route_occluded_coord_get (void *priv_data, struct coord *c, int count)
 
static void map_route_occluded_destroy (struct map_priv *priv)
 
static struct map_rect_privmap_route_occluded_rect_new (struct map_priv *priv, struct map_selection *sel)
 
static void map_route_occluded_rect_destroy (struct map_rect_priv *mr)
 
static struct itemmap_route_occluded_get_item (struct map_rect_priv *mr)
 
static struct itemmap_route_occluded_get_item_byid (struct map_rect_priv *mr, int id_hi, int id_lo)
 
static struct map_privmap_route_occluded_new (struct map_methods *meth, struct attr **attrs)
 
static void pedestrian_graphics_resize (struct graphics *gra, int w, int h)
 
static void pedestrian_draw_arrow (struct graphics *gra, char *name, int x, int y)
 
static void pedestrian_draw_arrows (struct graphics *gra)
 
static void pedestrian_graphics_postdraw (struct graphics *gra)
 
void pedestrian_write_tilt (int fd, int axis)
 
void pedestrian_read_tilt (int fd, struct navit *nav, struct tilt_data *data)
 
void pedestrian_write_tilt_timer (int fd, struct tilt_data *data)
 
void pedestrian_setup_tilt (struct navit *nav)
 
static void pedestrian_log (char **logstr)
 
static void pedestrian_navit_init (struct navit *nav)
 
static void pedestrian_navit (struct navit *nav, int add)
 
void plugin_init (void)
 The plugin entry point. More...
 

Variables

static struct mapglobal_map
 
int orientation
 
int orientation_old
 
struct pedestrian pedestrian_data
 
int sensors_locked
 
struct attr initial_layout main_layout
 
static struct command_table commands [] = {{"pedestrian_rocket", command_cast(pedestrian_cmd_pedestrian_rocket)},}
 
static struct buildingbuildings
 
FILE * debug
 
FILE * debug2
 
static struct item_methods methods_route_occluded_item
 
static int no_recurse
 
static struct map_methods map_route_occluded_methods
 

Macro Definition Documentation

◆ DEBUG_COORD_GET

#define DEBUG_COORD_GET

◆ ORIENTATION_FLAT

#define ORIENTATION_FLAT   3

◆ ORIENTATION_LANDSCAPE

#define ORIENTATION_LANDSCAPE   2

◆ ORIENTATION_PORTRAIT

#define ORIENTATION_PORTRAIT   1

◆ ORIENTATION_UNKNOWN

#define ORIENTATION_UNKNOWN   0

Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

◆ TYPE_ACCELEROMETER

#define TYPE_ACCELEROMETER   1

◆ TYPE_MAGNETIC_FIELD

#define TYPE_MAGNETIC_FIELD   2

Function Documentation

◆ coord_next()

static int coord_next ( struct map_rect_priv mr,
struct coord c 
)
static

◆ intersect()

static int intersect ( struct coord p1,
struct coord p2,
struct coord p3,
struct coord p4,
struct coord i 
)
static

References dbg, debug2, lvl_debug, coord::x, and coord::y.

Referenced by is_visible_line().

◆ is_visible_line()

static int is_visible_line ( struct coord c0,
struct coord c1,
struct coord c2 
)
static

◆ map_route_occluded_attr_get()

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

◆ map_route_occluded_attr_rewind()

static void map_route_occluded_attr_rewind ( void *  priv_data)
static

◆ map_route_occluded_bbox()

static int map_route_occluded_bbox ( struct map map,
struct coord_rect bbox 
)
static

◆ map_route_occluded_buildings_free()

static void map_route_occluded_buildings_free ( void  )
static

◆ map_route_occluded_check_buildings()

static void map_route_occluded_check_buildings ( struct coord c0)
static

◆ map_route_occluded_coord_get()

◆ map_route_occluded_coord_rewind()

◆ map_route_occluded_destroy()

static void map_route_occluded_destroy ( struct map_priv priv)
static

◆ map_route_occluded_get_buildings()

◆ map_route_occluded_get_item()

◆ map_route_occluded_get_item_byid()

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

◆ map_route_occluded_new()

static struct map_priv* map_route_occluded_new ( struct map_methods meth,
struct attr **  attrs 
)
static

◆ map_route_occluded_rect_destroy()

static void map_route_occluded_rect_destroy ( struct map_rect_priv mr)
static

◆ map_route_occluded_rect_new()

◆ osd_marker_draw()

static void osd_marker_draw ( struct marker this,
struct navit nav 
)
static

References dbg, lvl_debug, navit_get_attr(), and p.

Referenced by osd_marker_init().

◆ osd_marker_init()

◆ osd_marker_new()

static struct osd_priv* osd_marker_new ( struct navit nav,
struct osd_methods meth,
struct attr **  attrs 
)
static

◆ osd_rocket_init()

◆ pedestrian_cmd_pedestrian_rocket()

static void pedestrian_cmd_pedestrian_rocket ( struct rocket rocket)
static

◆ pedestrian_draw_arrow()

static void pedestrian_draw_arrow ( struct graphics gra,
char *  name,
int  x,
int  y 
)
static

◆ pedestrian_draw_arrows()

◆ pedestrian_graphics_postdraw()

static void pedestrian_graphics_postdraw ( struct graphics gra)
static

◆ pedestrian_graphics_resize()

static void pedestrian_graphics_resize ( struct graphics gra,
int  w,
int  h 
)
static

◆ pedestrian_log()

static void pedestrian_log ( char **  logstr)
static

◆ pedestrian_navit()

static void pedestrian_navit ( struct navit nav,
int  add 
)
static

◆ pedestrian_navit_init()

◆ pedestrian_read_tilt()

void pedestrian_read_tilt ( int  fd,
struct navit nav,
struct tilt_data data 
)

◆ pedestrian_rocket_idle()

◆ pedestrian_setup_tilt()

◆ pedestrian_write_tilt()

void pedestrian_write_tilt ( int  fd,
int  axis 
)

◆ pedestrian_write_tilt_timer()

void pedestrian_write_tilt_timer ( int  fd,
struct tilt_data data 
)

References data, and pedestrian_write_tilt().

Referenced by pedestrian_setup_tilt().

◆ plugin_init()

◆ side()

static int side ( struct coord l0,
struct coord l1,
struct coord p 
)
static

Variable Documentation

◆ buildings

◆ commands

struct command_table commands[] = {{"pedestrian_rocket", command_cast(pedestrian_cmd_pedestrian_rocket)},}
static

Referenced by osd_rocket_init().

◆ debug

◆ debug2

◆ global_map

struct map* global_map
static

◆ main_layout

struct attr initial_layout main_layout

Referenced by pedestrian_navit_init().

◆ map_route_occluded_methods

struct map_methods map_route_occluded_methods
static
Initial value:
= {
"utf-8",
NULL,
NULL,
NULL,
}
static struct map_rect_priv * map_route_occluded_rect_new(struct map_priv *priv, struct map_selection *sel)
Definition: pedestrian.c:820
static void map_route_occluded_rect_destroy(struct map_rect_priv *mr)
Definition: pedestrian.c:863
static struct item * map_route_occluded_get_item(struct map_rect_priv *mr)
Definition: pedestrian.c:887
static void map_route_occluded_destroy(struct map_priv *priv)
Definition: pedestrian.c:814
static struct item * map_route_occluded_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo)
Definition: pedestrian.c:917
@ projection_mg
Definition: projection.h:25

Referenced by map_route_occluded_new().

◆ methods_route_occluded_item

struct item_methods methods_route_occluded_item
static
Initial value:
= {
}
static void map_route_occluded_coord_rewind(void *priv_data)
Definition: pedestrian.c:620
static void map_route_occluded_attr_rewind(void *priv_data)
Definition: pedestrian.c:633
static int map_route_occluded_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
Definition: pedestrian.c:639
static int map_route_occluded_coord_get(void *priv_data, struct coord *c, int count)
Definition: pedestrian.c:655

Referenced by map_route_occluded_rect_new().

◆ no_recurse

int no_recurse
static

◆ orientation

◆ orientation_old

int orientation_old

Referenced by pedestrian_navit_init().

◆ pedestrian_data

◆ sensors_locked

int sensors_locked

Referenced by pedestrian_rocket_idle().