navit  0.5.3-trunk
gpx2navit_txt.h File Reference
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <libgen.h>
#include <getopt.h>
#include <time.h>
#include <assert.h>
#include <expat.h>
#include "errorcode.h"

Go to the source code of this file.

Data Structures

struct  parent
 
struct  g2scolumns
 
struct  pathattr
 
struct  g2sattr
 
struct  g2sstats
 
struct  g2sprop
 
struct  parsedata
 

Macros

#define PROG   gpx2navit_txt
 
#define FILENAMELENGTH   255 /* 255 is max length for dbf string column */
 
#define COMMENTLENGTH   255 /* 255 is max length for dbf string column */
 
#define NAMELENGTH   32
 
#define TIMELENGTH   32
 
#define TYPELENGTH   16
 
#define BUFFSIZE   8192
 
#define DATABUFSIZE   16
 
#define failToWriteAttr(S, T)   failToWriteAttrRep((S), (T),__FILE__, __LINE__ )
 
#define DEBUG   0
 

Typedefs

typedef struct parent parent
 
typedef struct g2scolumns g2scolumns
 
typedef struct pathattr pathattr
 
typedef struct g2sattr g2sattr
 
typedef struct g2sstats g2sstats
 
typedef struct g2sprop g2sprop
 
typedef struct parsedata parsedata
 

Functions

void checkEllpsUnit (char *unit)
 
double checkLengthUnit (char *unit)
 
int checkTimeUnit (char *unit)
 
double getTimeInterval (char *_t, char *t)
 
double getSpeed (double length, double ti, double to_meter, int to_sec)
 
double getDistance (double _x, double _y, double x, double y)
 
void * myMallocRep (size_t size, const char *fileName, int line)
 
void failToWriteAttrRep (int iShape, int col, char *file, int line)
 
void showStats (g2sprop *prop)
 
void wipePathAttr (pathattr *pattr)
 
pathattrcreatePathAttr (void)
 
void wipeAttr (g2sattr *attr)
 
void setColsDefault (g2scolumns *cols)
 
g2scolumnscreateCols (void)
 
g2sattrcreateAttr (void)
 
g2spropcreateProp (void)
 
void closeProp (g2sprop *prop)
 
parsedatacreateParsedata (XML_Parser parser, g2sprop *prop)
 
void closeParsedata (parsedata *pdata)
 
void parseMain (g2sprop *pr)
 
void startElementControl (parsedata *pdata, const char *element, const char **attr)
 
void endElementControl (parsedata *pdata, const char *element)
 
void setWpt (parsedata *pdata)
 
void initPathAttr (pathattr *pattr, g2sattr *attr)
 
void setPathInterval (parsedata *pdata)
 
void setPathData (pathattr *parrt, g2sattr *attr)
 
void setPath (parsedata *pdata)
 
void setMetadata (parsedata *pdata)
 

Macro Definition Documentation

◆ BUFFSIZE

#define BUFFSIZE   8192

◆ COMMENTLENGTH

#define COMMENTLENGTH   255 /* 255 is max length for dbf string column */

◆ DATABUFSIZE

#define DATABUFSIZE   16

◆ DEBUG

#define DEBUG   0

◆ failToWriteAttr

#define failToWriteAttr (   S,
 
)    failToWriteAttrRep((S), (T),__FILE__, __LINE__ )

◆ FILENAMELENGTH

#define FILENAMELENGTH   255 /* 255 is max length for dbf string column */

◆ NAMELENGTH

#define NAMELENGTH   32

◆ PROG

#define PROG   gpx2navit_txt

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.

◆ TIMELENGTH

#define TIMELENGTH   32

◆ TYPELENGTH

#define TYPELENGTH   16

Typedef Documentation

◆ g2sattr

typedef struct g2sattr g2sattr

store each point attribute values.

◆ g2scolumns

typedef struct g2scolumns g2scolumns

set attribute columns on/off

◆ g2sprop

typedef struct g2sprop g2sprop

cluster of all dbfhandles cluster of all shphandles propaties structure for gpx2navit_txt

◆ g2sstats

typedef struct g2sstats g2sstats

statistics structure

◆ parent

typedef struct parent parent

make xml parent and child list

◆ parsedata

typedef struct parsedata parsedata

