navit  0.5.1-trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups
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, long flags)
 
static struct
longest_match_list_item
longest_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, long 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

struct map_priv __attribute__
 
static struct item_methods methods_shapefile
 
static struct map_methods map_methods_shapefile
 

Macro Definition Documentation

#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.

Referenced by map_rect_get_item_shapefile(), and shapefile_coord_get().

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

Referenced by shapefile_coord_get().

Function Documentation

static void build_match ( struct longest_match lm,
struct longest_match_list lml,
char *  line 
)
static
static void build_matches ( struct map_priv m,
char *  matches 
)
static
static void longest_match_add_key_value ( struct longest_match lm,
char *  k,
char *  v 
)
static
static void longest_match_clear ( struct longest_match lm)
static
static void longest_match_destroy ( struct longest_match lm,
long  flags 
)
static
static struct longest_match_list* longest_match_get_list ( struct longest_match lm,
int  list 
)
static
static void longest_match_item_destroy ( struct longest_match_list_item lmi,
long  flags 
)
static
static struct longest_match_list_item* longest_match_item_new ( struct longest_match_list lml,
void *  data 
)
static
static void longest_match_list_destroy ( struct longest_match_list lml,
long  flags 
)
static
static struct longest_match_list* longest_match_list_new ( struct longest_match lm)
static
static struct longest_match* longest_match_new ( void  )
static
static void map_destroy_shapefile ( struct map_priv m)
static

References dbg, and lvl_debug.

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

References dbg, lvl_debug, and map_new_shapefile().

static void process_fields ( struct map_priv m,
int  id 
)
static
static int shapefile_attr_get ( void *  priv_data,
enum attr_type  attr_type,
struct attr attr 
)
static
static void shapefile_attr_rewind ( void *  priv_data)
static
static int shapefile_coord_get ( void *  priv_data,
struct coord c,
int  count 
)
static
static void shapefile_coord_rewind ( void *  priv_data)
static
static int VSI_SHP_Close ( SAFile  file)
static

Referenced by SASetupDefaultHooks().

static void VSI_SHP_Error ( const char *  message)
static

References dbg, and lvl_error.

Referenced by SASetupDefaultHooks().

static int VSI_SHP_Flush ( SAFile  file)
static

Referenced by SASetupDefaultHooks().

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

Referenced by SASetupDefaultHooks().

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

Referenced by SASetupDefaultHooks().

static int VSI_SHP_Remove ( const char *  pszFilename)
static

Referenced by SASetupDefaultHooks().

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

Referenced by SASetupDefaultHooks().

static SAOffset VSI_SHP_Tell ( SAFile  file)
static

Referenced by SASetupDefaultHooks().

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

Referenced by SASetupDefaultHooks().

Variable Documentation

struct map_priv __attribute__
struct map_methods map_methods_shapefile
static
Initial value:
= {
"iso8859-1",
}
static struct map_rect_priv * map_rect_new_shapefile(struct map_priv *map, struct map_selection *sel)
Definition: shapefile.c:504
static void map_rect_destroy_shapefile(struct map_rect_priv *mr)
Definition: shapefile.c:556
Definition: projection.h:25
static struct item * map_rect_get_item_shapefile(struct map_rect_priv *mr)
Definition: shapefile.c:566
static struct item * map_rect_get_item_byid_shapefile(struct map_rect_priv *mr, int id_hi, int id_lo)
Definition: shapefile.c:618
static void map_destroy_shapefile(struct map_priv *m)
Definition: shapefile.c:77

Referenced by map_new_shapefile().

struct item_methods methods_shapefile
static
Initial value:
= {
}
static void shapefile_coord_rewind(void *priv_data)
Definition: shapefile.c:84
static int shapefile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
Definition: shapefile.c:440
static int shapefile_coord_get(void *priv_data, struct coord *c, int count)
Definition: shapefile.c:110
static void shapefile_attr_rewind(void *priv_data)
Definition: shapefile.c:142

Referenced by map_rect_new_shapefile().