/[zanavi_public1]/navit/navit/tools/gpx2navit_txt/src/setmeta.c
ZANavi

Contents of /navit/navit/tools/gpx2navit_txt/src/setmeta.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download)
Fri Oct 28 21:19:04 2011 UTC (12 years, 5 months ago) by zoff99
File MIME type: text/plain
File size: 2173 byte(s)
import files
1 /**
2 * Navit, a modular navigation system.
3 * Copyright (C) 2005-2008 Navit Team
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #include "gpx2navit_txt.h"
21
22 /**
23 * store gpx metadata into text file
24 */
25 void setMetadata(parsedata * pdata)
26 {
27 g2sprop *prop = pdata->prop;
28 g2sattr *attr = pdata->attr;
29 FILE *metafile;
30 char *output = malloc(sizeof(char) * (strlen(prop->output) + 10));
31 strcpy(output, prop->output);
32 strcat(output, "_meta.txt");
33 metafile = fopen(output, "w");
34 if (metafile == NULL) {
35 fprintf(stderr, "Cannot create file: %s\n", output);
36 exit(ERR_CREATEFILE);
37 }
38 if (attr->name) {
39 fprintf(metafile, "name\t%s\n", attr->name);
40 }
41 if (attr->desc) {
42 fprintf(metafile, "description\t%s\n", attr->desc);
43 }
44 if (attr->author) {
45 fprintf(metafile, "author\t%s\n", attr->author);
46 }
47 if (attr->copyright) {
48 fprintf(metafile, "copyright\t%s\n", attr->copyright);
49 }
50 if (attr->link) {
51 fprintf(metafile, "link\t%s\n", attr->link);
52 }
53 if (attr->time) {
54 fprintf(metafile, "time\t%s\n", attr->time);
55 }
56 if (attr->keywords) {
57 fprintf(metafile, "keywords\t%s\n", attr->keywords);
58 }
59 if (attr->minlat) {
60 fprintf(metafile, "min latitude\t%f\n", attr->minlat);
61 }
62 if (attr->minlon) {
63 fprintf(metafile, "min longitude\t%f\n", attr->minlon);
64 }
65 if (attr->maxlat) {
66 fprintf(metafile, "max latitude\t%f\n", attr->maxlat);
67 }
68 if (attr->maxlon) {
69 fprintf(metafile, "max longitude\t%f\n", attr->maxlon);
70 }
71 fclose(metafile);
72 free(output);
73 }

   
Visit the ZANavi Wiki