modulevehicledir=$(pkglibdir)/vehicle
pkgdocdir=$(pkgdatadir)
xpmdir=$(pkgdatadir)/xpm
+mapsdir=$(pkgdatadir)/maps
if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
PO=""
if test "$LINGUAS" = ""; then
- ling=` (cd po; /bin/ls *.po) `
+ ling=` (cd $srcdir/po; /bin/ls *.po) `
for l in $ling; do
lcode=`basename $l .po`
LINGUAS="$LINGUAS$lcode "
EXTRA_DIST = @POFILES@
POTFILES = \
- $(top_builddir)/src/main.c \
- $(top_builddir)/src/navigation.c \
- $(top_builddir)/src/navit.c \
- $(top_builddir)/src/country.c \
- $(top_builddir)/src/gui/gtk/destination.c \
- $(top_builddir)/src/gui/gtk/gui_gtk_action.c
+ $(top_srcdir)/src/main.c \
+ $(top_srcdir)/src/navigation.c \
+ $(top_srcdir)/src/navit.c \
+ $(top_srcdir)/src/country.c \
+ $(top_srcdir)/src/gui/gtk/destination.c \
+ $(top_srcdir)/src/gui/gtk/gui_gtk_action.c
SUFFIXES = .po .mo
.po.mo:
- $(MSGFMT) --check --verbose --statistics --output-file=$@ $<
+ dir=`basename $@ .mo` ;\
+ $(MSGFMT) --check --verbose --statistics --output-file=$@ $< && \
+ mkdir -p ../locale/$$dir/LC_MESSAGES && \
+ cp $@ ../locale/$$dir/LC_MESSAGES/navit.mo
all: @MOFILES@
@POFILES@: navit.pot
+ if test "$(top_srcdir)" != "$(top_builddir)"; then \
+ cp $(top_srcdir)/po/$@ $(top_builddir)/po/$@; \
+ fi; \
$(MSGMERGE) --update --verbose $@ navit.pot
navit.pot: $(POTFILES)
include $(top_srcdir)/Makefile.inc
SUBDIRS=binding data fib-1.1 gui graphics osd speech vehicle xpm
-AM_CPPFLAGS = -I$(top_srcdir)/src/fib-1.1 @NAVIT_CFLAGS@ -DMODULE=\"navit\"
+SAMPLE_MAP=osm_bbox_11.3,47.9,11.7,48.2
+
+AM_CPPFLAGS = -I$(top_srcdir)/src/fib-1.1 @NAVIT_CFLAGS@ -DPREFIX=\"@prefix@\" -DMODULE=\"navit\"
bin_PROGRAMS = navit
pkgdata_DATA = navit.xml
-EXTRA_DIST = navit.xml
+maps_DATA=maps/$(SAMPLE_MAP).txt
+
+EXTRA_DIST = navit.xml maps/$(SAMPLE_MAP).txt
navit_SOURCES = attr.c callback.c compass.c coord.c country.c cursor.c data_window.c debug.c \
file.c graphics.c gui.c item.c layout.c log.c main.c map.c \
navit_LDADD = @NAVIT_LIBS@ @GPSD_LIBS@ -Lfib-1.1 -lfib
+maps/$(SAMPLE_MAP).osm:
+ echo "Downloading osm sample map"
+ mkdir -p maps
+ wget -O maps/$(SAMPLE_MAP).osm.tmp http://navit.sourceforge.net/maps/$(SAMPLE_MAP).osm
+ mv maps/$(SAMPLE_MAP).osm.tmp maps/$(SAMPLE_MAP).osm
+
+maps/$(SAMPLE_MAP).txt: maps/$(SAMPLE_MAP).osm $(top_srcdir)/src/script/osm2navit
+ echo "Converting osm sample map"
+ $(top_srcdir)/src/script/osm2navit <maps/$(SAMPLE_MAP).osm >maps/$(SAMPLE_MAP).txt.tmp
+ mv maps/$(SAMPLE_MAP).txt.tmp maps/$(SAMPLE_MAP).txt
+
ATTR(skin)
ATTR(label)
ATTR(data)
+ATTR(charset)
ATTR(country_all)
ATTR(country_iso3)
ATTR(country_iso2)
return &mr->item;
break;
case file_border_ply:
- /* case file_bridge_ply: */
+ case file_bridge_ply:
case file_build_ply:
case file_golf_ply:
/* case file_height_ply: */
#include "attr.h"
#include "coord.h"
#include "transform.h"
+#include "file.h"
#include "textfile.h"
{
struct map_priv *m;
struct attr *data=attr_search(attrs, NULL, attr_data);
+ struct attr *charset=attr_search(attrs, NULL, attr_charset);
+ struct file_wordexp *wexp;
+ char **wexp_data;
if (! data)
return NULL;
+
+ wexp=file_wordexp_new(data->u.str);
+ wexp_data=file_wordexp_get_array(wexp);
dbg(1,"map_new_textfile %s\n", data->u.str);
*meth=map_methods_textfile;
- m=g_new(struct map_priv, 1);
+ m=g_new0(struct map_priv, 1);
m->id=++map_id;
- m->filename=g_strdup(data->u.str);
+ m->filename=g_strdup(wexp_data[0]);
+ if (charset) {
+ m->charset=g_strdup(charset->u.str);
+ meth->charset=m->charset;
+ }
+ file_wordexp_destroy(wexp);
return m;
}
struct map_priv {
int id;
char *filename;
+ char *charset;
};
#define SIZE 512
#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <glib.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <unistd.h>
#include <libintl.h>
#ifdef USE_GTK_MAIN_LOOP
#include <gtk/gtk.h>
{
GError *error = NULL;
char *config_file = NULL;
+ char *s;
+ int l;
signal(SIGCHLD, sigchld);
setlocale(LC_NUMERIC,"C");
setlocale(LC_NUMERIC,"C");
- if (file_exists("navit.c")) {
+ if (file_exists("navit.c") || file_exists("navit.o")) {
+ char buffer[PATH_MAX];
printf(_("Running from source directory\n"));
+ getcwd(buffer, PATH_MAX);
+ setenv("NAVIT_PREFIX", buffer, 0);
+ setenv("NAVIT_LIBDIR", buffer, 0);
+ setenv("NAVIT_SHAREDIR", buffer, 0);
+ setenv("NAVIT_LIBPREFIX", "*/.libs/", 0);
+ s=g_strdup_printf("%s/../locale", buffer);
+ setenv("NAVIT_LOCALEDIR", s, 0);
+ g_free(s);
+ } else {
+ if (!getenv("NAVIT_PREFIX")) {
+ l=strlen(argv[0]);
+ if (l > 10 && !strcmp(argv[0]+l-10,"/bin/navit")) {
+ s=g_strdup(argv[0]);
+ s[l-10]='\0';
+ if (strcmp(s, PREFIX))
+ printf(_("setting '%s' to '%s'\n"), "NAVIT_PREFIX", s);
+ setenv("NAVIT_PREFIX", s, 0);
+ g_free(s);
+ } else
+ setenv("NAVIT_PREFIX", PREFIX, 0);
+ }
+ s=g_strdup_printf("%s/share/locale", getenv("NAVIT_PREFIX"));
+ setenv("NAVIT_LOCALEDIR", s, 0);
+ g_free(s);
+ s=g_strdup_printf("%s/share/navit", getenv("NAVIT_PREFIX"));
+ setenv("NAVIT_SHAREDIR", s, 0);
+ g_free(s);
+ s=g_strdup_printf("%s/lib/navit", getenv("NAVIT_PREFIX"));
+ setenv("NAVIT_LIBDIR", s, 0);
+ g_free(s);
}
- bindtextdomain( "navit", "/usr/share/locale" );
+ bindtextdomain( "navit", getenv("NAVIT_LOCALEDIR"));
textdomain( "navit" );
debug_init();
gdk_rgb_init();
#endif
+ config_file=NULL;
if (argc > 1)
config_file=argv[1];
- else {
+ if (! config_file) {
config_file=g_strjoin(NULL,get_home_directory(), "/.navit/navit.xml" , NULL);
if (!file_exists(config_file)) {
- if (file_exists("navit.xml.local"))
- config_file="navit.xml.local";
- else
- config_file="navit.xml";
+ g_free(config_file);
+ config_file=NULL;
+ }
+ }
+ if (! config_file) {
+ if (file_exists("navit.xml.local"))
+ config_file="navit.xml.local";
+ }
+ if (! config_file) {
+ if (file_exists("navit.xml"))
+ config_file="navit.xml";
+ }
+ if (! config_file) {
+ config_file=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/navit.xml.local" , NULL);
+ if (!file_exists(config_file)) {
+ g_free(config_file);
+ config_file=NULL;
+ }
+ }
+ if (! config_file) {
+ config_file=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/navit.xml" , NULL);
+ if (!file_exists(config_file)) {
+ g_free(config_file);
+ config_file=NULL;
}
}
+ if (! config_file)
+ g_error(_("No config file navit.xml or navit.xml.local found\n"));
if (!config_load(config_file, &error)) {
g_error(_("Error parsing '%s': %s\n"), config_file, error->message);
} else {
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE navit SYSTEM "navit.dtd">
<plugins>
- <plugin path="*/*/.libs/lib*.so" />
- <plugin path="graphics/null/.libs/libgraphics_null.so" active="no" />
+ <plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}lib*.so" />
+ <plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}libgraphics_null.so" active="no" />
</plugins>
<debug name="navit:do_draw" level="0" />
-<navit center="5031.51 N 735.83 E" zoom="8192" >
+<navit center="4808 N 1134 E" zoom="256" >
<gui type="gtk" />
<graphics type="gtk_drawing_area" />
<!-- For SDL, use rather the following lines
</navigation>
<speech type="cmdline" data="echo 'Fix the speech tag in navit.xml to let navit say:' '%s'" />
- <mapset>
+<!-- If you have the reiseplaner maps installed, set enabled="yes" in the next line -->
+ <mapset enabled="no">
<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map" />
<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp1.smp" />
<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp2.smp" />
<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp4.smp" />
<map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp5.smp" />
</mapset>
+<!-- If you dont want to use the sample map, set enabled="no" in the next line -->
+ <mapset enabled="yes">
+ <map type="textfile" enabled="yes" data="$NAVIT_SHAREDIR/maps/osm_bbox_11.3,47.9,11.7,48.2.txt" charset="utf-8"/>
+ </mapset>
<layout name="Tag">
<layer name="sea" details="0">
<item type="wood" order="0-">
$deg*=60;
return sprintf("%d%09.6f %s", $degi, $deg, $dir);
}
+
sub coord
{
my ($id)=(@_);
return deg($lat{$id}, "N") . " " . deg($lon{$id}, "E");
}
+$types={
+ 'amenity'=>{
+ },
+ 'building'=>{
+ },
+ 'highway'=>{
+ 'cycleway' => 'street_nopass',
+ 'footway' => 'street_nopass',
+ 'steps' => 'street_nopass',
+ 'cyclepath' => 'street_nopass',
+ 'track' => 'street_nopass',
+ 'service' => 'street_nopass',
+ 'pedestrian' => 'street_nopass',
+ 'residential' => 'street_1_city',
+ 'unclassified' => 'street_1_city',
+ 'tertiary' => 'street_2_city',
+ 'secondary' => 'street_3_city',
+ 'primary' => 'street_4_city',
+ 'trunk' => 'street_4_city',
+ 'trunk_link' => 'ramp',
+ 'motorway' => 'highway_city',
+ 'motorway_link' => 'ramp',
+ },
+ 'landuse'=>{
+ 'allotments' => 'wood',
+ 'cemetery' => 'cemetery_poly',
+ },
+ 'leisure'=>{
+ 'park' => 'park_poly',
+ },
+ 'natural'=>{
+ 'wood' => 'wood',
+ 'water' => 'water_poly',
+ },
+ 'place'=>{
+ 'suburb' => 'town_poly',
+ },
+ 'railway'=>{
+ 'rail' => 'rail',
+ 'subway' => 'rail',
+ 'tram' => 'rail',
+ },
+ 'waterway'=>{
+ 'canal' => 'water_line',
+ 'river' => 'water_line',
+ 'weir' => 'water_line',
+ 'stream' => 'water_line',
+ 'drain' => 'water_line',
+ },
+};
+
while (<>) {
$line = $_;
chomp($line);
- #print "$line\n";
- if ($line =~ /<node id="(.*?)" lat="(.*?)" lon="(.*?)"/) {
- $lat{ $1 } = $2;
- $lon{ $1 } = $3;
+ if ($line =~ /<(\/[^? ]+)>/) {
+ $tag=$1;
+ } elsif ($line =~ /<([^? ]+)(.*)/) {
+ $tag=$1;
+ $line = $2;
+ %attr=();
+ while ($line =~ / ([^'"=]+)=['"]([^'"]*)['"](.*)/) {
+ $attr{$1}=$2;
+ $line=$3;
+ }
+ } else {
+ if ($line =~ /<\?xml/) {
+ next;
+ }
+ print STDERR "Unknown $line\n";
+ next;
+ }
+ #print "tag=$tag\n";
+ if ($tag eq 'node') {
+ $lat{$attr{'id'}} = $attr{'lat'};
+ $lon{$attr{'id'}} = $attr{'lon'};
+ $creference{$attr{'id'}} = 0;
%tag=();
- } elsif ($line =~ /<segment id="(.*?)" from="(.*?)" to="(.*?)"/) {
- $from{ $1 } = $2;
- $to{ $1 } = $3;
- $reference{ $1 } =0;
+ } elsif ($tag eq '/node') {
+ } elsif ($tag eq 'segment') {
+ $from{$attr{'id'}} = $attr{'from'};
+ $to{$attr{'id'}} = $attr{'to'};
+ $creference{$attr{'from'}}++;
+ $creference{$attr{'to'}}++;
+ $reference{$attr{'id'}} = 0;
%tag=();
- } elsif ($line =~ /<tag k="(.*?)" v="(.*?)"/) {
- if ($1 ne "created_by" && $1 ne "converted_by") {
- $tag{ $1 } = $2;
+ } elsif ($tag eq 'tag') {
+ if ($attr{'k'} ne 'created_by' && $attr{'k'} ne 'converted_by') {
+ $tag{$attr{'k'}}=$attr{'v'};
}
- } elsif ($line =~ /<way id="(.*?)"/) {
+ } elsif ($tag eq 'way') {
%tag=();
$coords="";
$in_way=1;
- $way_id=$1;
+ $way_id=$attr{'id'};
$start='';
$end='';
- } elsif ($line =~ /<seg id="(.*?)"/) {
+ } elsif ($tag eq 'seg') {
if ($in_way) {
- $from=coord($from{ $1 });
- $to=coord($to{ $1 });
- $reference{ $1 }++;
+ $from=coord($from{$attr{'id'}});
+ $to=coord($to{$attr{'id'}});
+ $reference{$attr{'id'}}++;
if ($start eq '') {
$start=$from;
$end=$to;
$coords="$start\n$end\n";
- $start="dummy";
- $end="dummy";
+ #$start="dummy";
+ #$end="dummy";
} else {
- if ($start == $from) {
+ if ($creference{$from{$attr{'id'}}} > 2 || $creference{$from{$attr{'id'}}} > 2) {
+ $start="dummy";
+ $end="dummy";
+ }
+ if ($start eq $from) {
$coords="$to\n" . $coords;
$start=$to;
- } elsif ($start == $to) {
+ } elsif ($start eq $to) {
$coords="$from\n" . $coords;
$start=$from;
- } elsif ($end == $from) {
+ } elsif ($end eq $from) {
$coords.=$to . "\n";
$end=$to;
- } elsif ($end == $to) {
+ } elsif ($end eq $to) {
$coords.=$from . "\n";
$end=$from;
} else {
push(@coords,$coords);
+ #print STDERR "not connected from=$from to=$to start=$start end=$end\n";
$start=$from;
$end=$to;
$coords="$start\n$end\n";
- $start="dummy";
- $end="dummy";
- # print STDERR "not connected from=$from to=$to coords=$coords \n";
+ #$start="dummy";
+ #$end="dummy";
+ #exit(0);
}
}
}
- } elsif ($line =~ /<osm /) {
- } elsif ($line =~ /<?xml /) {
- } elsif ($line =~ /<\/node/) {
+ } elsif ($tag eq '/node') {
if (%tag) {
#print STDERR Dumper(\%tag);
}
- } elsif ($line =~ /<\/segment/) {
+ } elsif ($tag eq '/segment') {
if (%tag) {
#print STDERR Dumper(\%tag);
}
- } elsif ($line =~ /<\/segment/) {
- } elsif ($line =~ /<\/way/) {
- $type='street_unkn';
- if ($tag{'highway'} ne '') {
- for ($tag{'highway'}) {
- if (/cycleway/ || /footway/ || /steps/ || /cyclepath/ || /track/ || /service/ || /pedestrian/) {
- $type='street_nopass';
- } elsif (/residential/ || /unclassified/) {
- $type='street_1_city';
- } elsif (/tertiary/) {
- $type='street_2_city';
- } elsif (/secondary/) {
- $type='street_3_city';
- } elsif (/primary/) {
- $type='street_4_city';
- } elsif (/motorway/) {
- $type='highway_city';
- } else {
- print STDERR "Unknown highway $_\n";
- }
-
- }
- }
- if ($tag{'natural'} ne '') {
- for ($tag{'natural'}) {
- if (/water/) {
- $type='water_poly';
- } else {
- print STDERR "Unknown natural $_\n";
- }
-
- }
- }
- if ($tag{'railway'} ne '') {
- for ($tag{'railway'}) {
- if (/rail/) {
- $type='rail';
- } else {
- print STDERR "Unknown railway $_\n";
+ } elsif ($tag eq '/way') {
+ $type='';
+ while (($key, $value) = each %$types) {
+ if ($tag{$key} ne '') {
+ $tagval=$tag{$key};
+ $newtype=$types->{$key}->{$tagval};
+ if ($newtype eq '') {
+ $types->{$key}->{$tagval}='street_unkn';
+ print STDERR "Unknown $key $tagval\n";
+ $newtype='street_unkn';
}
-
- }
- }
- if ($tag{'waterway'} ne '') {
- for ($tag{'waterway'}) {
- if (/canal/) {
- $type='water_line';
- } else {
- print STDERR "Unknown waterway $_\n";
+ if ($type ne '') {
+ print STDERR "conflict way $way_id\n";
+ #print STDERR Dumper(\%tag);
}
-
+ $type=$newtype;
}
}
- if ($tag{'amenity'} ne '') {
- for ($tag{'amenity'}) {
- if (/hospital/) {
- $type='hospital_poly';
- } elsif (/parking/) {
- $type='parking_lot_poly';
- } else {
- print STDERR "Unknown amenity $_\n";
- }
-
- }
- }
- if ($tag{'landuse'} ne '') {
- for ($tag{'landuse'}) {
- if (/cemetery/) {
- $type='cemetery_poly';
- } elsif (/forest/||/village_green/||/greenfield/||/farm/) {
- $type='wood';
- } elsif (/industrial/ || /residential/) {
- $type='industry_poly';
- } elsif (/parking/) {
- $type='parking_lot_poly';
- } elsif (/water/) {
- $type='water_poly';
- } else {
- print STDERR "Unknown landuse $_\n";
- }
-
- }
+ if ($type eq '') {
+ print STDERR "Unknown way type:\n";
+ print STDERR Dumper(\%tag);
+ $type='street_unkn';
}
$oline="type=$type";
if ($tag{'name'} ne '') {
$oline .= "$key='$value' ";
}
$oline .= "\"\n";
- push(@coords,$coords);
+ if ($coords ne "") {
+ push(@coords,$coords);
+ }
foreach $coords (@coords) {
print $oline;
print $coords;
}
@coords=();
- } elsif ($line =~ /<\/osm/) {
- } else {
- print "$line\n";
- }
- if ($count++ > 5) {
- #exit(0);
- }
-}
-while (($key,$value)=each(%reference)) {
- if ($value != 1) {
- print STDERR "$key $value\n";
+ } elsif ($tag ne 'osm' && $tag ne '/osm' && $tag ne 'bound') {
+ print STDERR "Unknown $tag\n";
}
}
+#print STDERR Dumper($types);
+
+#while (($key,$value)=each(%reference)) {
+# if ($value != 1) {
+# print STDERR "$key $value\n";
+# }
+#}
include $(top_srcdir)/Makefile.inc
-xpm_DATA = camping.xpm car_dealer.xpm flag_bk_tr.xpm flag_bk_wh.xpm flag_bl_wh.xpm fuel.xpm hospital.xpm hotel.xpm parking.xpm restaurant.xpm unknown.xpm burgerking.ico
+xpm_DATA = camping.xpm car_dealer.xpm flag_bk_tr.xpm flag_bk_wh.xpm flag_bl_wh.xpm fuel.xpm hospital.xpm hotel.xpm parking.xpm restaurant.xpm unknown.xpm
EXTRA_DIST = $(xpm_DATA)
-burgerking.ico:
- wget http://www.burgerking.de/favicon.ico -O burgerking.ico
+#burgerking.ico:
+# wget http://www.burgerking.de/favicon.ico -O burgerking.ico