Hi

The tdbfile option is currently the default, except when there is only
one input file. The attached patch removes that quirk and also removes
the --tdb-v3 option. The version 3 is useless for routing and only
ever existed because it took a long time to work out version 4.

Also fix an obscure crash when you specify files that don't exist,
that got exposed by the rest of the patch.

..Steve
Index: test/func/files/TdbTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- test/func/files/TdbTest.java	(revision 2396)
+++ test/func/files/TdbTest.java	(revision )
@@ -50,25 +50,6 @@
 		assertEquals("tdb version", 407, tdb.getTdbVersion());
 	}
 
-	/**
-	 * Check version 3 of the format.  Not very important.
-	 * @throws IOException
-	 */
-	@Test
-	public void testVersion3() throws IOException {
-		Main.main(new String[]{
-				Args.TEST_STYLE_ARG,
-				"--tdbfile",
-				"--tdb-v3",
-				Args.TEST_RESOURCE_OSM + "uk-test-1.osm.gz"
-		});
-
-		File f = new File(TDBNAME);
-		assertTrue("TDB was created", f.exists());
-
-		TdbFile tdb = TdbFile.read(TDBNAME);
-		assertEquals("tdb version", 300, tdb.getTdbVersion());
-	}
 
 	/**
 	 * Check for each possible option.
Index: resources/help/en/options
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- resources/help/en/options	(revision 2396)
+++ resources/help/en/options	(revision )
@@ -541,9 +541,8 @@
 	compared with these patterns and those that match are deleted.
 
 --tdbfile
-	Write a .tdb file.
---tdb-v3
-	Write a version 3 tdb file instead of the default v4. Not useful.
+	Write files that are essential to running with MapSource, a .tdb file and
+	an overview map.
 
 --show-profiles=1
 	Sets a flag in tdb file which marks set mapset as having contour 
Index: mkgmap.iml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mkgmap.iml	(revision 2396)
+++ mkgmap.iml	(revision )
@@ -30,7 +30,9 @@
       <excludeFolder url="file://$MODULE_DIR$/maps" />
       <excludeFolder url="file://$MODULE_DIR$/ref" />
       <excludeFolder url="file://$MODULE_DIR$/samples" />
+      <excludeFolder url="file://$MODULE_DIR$/test-reports" />
       <excludeFolder url="file://$MODULE_DIR$/test/resources/in" />
+      <excludeFolder url="file://$MODULE_DIR$/tmp" />
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="library" name="resource" level="project" />
Index: src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java	(revision 2396)
+++ src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java	(revision )
@@ -83,19 +83,11 @@
 		String seriesName = args.get("series-name", "OSM map");
 		String familyName = args.get("family-name", "OSM map");
 
-		// Version 4 is the default.  If you really want v3 then the tdb-v3
-		// option can be used.
-		if (args.exists("tdb-v3")) {
-			tdbVersion = TdbFile.TDB_V3;
-		} else {
-			tdbVersion = TdbFile.TDB_V407;
+		tdbVersion = TdbFile.TDB_V407;
-		}
+
 		// enable "show profile" button for routes in mapsource 
-		byte enableProfile = 0;
-		if (tdbVersion == TdbFile.TDB_V407) {
-			// this is supported only in version 403 and above 
+		// this is supported only in version 403 and above
-			enableProfile = (byte)args.get("show-profiles", 0);
-		}
+		byte enableProfile = (byte) args.get("show-profiles", 0);
 
 		tdb = new TdbFile(tdbVersion);
 		tdb.setProductInfo(familyId, productId, productVersion, seriesName,
Index: src/uk/me/parabola/mkgmap/main/Main.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/mkgmap/main/Main.java	(revision 2396)
+++ src/uk/me/parabola/mkgmap/main/Main.java	(revision )
@@ -231,7 +231,7 @@
 			// generation of the overview files if there is only one file
 			// to process.
 			int n = Integer.valueOf(val);
-			if (n > 1)
+			if (n > 0) // TODO temporary, this option will become properly default of on.
 				addTdbBuilder();
 
 		} else if (opt.equals("tdbfile")) {
Index: src/uk/me/parabola/tdbfmt/TestTdb.java
===================================================================
--- src/uk/me/parabola/tdbfmt/TestTdb.java	(revision 2396)
+++ src/uk/me/parabola/tdbfmt/TestTdb.java	(revision 2396)
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2007 Steve Ratcliffe
- * 
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License 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.
- * 
- * 
- * Author: Steve Ratcliffe
- * Create date: 23-Sep-2007
- */
-package uk.me.parabola.tdbfmt;
-
-import uk.me.parabola.log.Logger;
-
-import java.io.IOException;
-
-/**
- * @author Steve Ratcliffe
- */
-public class TestTdb {
-	private static final Logger log = Logger.getLogger(TestTdb.class);
-
-	public static void main(String[] args) throws IOException {
-
-		Logger.resetLogging("localtest/log/log.all");
-		TdbFile tdb = TdbFile.read(args[0]);
-		log.debug(tdb);
-
-		//tdb.write("test.tdb");
-	}
-}
Index: src/uk/me/parabola/tdbfmt/TdbFile.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/tdbfmt/TdbFile.java	(revision 2396)
+++ src/uk/me/parabola/tdbfmt/TdbFile.java	(revision )
@@ -40,7 +40,6 @@
 public class TdbFile {
 	private static final Logger log = Logger.getLogger(TdbFile.class);
 
-	public static final int TDB_V3 = 300;
 	public static final int TDB_V407 = 407;
 
 	private static final int BLOCK_OVERVIEW = 0x42;
Index: src/uk/me/parabola/mkgmap/main/MapMaker.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/mkgmap/main/MapMaker.java	(revision 2396)
+++ src/uk/me/parabola/mkgmap/main/MapMaker.java	(revision )
@@ -62,10 +62,10 @@
 		} catch (FormatException e) {
 			System.err.println("Bad file format: " + filename);
 			System.err.println(e.getMessage());
-			return null;
+			return filename;
 		} catch (FileNotFoundException e) {
 			System.err.println("Could not open file: " + filename);
-			return null;
+			return filename;
 		}
 	}
 
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to