summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-09-03 08:50:31 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-09-03 08:50:31 +0000
commit9b4ae9940bfd33a6436f381adf9fa99e79ceb75e (patch)
treed7474a7cbc7ba11b1468f7dd7181b6bd4dd6d682
parent39f3118dcc2e86097a28c002a41ca389e70df657 (diff)
downloadnavit-svn-9b4ae9940bfd33a6436f381adf9fa99e79ceb75e.tar.gz
Add:map_textfile:Optionally reverse order of line and points
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@3550 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r--navit/map/textfile/textfile.c19
-rw-r--r--navit/map/textfile/textfile.h1
2 files changed, 16 insertions, 4 deletions
diff --git a/navit/map/textfile/textfile.c b/navit/map/textfile/textfile.c
index 9cf9c515..b568c66c 100644
--- a/navit/map/textfile/textfile.c
+++ b/navit/map/textfile/textfile.c
@@ -169,7 +169,10 @@ map_rect_new_textfile(struct map_priv *map, struct map_selection *sel)
mr=g_new0(struct map_rect_priv, 1);
mr->m=map;
mr->sel=sel;
- mr->item.id_hi=0;
+ if (map->flags & 1)
+ mr->item.id_hi=1;
+ else
+ mr->item.id_hi=0;
mr->item.id_lo=0;
mr->item.meth=&methods_textfile;
mr->item.priv_data=mr;
@@ -232,10 +235,15 @@ map_rect_get_item_textfile(struct map_rect_priv *mr)
for(;;) {
if (feof(mr->f)) {
dbg(1,"map_rect_get_item_textfile: eof %d\n",mr->item.id_hi);
- if (mr->item.id_hi) {
- return NULL;
+ if (mr->m->flags & 1) {
+ if (!mr->item.id_hi)
+ return NULL;
+ mr->item.id_hi=0;
+ } else {
+ if (mr->item.id_hi)
+ return NULL;
+ mr->item.id_hi=1;
}
- mr->item.id_hi++;
if (mr->m->is_pipe) {
pclose(mr->f);
mr->f=popen(mr->args, "r");
@@ -321,6 +329,7 @@ map_new_textfile(struct map_methods *meth, struct attr **attrs)
struct map_priv *m;
struct attr *data=attr_search(attrs, NULL, attr_data);
struct attr *charset=attr_search(attrs, NULL, attr_charset);
+ struct attr *flags=attr_search(attrs, NULL, attr_flags);
struct file_wordexp *wexp;
int len,is_pipe=0;
char *wdata;
@@ -342,6 +351,8 @@ map_new_textfile(struct map_methods *meth, struct attr **attrs)
m->id=++map_id;
m->filename=g_strdup(wexp_data[0]);
m->is_pipe=is_pipe;
+ if (flags)
+ m->flags=flags->u.num;
dbg(1,"map_new_textfile %s %s\n", m->filename, wdata);
if (charset) {
m->charset=g_strdup(charset->u.str);
diff --git a/navit/map/textfile/textfile.h b/navit/map/textfile/textfile.h
index ef97e33a..05e47699 100644
--- a/navit/map/textfile/textfile.h
+++ b/navit/map/textfile/textfile.h
@@ -25,6 +25,7 @@ struct map_priv {
char *filename;
char *charset;
int is_pipe;
+ int flags;
};
#define SIZE 512