Hi,
ok, here is my last and final patch for the copyright/license
informations in MapSource/Basecamp/Garmin Device.
Works now for me in all cases I can test.
Thorsten
--
Thorsten Kukuk, Project Manager/Release Manager SLES
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Index: src/uk/me/parabola/mkgmap/build/MapBuilder.java
===================================================================
--- src/uk/me/parabola/mkgmap/build/MapBuilder.java (Revision 2109)
+++ src/uk/me/parabola/mkgmap/build/MapBuilder.java (Arbeitskopie)
@@ -21,6 +21,11 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
import uk.me.parabola.imgfmt.app.Coord;
import uk.me.parabola.imgfmt.app.Exit;
@@ -51,6 +56,7 @@
import uk.me.parabola.imgfmt.app.trergn.Subdivision;
import uk.me.parabola.imgfmt.app.trergn.TREFile;
import uk.me.parabola.imgfmt.app.trergn.Zoom;
+import uk.me.parabola.imgfmt.ExitException;
import uk.me.parabola.log.Logger;
import uk.me.parabola.mkgmap.Version;
import uk.me.parabola.mkgmap.filters.BaseFilter;
@@ -125,6 +131,8 @@
private LBLFile lblFile;
+ private String licenseFileName;
+
public MapBuilder() {
regionName = null;
locator = new Locator();
@@ -149,6 +157,8 @@
poiAddresses = false;
routeCenterBoundaryType = props.getProperty("route-center-boundary", 0);
+
+ licenseFileName = props.getProperty("license-file", null);
locator = new Locator(props);
}
@@ -695,19 +705,42 @@
//
// We use it to add copyright information that there is no room for
// elsewhere.
- map.addInfo("OpenStreetMap and contributors");
- map.addInfo("www.openstreetmap.org");
- map.addInfo("Map data licenced under Creative Commons Attribution ShareAlike 2.0");
- map.addInfo("http://creativecommons.org/licenses/by-sa/2.0/");
+ if (licenseFileName != null) {
+ File file = new File(licenseFileName);
+ StringBuffer contents = new StringBuffer();
+ BufferedReader reader = null;
- // Pad the version number with spaces so that version
- // strings that are different lengths do not change the size and
- // offsets of the following sections.
- map.addInfo("Map created with mkgmap-r"
+ try {
+ reader = new BufferedReader(new FileReader(file));
+ String text = null;
+
+ // repeat until all lines is read
+ while ((text = reader.readLine()) != null) {
+ if (text.length() > 0) {
+ map.addInfo(text);
+ }
+ }
+
+ reader.close();
+ } catch (FileNotFoundException e) {
+ throw new ExitException("Could not open license file " + licenseFileName);
+ } catch (IOException e) {
+ throw new ExitException("Error reading license file " + licenseFileName);
+ }
+ } else {
+ map.addInfo("OpenStreetMap and contributors");
+ map.addInfo("www.openstreetmap.org");
+ map.addInfo("Map data licenced under Creative Commons Attribution ShareAlike 2.0");
+ map.addInfo("http://creativecommons.org/licenses/by-sa/2.0/");
+
+ // Pad the version number with spaces so that version
+ // strings that are different lengths do not change the size and
+ // offsets of the following sections.
+ map.addInfo("Map created with mkgmap-r"
+ String.format("%-10s", Version.VERSION));
- map.addInfo("Program released under the GPL");
-
+ map.addInfo("Program released under the GPL");
+ }
// There has to be (at least) two copyright messages or else the map
// does not show up. The second one will be displayed at startup,
// although the conditions where that happens are not known.
Index: src/uk/me/parabola/mkgmap/reader/osm/OsmMapDataSource.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/OsmMapDataSource.java (Revision 2109)
+++ src/uk/me/parabola/mkgmap/reader/osm/OsmMapDataSource.java (Arbeitskopie)
@@ -112,10 +112,9 @@
* @return A list of copyright messages as a String array.
*/
public String[] copyrightMessages() {
- return new String[] {
- "OpenStreetMap.org contributors",
- "See: http://wiki.openstreetmap.org/index.php/Attribution"
- };
+ String note = getConfig().getProperty("copyright-message",
+ "OpenStreetMap.org contributors. See: http://wiki.openstreetmap.org/index.php/Attribution");
+ return new String[] { note };
}
protected void setStyle(Style style) {
Index: resources/help/en/options
===================================================================
--- resources/help/en/options (Revision 2109)
+++ resources/help/en/options (Arbeitskopie)
@@ -230,6 +230,14 @@
number used in the overview map and tdb file. The default
number is 63240000.
+--copyright-message=note
+ Specify a copyright message for files that do not contain one.
+
+--license-file=file
+ Specify a file which content will be added as license. Every
+ line is one entry. All entrys of all maps will be merged, unified
+ and shown in random order.
+
Optimization options:
--reduce-point-density=NUM
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev