This is an automated email from the git hooks/post-receive script. sebastic-guest pushed a commit to branch master in repository mkgmap.
commit 82a85d8acaf3fea27d4fc28c20b55561a31faa53 Author: Bas Couwenberg <sebas...@xs4all.nl> Date: Fri Dec 19 12:06:35 2014 +0100 Imported Upstream version 0.0.0+svn3383 --- doc/mkgmap.1 | 4 +- doc/tutorial/Makefile | 12 +- doc/tutorial/custom.txt | 12 ++ doc/tutorial/first_map.txt | 34 +++++ doc/tutorial/{tutorial.txt => main.txt} | 16 +-- doc/tutorial/publish.txt | 39 ++++++ doc/tutorial/second_map.txt | 40 ++++++ doc/tutorial/splitter.txt | 23 ++++ doc/tutorial/starting.txt | 21 ++- resources/mkgmap-version.properties | 4 +- .../me/parabola/imgfmt/app/net/NETFileReader.java | 2 +- src/uk/me/parabola/imgfmt/app/net/NETHeader.java | 4 + .../mkgmap/osmstyle/actions/PartFilter.java | 6 +- .../mkgmap/osmstyle/actions/SubstringFilter.java | 16 ++- .../mkgmap/osmstyle/actions/PartFilterTest.java | 148 +++++++++++++++++++++ .../osmstyle/actions/SubstringFilterTest.java | 69 ++++++++++ 16 files changed, 419 insertions(+), 31 deletions(-) diff --git a/doc/mkgmap.1 b/doc/mkgmap.1 index afcdcb3..0ea0650 100644 --- a/doc/mkgmap.1 +++ b/doc/mkgmap.1 @@ -13,12 +13,12 @@ command. \fBmkgmap\fP is a program that converts OpenStreetMap (OSM) data into a map that can be loaded onto a Garmin GPS device. The mapping between OSM features and the features in the map can be -completly customized by writing what we term a "style". +completely customized by writing what we term a "style". .SH OPTIONS .TP .B \-\-help <filename> Use this option to get alist of the built in help topics. -In particular calling --help=options will list all the available +In particular calling \-\-help=options will list all the available options and is always up to date. .SH ACKNOWLEDGEMENTS This project is almost entirely based on the file format specification diff --git a/doc/tutorial/Makefile b/doc/tutorial/Makefile index 0d1fe5a..ad7d55b 100644 --- a/doc/tutorial/Makefile +++ b/doc/tutorial/Makefile @@ -1,8 +1,13 @@ include ../resources/make.param -SOURCE_DEPS= tutorial.txt starting.txt first_map.txt $(XSL) -TUTORIAL_MAIN=tutorial.txt +TUTORIAL_MAIN=main.txt +SOURCE_DEPS= \ + $(TUTORIAL_MAIN) \ + starting.txt \ + first_map.txt second_map.txt publish.txt \ + splitter.txt custom.txt \ + $(XSL) build: html @@ -13,10 +18,11 @@ pdf: tutorial.pdf epub: tutorial.epub tutorial.html: $(SOURCE_DEPS) - $(ASCIIDOC) $(HTML_ATTRS) -a icons -a iconsdir=$(ICONSDIR) -b html5 $(TUTORIAL_MAIN) + $(ASCIIDOC) $(HTML_ATTRS) -o tutorial.html -a icons -a iconsdir=$(ICONSDIR) -b html5 $(TUTORIAL_MAIN) tutorial.pdf: $(SOURCE_DEPS) $(A2X) --xsl-file=$(XSL) --fop -a doctype=article $(PDF_OPTS) $(TUTORIAL_MAIN) + mv main.pdf tutorial.pdf tutorial.epub: $(SOURCE_DEPS) mkdir -p build diff --git a/doc/tutorial/custom.txt b/doc/tutorial/custom.txt new file mode 100644 index 0000000..f156842 --- /dev/null +++ b/doc/tutorial/custom.txt @@ -0,0 +1,12 @@ + +Customising the map +=================== + +This section covers how to change the kind of things that the +map contains and how it looks. +There are two parts to this. +First it is possible to include or leave out any of the available +data items that are contained in {osm}. +Second the colours and appearence of the final map can be changed. +These are separate operations, so that the same map can have +the colours and icons changed, simply by using a different file. diff --git a/doc/tutorial/first_map.txt b/doc/tutorial/first_map.txt index 6243714..057dc2f 100644 --- a/doc/tutorial/first_map.txt +++ b/doc/tutorial/first_map.txt @@ -1,5 +1,39 @@ Create your first map ===================== + +First you need to obtain an extract of map data. You can do this by +going to the http://www.openstreetmap.org[OSM] website, locating an area +that you are familiar with and clicking on the +Export+ button at the +top. +It will not let you download a very large area, so zoom in and +out until you find an acceptable area that is large enough to include +a number of streets and interesting points. The tutorial +will cover making maps of complete countries later on, this is +just to get started. +You will end up with a file called +map.osm+ which you should +place in the same directory as mkgmap.jar. + +Alternatively you can use josm to download a familiar area of the map. +Save it to a file called +map.osm+ in the same folder as mkgmap.jar. + +.Creating the map +---- +java -jar mkgmap.jar map.osm +---- + +You should now see a few new files have been created. +The important one for now is the one called 63240001.img. + +== Loading the map onto a GPS device + +TBW + +== Viewing the map with QLandkarteGT + +TBW + +== Displaying the map in BaseCamp + TBW diff --git a/doc/tutorial/tutorial.txt b/doc/tutorial/main.txt similarity index 71% rename from doc/tutorial/tutorial.txt rename to doc/tutorial/main.txt index 7a9669b..2094eb6 100644 --- a/doc/tutorial/tutorial.txt +++ b/doc/tutorial/main.txt @@ -14,10 +14,12 @@ The mkgmap team :frame: topbot :grid: rows +:osm: Open Street Map + // Used for conditional compiles for a unix/windows version. :windows: 1 :linux: 1 -:max: 1 +:mac: 1 Introduction @@ -34,14 +36,10 @@ include::starting.txt[] include::first_map.txt[] -// Some ideas for the sections, order to be decided -// I'm assuming that this will not be published before the great -// option defaulting process is complete. - -// installing to device, mapsource, basecamp, qlandkartegt etc +include::second_map.txt[] -// adding sea areas +include::splitter.txt[] -// using a bounds file to improve addresses +include::publish.txt[] -// splitting large area +include::custom.txt[] diff --git a/doc/tutorial/publish.txt b/doc/tutorial/publish.txt new file mode 100644 index 0000000..1e5d84b --- /dev/null +++ b/doc/tutorial/publish.txt @@ -0,0 +1,39 @@ + +Preparing to distribute your map +================================ + +You may want to share you map with others. +This section shows how you prepare it so that it is +well named and doesn't clash with other maps. + +--family-id:: + This is an integer that identifies a family of products. +Range: [1..9999] +Mkgmap default: 6324 + +--family-name:: +If you build several maps, this option describes the family name of all +of your maps. Garmin will display this in the map selection screen. +Example: --family-name="OpenStreetmap mkgmap XL 2019" + +--product-id:: +This is an integer that identifies a product within a family. It is +often just 1, which is the default. + +--product-version:: +The version of the product. Default value is 1. + +--series-name:: +This name will be displayed in MapSource in the map selection drop-down. +The default is "OSM map". + +--area-name:: +Area name is displayed on Garmin units (or at least on eTrex) as the +second part of the mapname in the list of the individual maps. + +--copyright-message=note:: +Specify a copyright message for files that do not contain one. + +--license-file=file:: +The contents of the file will be used as licence information to +be added to the map. diff --git a/doc/tutorial/second_map.txt b/doc/tutorial/second_map.txt new file mode 100644 index 0000000..56e068a --- /dev/null +++ b/doc/tutorial/second_map.txt @@ -0,0 +1,40 @@ + +Improving the map +================= + +Once you have created a simple map, then next step is to add +some options to improve or customise the map. + +Option --route:: +This option adds information to the map to enable automatically +finding routes between two points. +Option --drive-on-left::: +Option --drive-on-right::: +It is a good idea to set the correct option to indicate which +side of the road traffic travels on. If you don't, then mkgmap +will guess based on the direction of roundabouts which will +often be correct, but its best to make sure. + +Option --code-page=1252:: +This sets the characters that can be used ++ +|===== +| 1250 | Central and East European Latin +| 1251 | Cyrillic +| 1252 | West European Latin +| 1253 | Greek +| 1254 | Turkish +| 1255 | Hebrew +| 1256 | Arabic +| 1257 | Baltic +| 1258 | Vietnamese +| 65001 | Unicode +|======= ++ +There is some support for the following code page values ++ +|======= +| 932 | Japanese | Displays fine, address search may fail. +|====== + + diff --git a/doc/tutorial/splitter.txt b/doc/tutorial/splitter.txt new file mode 100644 index 0000000..ae096c2 --- /dev/null +++ b/doc/tutorial/splitter.txt @@ -0,0 +1,23 @@ + +Making a larger map +=================== + +So far we have just used a small sample of map data for a local area. +If you want to create a map for a whole country or continent, then +the data has to be split up into tiles first. +There is no hard and fast rule about how large the tile is, because +it depends on the numbers of map features within the tile rather than +the area that the tile covers. +So a large well mapped city may require several tiles, whereas a +poorly mapped small country may only need one or two. + +Each tile is compiled and then the whole lot is combined into +a single map. + +== Adding sea areas + +TBW + +== Adding better address information + +TBW diff --git a/doc/tutorial/starting.txt b/doc/tutorial/starting.txt index c1e7c79..bdbd3c1 100644 --- a/doc/tutorial/starting.txt +++ b/doc/tutorial/starting.txt @@ -3,21 +3,32 @@ Getting started =============== == Install java -To use mkgmap you need a program called Java. +To use mkgmap you need to install Java. Download it from http://www.java.com[java.com] +and install it. ifdef::linux[] === Linux packages If you are running Linux, then you may prefer to install java from you systems package manager, instead of from the Java site. -The package is named *java-1.7.0-openjdk* on Fedora and similar -distributions; on Ubuntu, Debian and similar it is is named -*openjdk-7-jre* +The package has a name like *java-1.7.0-openjdk* on Fedora and similar +distributions; on Ubuntu, Debian and similar it has a name +like *openjdk-7-jre* endif::linux[] -== Download +== Download mkgmap Download +mkgmap+ from the http://www.mkgmap.org.uk/download/mkgmap.html[mkgmap download site]. +Unzip the file into a folder or directory, the rest of the tutorial +will assume that you are working within that directory. + +The main file is called +mkgmap.jar+ which is the main part of the +program itself and the +lib+ folder that contains other parts +of the program. It is important that the +mkgmap.jar+ and the +lib+ +folder stay together: if you move one you must move the other. + +There will also be +doc+ folder containing the available documentation, +and an examples folder which can be ignored. diff --git a/resources/mkgmap-version.properties b/resources/mkgmap-version.properties index 9f108d2..798b028 100644 --- a/resources/mkgmap-version.properties +++ b/resources/mkgmap-version.properties @@ -1,2 +1,2 @@ -svn.version: 3366 -build.timestamp: 2014-12-08T07:00:53+0000 +svn.version: 3383 +build.timestamp: 2014-12-18T07:11:34+0000 diff --git a/src/uk/me/parabola/imgfmt/app/net/NETFileReader.java b/src/uk/me/parabola/imgfmt/app/net/NETFileReader.java index bd93449..0d09b1e 100644 --- a/src/uk/me/parabola/imgfmt/app/net/NETFileReader.java +++ b/src/uk/me/parabola/imgfmt/app/net/NETFileReader.java @@ -229,7 +229,7 @@ public class NETFileReader extends ImgFile { // entry we only need one of the offsets so pick the first one. int idx = (net1 >> 22) & 0x3; if (idx == 0) - offsets.add(net1 & 0x3fffff); + offsets.add((net1 & 0x3fffff) << netHeader.getRoadShift()); } // Sort in address order in the hope of speeding up reading. diff --git a/src/uk/me/parabola/imgfmt/app/net/NETHeader.java b/src/uk/me/parabola/imgfmt/app/net/NETHeader.java index 351acd0..66f3bf6 100644 --- a/src/uk/me/parabola/imgfmt/app/net/NETHeader.java +++ b/src/uk/me/parabola/imgfmt/app/net/NETHeader.java @@ -108,4 +108,8 @@ public class NETHeader extends CommonHeader { public int getSortedRoadsEnd() { return sortedRoads.getEndPos(); } + + public int getRoadShift() { + return roadShift & 0xff; + } } diff --git a/src/uk/me/parabola/mkgmap/osmstyle/actions/PartFilter.java b/src/uk/me/parabola/mkgmap/osmstyle/actions/PartFilter.java index c1a447e..91259ff 100644 --- a/src/uk/me/parabola/mkgmap/osmstyle/actions/PartFilter.java +++ b/src/uk/me/parabola/mkgmap/osmstyle/actions/PartFilter.java @@ -13,8 +13,8 @@ package uk.me.parabola.mkgmap.osmstyle.actions; import java.util.regex.Pattern; -import uk.me.parabola.imgfmt.ExitException; import uk.me.parabola.mkgmap.reader.osm.Element; +import uk.me.parabola.mkgmap.scan.SyntaxException; /** * Split a value in parts and returns one or more part(s) of a value. @@ -78,8 +78,10 @@ public class PartFilter extends ValueFilter { separator = ";"; } } catch (NumberFormatException e) { - throw new ExitException("Not valid numbers in style part command: " + arg); + throw new SyntaxException("Not valid numbers in style part command: " + arg); } + if (partnumber == 0) + throw new SyntaxException("Not valid numbers in style part command: " + arg); } public String doFilter(String value, Element el) { diff --git a/src/uk/me/parabola/mkgmap/osmstyle/actions/SubstringFilter.java b/src/uk/me/parabola/mkgmap/osmstyle/actions/SubstringFilter.java index fd88bbc..4a8218f 100644 --- a/src/uk/me/parabola/mkgmap/osmstyle/actions/SubstringFilter.java +++ b/src/uk/me/parabola/mkgmap/osmstyle/actions/SubstringFilter.java @@ -16,8 +16,8 @@ */ package uk.me.parabola.mkgmap.osmstyle.actions; -import uk.me.parabola.imgfmt.ExitException; import uk.me.parabola.mkgmap.reader.osm.Element; +import uk.me.parabola.mkgmap.scan.SyntaxException; /** * Extract a substring from a value @@ -45,19 +45,21 @@ public class SubstringFilter extends ValueFilter { end = Integer.parseInt(temp[1]); args = 2; } else { - start = 0; - end = 0; - args = 0; + throw new SyntaxException(String.format("invalid argunemt for style substring command: '%s'", arg)); } } catch (NumberFormatException e) { - throw new ExitException(String.format("Numbers not valid in style substring command: '%s'", arg)); + throw new SyntaxException(String.format("Numbers not valid in style substring command: '%s'", arg)); + } + if (args == 2 && start > end){ + throw new SyntaxException(String.format("start > end in style substring command: '%s'", arg)); } } protected String doFilter(String value, Element el) { if (value == null) return null; - - if (args == 1) { + if (start > value.length()) + return null; + if (args == 1 || end > value.length()) { return value.substring(start); } if (args == 2) { diff --git a/test/uk/me/parabola/mkgmap/osmstyle/actions/PartFilterTest.java b/test/uk/me/parabola/mkgmap/osmstyle/actions/PartFilterTest.java new file mode 100644 index 0000000..35a8709 --- /dev/null +++ b/test/uk/me/parabola/mkgmap/osmstyle/actions/PartFilterTest.java @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2014. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 or + * 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. + */ + +package uk.me.parabola.mkgmap.osmstyle.actions; + +import uk.me.parabola.mkgmap.scan.SyntaxException; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class PartFilterTest { + + /** + * * Examples from docu: if the value is "Aa#Bb#Cc#Dd#Ee" + * part:#:1 returns Aa + * part:#:-1 returns Ee + * part:#:2 returns Bb + * part:#:-2 returns Dd + * part:#>1 returns Bb#Cc#Dd#Ee# + * part:#<5 returns Aa#Bb#Cc#Dd# + * part:#<-1 returns Aa#Bb#Cc#Dd# + + */ + @Test + public void testNoArg() { + PartFilter filter = new PartFilter(""); + String s = filter.doFilter("x;y;z", null); + assertEquals("x", s); + } + @Test + public void testOneArg() { + PartFilter filter = new PartFilter(";"); + String s = filter.doFilter("x;y;z", null); + assertEquals("x", s); + } + @Test + public void test2ndArg() { + PartFilter filter = new PartFilter(":3"); + String s = filter.doFilter("Aa;Bb;Cc;Dd;Ee", null); + assertEquals("Cc", s); + } + @Test + public void testFirstPart() { + PartFilter filter = new PartFilter("#:1"); + String s = filter.doFilter("Aa#Bb#Cc#Dd#Ee", null); + assertEquals("Aa", s); + } + @Test + public void testLastPart() { + PartFilter filter = new PartFilter("#:-1"); + String s = filter.doFilter("Aa#Bb#Cc#Dd#Ee", null); + assertEquals("Ee", s); + } + + @Test + public void test2ndPart() { + PartFilter filter = new PartFilter("#:2"); + String s = filter.doFilter("Aa#Bb#Cc#Dd#Ee", null); + assertEquals("Bb", s); + } + + @Test + public void test2ndLastPart() { + PartFilter filter = new PartFilter("#:-2"); + String s = filter.doFilter("Aa#Bb#Cc#Dd#Ee", null); + assertEquals("Dd", s); + } + @Test + public void testRestAfter1() { + PartFilter filter = new PartFilter("#>1"); + String s = filter.doFilter("Aa#Bb#Cc#Dd#Ee", null); + assertEquals("Bb#Cc#Dd#Ee#", s); + } + @Test + public void testBeforeLast() { + PartFilter filter = new PartFilter("#<-1"); + String s = filter.doFilter("Aa#Bb#Cc#Dd#Ee", null); + assertEquals("Aa#Bb#Cc#Dd#", s); + } + @Test + public void testBeforeFifth() { + PartFilter filter = new PartFilter("#<5"); + String s = filter.doFilter("Aa#Bb#Cc#Dd#Ee", null); + assertEquals("Aa#Bb#Cc#Dd#", s); + } + @Test + public void testStringContainsNoSeparatorPart1() { + PartFilter filter = new PartFilter("#:1"); + String s = filter.doFilter("xyz", null); + assertEquals("xyz", s); + } + @Test + public void testStringContainsNoSeparatorLastPart() { + PartFilter filter = new PartFilter("#:-1"); + String s = filter.doFilter("xyz", null); + assertEquals("xyz", s); + } + @Test + public void testStringContainsNoSeparator2ndPart() { + PartFilter filter = new PartFilter("#:2"); + String s = filter.doFilter("xyz", null); + assertEquals(null, s); + } + @Test + public void testStringContainsNoSeparator2ndLastPart() { + PartFilter filter = new PartFilter("#:2"); + String s = filter.doFilter("xyz", null); + assertEquals(null, s); + } + + + @Test(expected=SyntaxException.class) + public void testBadArgNotNum() { + PartFilter filter = new PartFilter("#<-x"); + filter.doFilter("abc", null); + } + @Test(expected=SyntaxException.class) + public void testBadArgBefore0() { + PartFilter filter = new PartFilter("#<-0"); + filter.doFilter("abc", null); + } + @Test(expected=SyntaxException.class) + public void testBadArgAfter0() { + PartFilter filter = new PartFilter("#>-0"); + filter.doFilter("abc", null); + } + @Test + public void testLong1stArg() { + PartFilter filter = new PartFilter("--->1"); + String s = filter.doFilter("abc---def---ghi", null); + assertEquals("def---ghi---", s); + } +// @Test (expected=SyntaxException.class) +// public void test1stIsColonArg() { +// PartFilter filter = new PartFilter("::2"); +// filter.doFilter("abc", null); } +} diff --git a/test/uk/me/parabola/mkgmap/osmstyle/actions/SubstringFilterTest.java b/test/uk/me/parabola/mkgmap/osmstyle/actions/SubstringFilterTest.java new file mode 100644 index 0000000..3a5bb92 --- /dev/null +++ b/test/uk/me/parabola/mkgmap/osmstyle/actions/SubstringFilterTest.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2014. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 or + * 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. + */ + +package uk.me.parabola.mkgmap.osmstyle.actions; + +import uk.me.parabola.mkgmap.scan.SyntaxException; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class SubstringFilterTest { + + @Test + public void testOneArg() { + SubstringFilter filter = new SubstringFilter("2"); + String s = filter.doFilter("abcd", null); + assertEquals("cd", s); + } + + @Test + public void testTwoArgs() { + SubstringFilter filter = new SubstringFilter("2:4"); + String s = filter.doFilter("abcdefg", null); + assertEquals("cd", s); + } + + @Test(expected=SyntaxException.class) + public void testBadArgs() { + SubstringFilter filter = new SubstringFilter("6:4"); + filter.doFilter("abc", null); + } + + @Test(expected = SyntaxException.class) + public void testEmptyArgs() { + SubstringFilter filter = new SubstringFilter(""); + String s = filter.doFilter("abcde", null); + assertEquals("abcde", s); + } + + @Test(expected = SyntaxException.class) + public void testTooManyArgs() { + SubstringFilter filter = new SubstringFilter("1:2:3"); + filter.doFilter("abc", null); + } + + @Test + public void testRangeLargerThanInput() { + SubstringFilter filter = new SubstringFilter("2:30"); + String s = filter.doFilter("abcdef", null); + assertEquals("cdef", s); + } + @Test + public void testStartLargerThanInput() { + SubstringFilter filter = new SubstringFilter("10"); + String s = filter.doFilter("abcdef", null); + assertEquals(null, s); + } +} -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mkgmap.git _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel