navit  0.5.3-trunk
shapefile.c File Reference
#include <stdlib.h>
#include <glib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "config.h"
#include "debug.h"
#include "plugin.h"
#include "projection.h"
#include "item.h"
#include "map.h"
#include "maptype.h"
#include "attr.h"
#include "transform.h"
#include "file.h"
#include "shapefil.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  longest_match_list_item
 
struct  longest_match_list
 
struct  longest_match
 

Macros

#define IS_ARC(x)   ((x).nSHPType == SHPT_ARC || (x).nSHPType == SHPT_ARCZ || (x).nSHPType == SHPT_ARCM)
 
#define IS_POLYGON(x)   ((x).nSHPType == SHPT_POLYGON || (x).nSHPType == SHPT_POLYGONZ || (x).nSHPType == SHPT_POLYGONM)
 

Functions

static void map_destroy_shapefile (struct map_priv *m)
 
static void shapefile_coord_rewind (void *priv_data)
 
static void shapefile_coord (struct map_rect_priv *mr, int idx, struct coord *c)
 
static int shapefile_coord_get (void *priv_data, struct coord *c, int count)
 
static void shapefile_attr_rewind (void *priv_data)
 
static void longest_match_add_match (struct longest_match *lm, struct longest_match_list_item *lmi, char *match)
 
static void longest_match_item_destroy (struct longest_match_list_item *lmi, gpointer p_flags)
 
static struct longest_match_list_itemlongest_match_item_new (struct longest_match_list *lml, void *data)
 
static struct longest_match_listlongest_match_list_new (struct longest_match *lm)
 
static void longest_match_list_destroy (struct longest_match_list *lml, gpointer p_flags)
 
static struct longest_match_listlongest_match_get_list (struct longest_match *lm, int list)
 
static struct longest_matchlongest_match_new (void)
 
static void longest_match_destroy (struct longest_match *lm, long flags)
 
static void longest_match_clear (struct longest_match *lm)
 
static void longest_match_add_key_value (struct longest_match *lm, char *k, char *v)
 
static int longest_match_list_find (struct longest_match *lm, struct longest_match_list *lml, void **list, int max_list_len)
 
static void build_match (struct longest_match *lm, struct longest_match_list *lml, char *line)
 
static void build_matches (struct map_priv *m, char *matches)
 
static void process_fields (struct map_priv *m, int id)
 
static int attr_resolve (struct map_rect_priv *mr, enum attr_type attr_type, struct attr *attr)
 
static int shapefile_attr_get (void *priv_data, enum attr_type attr_type, struct attr *attr)
 
static struct map_rect_privmap_rect_new_shapefile (struct map_priv *map, struct map_selection *sel)
 
static void map_rect_destroy_shapefile (struct map_rect_priv *mr)
 
static struct itemmap_rect_get_item_shapefile (struct map_rect_priv *mr)
 
static struct itemmap_rect_get_item_byid_shapefile (struct map_rect_priv *mr, int id_hi, int id_lo)
 
static struct map_privmap_new_shapefile (struct map_methods *meth, struct attr **attrs, struct callback_list *cbl)
 
void plugin_init (void)
 
static SAFile VSI_SHP_Open (const char *pszFilename, const char *pszAccess)
 
static SAOffset VSI_SHP_Read (void *p, SAOffset size, SAOffset nmemb, SAFile file)
 
static SAOffset VSI_SHP_Write (void *p, SAOffset size, SAOffset nmemb, SAFile file)
 
static SAOffset VSI_SHP_Seek (SAFile file, SAOffset offset, int whence)
 
static SAOffset VSI_SHP_Tell (SAFile file)
 
static int VSI_SHP_Flush (SAFile file)
 
static int VSI_SHP_Close (SAFile file)
 
static void VSI_SHP_Error (const char *message)
 
static int VSI_SHP_Remove (const char *pszFilename)
 
void SASetupDefaultHooks (SAHooks *psHooks)
 

Variables

static struct item_methods methods_shapefile
 
static struct map_methods map_methods_shapefile
 

Macro Definition Documentation

◆ IS_ARC

#define IS_ARC (   x)    ((x).nSHPType == SHPT_ARC || (x).nSHPType == SHPT_ARCZ || (x).nSHPType == SHPT_ARCM)

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.

◆ IS_POLYGON

#define IS_POLYGON (   x)    ((x).nSHPType == SHPT_POLYGON || (x).nSHPType == SHPT_POLYGONZ || (x).nSHPType == SHPT_POLYGONM)

Function Documentation

◆ attr_resolve()

◆ build_match()

static void build_match ( struct longest_match lm,
struct longest_match_list lml,
char *  line 
)
static

◆ build_matches()

static void build_matches ( struct map_priv m,
char *  matches 
)
static

◆ longest_match_add_key_value()

static void longest_match_add_key_value ( struct longest_match lm,
char *  k,
char *  v 
)
static

◆ longest_match_add_match()

◆ longest_match_clear()

static void longest_match_clear ( struct longest_match lm)
static

◆ longest_match_destroy()

