navit
0.5.3-trunk
|
#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) |
pathattr * | createPathAttr (void) |
void | wipeAttr (g2sattr *attr) |
void | setColsDefault (g2scolumns *cols) |
g2scolumns * | createCols (void) |
g2sattr * | createAttr (void) |
g2sprop * | createProp (void) |
void | closeProp (g2sprop *prop) |
parsedata * | createParsedata (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) |
#define BUFFSIZE 8192 |
#define DATABUFSIZE 16 |
#define DEBUG 0 |
#define failToWriteAttr | ( | S, | |
T | |||
) | failToWriteAttrRep((S), (T),__FILE__, __LINE__ ) |
#define NAMELENGTH 32 |
#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.
#define TIMELENGTH 32 |
#define TYPELENGTH 16 |
typedef struct g2scolumns g2scolumns |
set attribute columns on/off
cluster of all dbfhandles cluster of all shphandles propaties structure for gpx2navit_txt
void checkEllpsUnit | ( | char * | unit | ) |
References ERR_ELLPSUNIT, and exit.
Referenced by setDefault().
double checkLengthUnit | ( | char * | unit | ) |
References ERR_LENGTHUNIT, exit, and to_meter.
Referenced by setDefault().
int checkTimeUnit | ( | char * | unit | ) |
References ERR_TIMEUNIT, exit, and p.
Referenced by setDefault().
void closeParsedata | ( | parsedata * | pdata | ) |
References parsedata::attr, parsedata::current, parsedata::databuf, parsedata::parent, and parsedata::pattr.
Referenced by parseMain().
void closeProp | ( | g2sprop * | prop | ) |
close and free a propertires structure
References g2sprop::cols, g2sprop::ellipsoid, g2sprop::lengthUnit, g2sprop::output, g2sprop::sourcefile, g2sprop::speedLengthUnit, g2sprop::speedTimeUnit, g2sprop::stats, and g2sprop::timeUnit.
Referenced by main().
g2sattr * createAttr | ( | void | ) |
g2scolumns * createCols | ( | void | ) |
creates a shapehandles structure creates a dbfhandles structure creates a parse structure
References parsedata::attr, parsedata::bufptr, c, createAttr(), createPathAttr(), parsedata::current, parsedata::databuf, DATABUFSIZE, parsedata::depth, parsedata::failed, parsedata::failedid, parsedata::fp, p, parsedata::parent, parsedata::parser, parsedata::pattr, and parsedata::prop.
Referenced by parseMain().
pathattr * createPathAttr | ( | void | ) |
g2sprop * createProp | ( | void | ) |
creates a properties structure for gpx2shp
References g2sprop::cols, createCols(), g2sprop::ellipsoid, g2sprop::is3d, g2sprop::isEdge, g2sprop::isFast, g2sprop::isPoint, g2sprop::lengthUnit, g2sprop::minlength, g2sprop::minpoints, g2sprop::mintime, g2sprop::needsStats, g2sprop::output, g2sprop::parseRte, g2sprop::parseTrk, g2sprop::parseWpt, g2sstats::rtecount, g2sstats::rtelength, g2sstats::rtepoints, g2sstats::rteunconverted, g2sprop::speedLengthUnit, g2sprop::speedTimeUnit, g2sprop::stats, g2sprop::timeUnit, g2sstats::trkcount, g2sstats::trklength, g2sstats::trkpoints, g2sstats::trkunconverted, g2sprop::verbose, and g2sstats::wptpoints.
Referenced by main().
void endElementControl | ( | parsedata * | pdata, |
const char * | element | ||
) |
This method is kicked by tag end event. It corrects char elements when the element tag has some data, then start to convert when tag is top level tag like <wpt>.
References g2sattr::ageofdgpsdata, parsedata::attr, g2sattr::author, parsedata::bufptr, g2sattr::cmt, g2sattr::copyright, parsedata::databuf, DEBUG, g2sattr::desc, g2sattr::ele, g2sattr::fix, g2sattr::geoidheight, g2sattr::hdop, g2sprop::isFast, g2sprop::isPoint, g2sattr::keywords, g2sattr::license, g2sattr::link, g2sattr::magvar, g2sattr::name, g2sattr::number, g2sprop::parseRte, g2sprop::parseTrk, g2sprop::parseWpt, parsedata::pattr, g2sattr::pdop, parsedata::prop, g2sattr::sat, setMetadata(), setPath(), setPathData(), setPathInterval(), setWpt(), g2sattr::src, g2sattr::sym, g2sattr::time, g2sattr::type, g2sattr::vdop, wipeAttr(), and g2sattr::year.
Referenced by endElement().
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
double getDistance | ( | double | _x, |
double | _y, | ||
double | x, | ||
double | y | ||
) |
References getDistanceCore(), and length.
Referenced by setPathInterval().
double getSpeed | ( | double | length, |
double | ti, | ||
double | to_meter, | ||
int | to_sec | ||
) |
References length, and to_meter.
Referenced by setPath(), and setPathInterval().
double getTimeInterval | ( | char * | _t, |
char * | t | ||
) |
Referenced by setPathInterval().
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().
void* myMallocRep | ( | size_t | size, |
const char * | fileName, | ||
int | line | ||
) |
void parseMain | ( | g2sprop * | pr | ) |
References BUFFSIZE, charHandle(), closeParsedata(), createParsedata(), endElement(), ERR_CANNOTOPEN, ERR_OUTOFMEMORY, ERR_PARSEERROR, ERR_READERROR, exit, parsedata::fp, g2sprop::output, parsedata::prop, g2sprop::sourcefile, and startElement().
Referenced by main().
void setColsDefault | ( | g2scolumns * | cols | ) |
sets default values to a column properties.
References g2scolumns::ageofdgpsdata, g2scolumns::cmt, g2scolumns::desc, g2scolumns::dgpsid, g2scolumns::ele, g2scolumns::fix, g2scolumns::geoidheight, g2scolumns::gpxline, g2scolumns::hdop, g2scolumns::interval, g2scolumns::length, g2scolumns::link, g2scolumns::magvar, g2scolumns::name, g2scolumns::number, g2scolumns::pdop, g2scolumns::points, g2scolumns::sat, g2scolumns::speed, g2scolumns::src, g2scolumns::sym, g2scolumns::time, g2scolumns::type, and g2scolumns::vdop.
Referenced by createCols().
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().
void setPath | ( | parsedata * | pdata | ) |
saves path data into files.
References checkPath(), pathattr::count, countPath(), pathattr::desc, parsedata::fp, getSpeed(), pathattr::interval, g2sprop::is3d, g2sprop::isFast, pathattr::length, pathattr::name, parsedata::pattr, pathattr::point, parsedata::prop, pathattr::speed, g2sprop::speed2meter, g2sprop::speed2sec, and pathattr::type.
Referenced by endElementControl().
sets each track point data in array.
References pathattr::count, and pathattr::point.
Referenced by endElementControl().
void setPathInterval | ( | parsedata * | pdata | ) |
sets interval data between two track points
References parsedata::attr, pathattr::count, getDistance(), getSpeed(), getTimeInterval(), pathattr::interval, g2sprop::isEdge, pathattr::length, parsedata::pattr, parsedata::prop, setEdge(), g2sprop::speed2meter, g2sprop::speed2sec, and TIMELENGTH.
Referenced by endElementControl().
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().
void showStats | ( | g2sprop * | prop | ) |
shows short statistics
References g2sprop::isFast, g2sprop::needsStats, g2sprop::parseRte, g2sprop::parseTrk, g2sprop::parseWpt, g2sstats::rtecount, g2sstats::rtelength, g2sstats::rtepoints, g2sstats::rteunconverted, g2sprop::stats, g2sstats::trkcount, g2sstats::trklength, g2sstats::trkpoints, g2sstats::trkunconverted, and g2sstats::wptpoints.
Referenced by main().
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().
void wipeAttr | ( | g2sattr * | attr | ) |
clears a element attribute structure
References attr::type.
Referenced by createAttr(), and endElementControl().
void wipePathAttr | ( | pathattr * | pattr | ) |
clears a path attribute structure
References pathattr::cmt, pathattr::count, pathattr::desc, pathattr::interval, pathattr::length, pathattr::link, pathattr::name, pathattr::number, pathattr::speed, pathattr::src, and pathattr::type.
Referenced by createPathAttr().