userdata structure between expat methods

◆ pathattr

typedef struct pathattr pathattr

store each path attribute values for trackpoint and route.

Function Documentation

◆ checkEllpsUnit()

void checkEllpsUnit ( char *  unit)

References ERR_ELLPSUNIT, and exit.

Referenced by setDefault().

◆ checkLengthUnit()

double checkLengthUnit ( char *  unit)

References ERR_LENGTHUNIT, exit, and to_meter.

Referenced by setDefault().

◆ checkTimeUnit()

int checkTimeUnit ( char *  unit)

References ERR_TIMEUNIT, exit, and p.

Referenced by setDefault().

◆ closeParsedata()

void closeParsedata ( parsedata pdata)

◆ closeProp()

void closeProp ( g2sprop prop)

◆ createAttr()

g2sattr * createAttr ( void  )

creates a element attribute structure.

References wipeAttr().

Referenced by createParsedata().

◆ createCols()

g2scolumns * createCols ( void  )

creates a column structure

References setColsDefault().

Referenced by createProp().

◆ createParsedata()

parsedata * createParsedata ( XML_Parser  parser,
g2sprop prop 
)

◆ createPathAttr()

pathattr * createPathAttr ( void  )

creates a new path attribute

References wipePathAttr().

Referenced by createParsedata().

◆ createProp()

◆ endElementControl()

◆ failToWriteAttrRep()

void failToWriteAttrRep ( int  iShape,
int  col,
char *  file,
int  line 
)

message when fail to write attribute

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.

message when fail to write attribute

◆ getDistance()

double getDistance ( double  _x,
double  _y,
double  x,
double  y 
)

References getDistanceCore(), and length.

Referenced by setPathInterval().

◆ getSpeed()

double getSpeed ( double  length,
double  ti,
double  to_meter,
int  to_sec 
)

References length, and to_meter.

Referenced by setPath(), and setPathInterval().

◆ getTimeInterval()

double getTimeInterval ( char *  _t,
char *  t 
)

Referenced by setPathInterval().

◆ initPathAttr()

void initPathAttr ( pathattr pattr,
g2sattr attr 
)

initialize a path attribute

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.

initialize a path attribute

References pathattr::cmt, pathattr::count, pathattr::desc, pathattr::interval, pathattr::length, pathattr::link, pathattr::name, pathattr::number, pathattr::point, pathattr::speed, pathattr::src, attr::type, and pathattr::type.

Referenced by startElementControl().

◆ myMallocRep()

void* myMallocRep ( size_t  size,
const char *  fileName,
int  line 
)

◆ parseMain()

◆ setColsDefault()

◆ setMetadata()

void setMetadata ( parsedata pdata)

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. store gpx metadata into text file

References parsedata::attr, ERR_CREATEFILE, exit, g2sprop::output, and parsedata::prop.

Referenced by endElementControl().

◆ setPath()

◆ setPathData()

void setPathData ( pathattr pattr,
g2sattr attr 
)

sets each track point data in array.

References pathattr::count, and pathattr::point.

Referenced by endElementControl().

◆ setPathInterval()

◆ setWpt()

void setWpt ( parsedata pdata)

save point objects in *_wpt or *_pnt file

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.

save point objects in *_wpt or *_pnt file

References parsedata::attr, parsedata::current, g2sattr::desc, g2sattr::ele, parsedata::fp, g2sprop::is3d, g2sattr::lat, g2sattr::lon, parent::name, g2sattr::name, parsedata::prop, g2sprop::stats, g2sattr::type, and g2sstats::wptpoints.

Referenced by endElementControl().

◆ showStats()

◆ startElementControl()

void startElementControl ( parsedata pdata,
const char *  element,
const char **  attr 
)

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.

References parsedata::attr, g2sattr::author, initPathAttr(), g2sattr::lat, g2sattr::lon, g2sattr::maxlat, g2sattr::maxlon, g2sattr::minlat, g2sattr::minlon, g2sprop::parseRte, g2sprop::parseTrk, parsedata::pattr, and parsedata::prop.

Referenced by startElement().

◆ wipeAttr()

void wipeAttr ( g2sattr attr)

clears a element attribute structure

References attr::type.

Referenced by createAttr(), and endElementControl().

◆ wipePathAttr()