static void longest_match_destroy ( struct longest_match lm,
long  flags 
)
static

◆ longest_match_get_list()

static struct longest_match_list* longest_match_get_list ( struct longest_match lm,
int  list 
)
static

◆ longest_match_item_destroy()

static void longest_match_item_destroy ( struct longest_match_list_item lmi,
gpointer  p_flags 
)
static

◆ longest_match_item_new()

static struct longest_match_list_item* longest_match_item_new ( struct longest_match_list lml,
void *  data 
)
static

◆ longest_match_list_destroy()

static void longest_match_list_destroy ( struct longest_match_list lml,
gpointer  p_flags 
)
static

◆ longest_match_list_find()

static int longest_match_list_find ( struct longest_match lm,
struct longest_match_list lml,
void **  list,
int  max_list_len 
)
static

◆ longest_match_list_new()

static struct longest_match_list* longest_match_list_new ( struct longest_match lm)
static

◆ longest_match_new()

static struct longest_match* longest_match_new ( void  )
static

◆ map_destroy_shapefile()

static void map_destroy_shapefile ( struct map_priv m)
static

References dbg, and lvl_debug.

◆ map_new_shapefile()

◆ map_rect_destroy_shapefile()

static void map_rect_destroy_shapefile ( struct map_rect_priv mr)
static

◆ map_rect_get_item_byid_shapefile()

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

◆ map_rect_get_item_shapefile()

◆ map_rect_new_shapefile()

◆ plugin_init()

void plugin_init ( void  )

References dbg, lvl_debug, and map_new_shapefile().

◆ process_fields()

static void process_fields ( struct map_priv m,
int  id 
)
static

◆ SASetupDefaultHooks()

◆ shapefile_attr_get()

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

◆ shapefile_attr_rewind()

static void shapefile_attr_rewind ( void *  priv_data)
static

◆ shapefile_coord()

static void shapefile_coord ( struct map_rect_priv mr,
int  idx,
struct coord c 
)
static

◆ shapefile_coord_get()

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

◆ shapefile_coord_rewind()

static void shapefile_coord_rewind ( void *  priv_data)
static

◆ VSI_SHP_Close()

static int VSI_SHP_Close ( SAFile  file)
static

Referenced by SASetupDefaultHooks().

◆ VSI_SHP_Error()

static void VSI_SHP_Error ( const char *  message)
static

References dbg, and lvl_error.

Referenced by SASetupDefaultHooks().

◆ VSI_SHP_Flush()

static int VSI_SHP_Flush ( SAFile  file)
static

Referenced by SASetupDefaultHooks().

◆ VSI_SHP_Open()

static SAFile VSI_SHP_Open ( const char *  pszFilename,
const char *  pszAccess 
)
static

Referenced by SASetupDefaultHooks().

◆ VSI_SHP_Read()

static SAOffset VSI_SHP_Read ( void *  p,
SAOffset  size,
SAOffset  nmemb,
SAFile  file 
)
static

References p, and size.

Referenced by SASetupDefaultHooks().

◆ VSI_SHP_Remove()

static int VSI_SHP_Remove ( const char *  pszFilename)
static

Referenced by SASetupDefaultHooks().

◆ VSI_SHP_Seek()

static SAOffset VSI_SHP_Seek ( SAFile  file,
SAOffset  offset,
int  whence 
)
static

References offset.

Referenced by SASetupDefaultHooks().

◆ VSI_SHP_Tell()

static SAOffset VSI_SHP_Tell ( SAFile  file)
static

Referenced by SASetupDefaultHooks().

◆ VSI_SHP_Write()

static SAOffset VSI_SHP_Write ( void *  p,
SAOffset  size,
SAOffset  nmemb,
SAFile  file 
)
static

References p, and size.

Referenced by SASetupDefaultHooks().

Variable Documentation

◆ map_methods_shapefile

struct map_methods map_methods_shapefile
static
Initial value:
= {
"iso8859-1",
}
@ projection_mg
Definition: projection.h:25
static struct item * map_rect_get_item_shapefile(struct map_rect_priv *mr)
Definition: shapefile.c:522
static struct item * map_rect_get_item_byid_shapefile(struct map_rect_priv *mr, int id_hi, int id_lo)
Definition: shapefile.c:572
static void map_destroy_shapefile(struct map_priv *m)
Definition: shapefile.c:76
static struct map_rect_priv * map_rect_new_shapefile(struct map_priv *map, struct map_selection *sel)
Definition: shapefile.c:464
static void map_rect_destroy_shapefile(struct map_rect_priv *mr)
Definition: shapefile.c:514

Referenced by map_new_shapefile().

◆ methods_shapefile

struct item_methods methods_shapefile
static
Initial value:
= {
}
static void shapefile_coord_rewind(void *priv_data)
Definition: shapefile.c:81
static int shapefile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
Definition: shapefile.c:402
static int shapefile_coord_get(void *priv_data, struct coord *c, int count)
Definition: shapefile.c:103
static void shapefile_attr_rewind(void *priv_data)
Definition: shapefile.c:133

Referenced by map_rect_new_shapefile().