Hi

So the change that breaks it places two numbers that are associated
with the SRT and/or index file.

On thinking about it for a bit it is easy enough to add the SRT file into the gmapsupp and maybe that is all that is needed.

Attached is a patch against trunk to add it to the gmapsupp.img file and
a pre-built mkgmap at http://files.mkgmap.org.uk/download/11/mkgmap.jar

..Steve
Index: src/uk/me/parabola/mkgmap/combiners/GmapsuppBuilder.java
===================================================================
--- src/uk/me/parabola/mkgmap/combiners/GmapsuppBuilder.java	(revision 1870)
+++ src/uk/me/parabola/mkgmap/combiners/GmapsuppBuilder.java	(revision )
@@ -29,6 +29,8 @@
 import uk.me.parabola.imgfmt.FileNotWritableException;
 import uk.me.parabola.imgfmt.FileSystemParam;
 import uk.me.parabola.imgfmt.Utils;
+import uk.me.parabola.imgfmt.app.srt.SRTFile;
+import uk.me.parabola.imgfmt.app.srt.Sort;
 import uk.me.parabola.imgfmt.fs.DirectoryEntry;
 import uk.me.parabola.imgfmt.fs.FileSystem;
 import uk.me.parabola.imgfmt.fs.ImgChannel;
@@ -75,12 +77,14 @@
 	private String overallDescription = "Combined map";
 	private String outputDir;
 	private MpsFile mpsFile;
+	private Sort sort;
 
 	public void init(CommandArgs args) {
 		areaName = args.get("area-name", null);
 		mapsetName = args.get("mapset-name", "OSM map set");
 		overallDescription = args.getDescription();
 		outputDir = args.getOutputDir();
+		sort = args.getSort();
 	}
 
 	/**
@@ -109,6 +113,7 @@
 
 			addAllFiles(imgFs);
 
+			writeSrtFile(imgFs);
 			writeMpsFile();
 
 		} catch (FileNotWritableException e) {
@@ -121,6 +126,33 @@
 	}
 
 	/**
+	 * Write the SRT file.
+	 * @param imgFs The filesystem to create the SRT file in.
+	 * @throws FileNotWritableException If it cannot be created.
+	 */
+	private void writeSrtFile(FileSystem imgFs) throws FileNotWritableException {
+		if (sort.getId1() == 0 && sort.getId2() == 0)
+			return;
+		
+		SRTFile srtFile;
+		ImgChannel channel;
+		try {
+			channel = imgFs.create("MAKEGMAP.SRT");
+			srtFile = new SRTFile(channel);
+		} catch (FileExistsException e) {
+			// well it shouldn't exist!
+			log.error("could not create MPS file as it already exists");
+			throw new FileNotWritableException("already existed", e);
+		}
+
+		srtFile.setSort(sort);
+		srtFile.write();
+		srtFile.close();
+
+		Utils.closeFile(channel);
+	}
+
+	/**
 	 * Write the MPS file.  The gmapsupp file will work without this, but it
 	 * important if you want to include more than one map family and be able
 	 * to turn them on and off separately.
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to