[mkgmap-splitter] 02/06: Imported Upstream version 0.0.0+svn439

Bas Couwenberg sebastic at debian.org
Thu Sep 1 08:10:14 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository mkgmap-splitter.

commit 26bfa5da5b11415e760ec85f733296cc0dc0d3e0
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Thu Sep 1 09:50:56 2016 +0200

    Imported Upstream version 0.0.0+svn439
---
 resources/splitter-version.properties               |  4 ++--
 src/uk/me/parabola/splitter/Area.java               |  7 +++++--
 src/uk/me/parabola/splitter/Main.java               | 18 +++++++++++++-----
 src/uk/me/parabola/splitter/MultiTileProcessor.java |  2 +-
 4 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/resources/splitter-version.properties b/resources/splitter-version.properties
index 67b0e45..cfac89c 100644
--- a/resources/splitter-version.properties
+++ b/resources/splitter-version.properties
@@ -1,2 +1,2 @@
-svn.version: 438
-build.timestamp: 2016-08-05T08:44:38+0100
+svn.version: 439
+build.timestamp: 2016-08-14T12:27:57+0100
diff --git a/src/uk/me/parabola/splitter/Area.java b/src/uk/me/parabola/splitter/Area.java
index 147fe16..27c15dc 100644
--- a/src/uk/me/parabola/splitter/Area.java
+++ b/src/uk/me/parabola/splitter/Area.java
@@ -71,12 +71,15 @@ public class Area {
 	 * Apply bbox to area.
 	 * @param area the area
 	 * @param bbox the bounding box
-	 * @return A new area instance that covers the intersection of area and bbox. 
+	 * @return A new area instance that covers the intersection of area and bbox
+	 * or null if they don't intersect
 	 */
 	public static Area calcArea (Area area, Rectangle bbox) {
 		Rectangle dest = new Rectangle();
 		Rectangle2D.intersect(area.getRect(), bbox, dest);
-		return new Area(dest.y, dest.x, dest.y + dest.height, dest.x + dest.width);
+		if (dest.getHeight() > 0 && dest.getWidth() > 0)
+			return new Area(dest.y, dest.x, dest.y + dest.height, dest.x + dest.width);
+		return null;
 	}
 
 
diff --git a/src/uk/me/parabola/splitter/Main.java b/src/uk/me/parabola/splitter/Main.java
index 5ccc256..186f25a 100644
--- a/src/uk/me/parabola/splitter/Main.java
+++ b/src/uk/me/parabola/splitter/Main.java
@@ -196,7 +196,8 @@ public class Main {
 			e.printStackTrace();
 			return 1;
 		} catch (SplitFailedException e) {
-			e.printStackTrace();
+			if (e.getMessage() != null && e.getMessage().length() > 0)
+				e.printStackTrace();
 			return 1;
 		} catch (StopNoErrorException e){
 			if (e.getMessage() != null)
@@ -263,7 +264,7 @@ public class Main {
 				System.out.println("Failed to calculate areas.");
 				System.out.println("Sorry. Cannot split the file without creating huge, almost empty, tiles.");
 				System.out.println("Please specify a bounding polygon with the --polygon-file parameter.");
-				return;
+				throw new SplitFailedException("");
 			}
 			if (mapId + areaList.getAreas().size() > 99999999){
 				System.err.println("Too many areas for initial mapid " + mapId + ", resetting to 63240001");
@@ -473,7 +474,7 @@ public class Main {
 		// plausibility checks and default handling 
 		if (keepComplete){
 			if (fileNameList.size() > 1){
-				System.err.println("warning: --keep-complete is only used for the first input file.");
+				System.err.println("Warning: --keep-complete is only used for the first input file.");
 			}
 			if (overlapAmount > 0){
 				System.err.println("Warning: --overlap is used in combination with --keep-complete=true ");
@@ -616,7 +617,12 @@ public class Main {
 		System.out.println("Exact map coverage read from input file(s) is " + exactArea);
 		if (polgonsBoundingBox != null){
 			exactArea = Area.calcArea(exactArea, polgonsBoundingBox);
-			System.out.println("Exact map coverage after applying bounding box of polygon-file is " + exactArea);
+			if (exactArea != null)
+				System.out.println("Exact map coverage after applying bounding box of polygon-file is " + exactArea);
+			else { 
+				System.out.println("Exact map coverage after applying bounding box of polygon-file is an empty area" );
+				return new AreaList(new ArrayList<Area>());
+			}
 		}
 
 		if (precompSeaDir != null){
@@ -630,8 +636,10 @@ public class Main {
 		}
 		Area roundedBounds = RoundingUtils.round(exactArea, resolution);
 		SplittableDensityArea splittableArea = pass1Collector.getSplitArea(searchLimit, roundedBounds);
-		if (splittableArea.hasData() == false)
+		if (splittableArea.hasData() == false){
+			System.out.println("input file(s) have no data inside calculated bounding box"); 
 			return new AreaList(new ArrayList<Area>());
+		}
 		System.out.println("Rounded map coverage is " + splittableArea.getBounds());
 		
 		splittableArea.setTrim(trim);
diff --git a/src/uk/me/parabola/splitter/MultiTileProcessor.java b/src/uk/me/parabola/splitter/MultiTileProcessor.java
index 4c9eda7..a526b31 100644
--- a/src/uk/me/parabola/splitter/MultiTileProcessor.java
+++ b/src/uk/me/parabola/splitter/MultiTileProcessor.java
@@ -911,7 +911,7 @@ class MultiTileProcessor extends AbstractMapProcessor {
 				// found closed polygon or nothing more to add
 				boolean isRelevant = checkBoundingBox(relWriters, mpBbox);
 				if (isRelevant & hasMissingWays)
-					System.out.println("Incomplete multipolygon relation " + rel.getId() + " (" + rel.getName() + "): using bbox of " + 
+					System.out.println("Warning: Incomplete multipolygon relation " + rel.getId() + " (" + rel.getName() + "): using bbox of " + 
 							(closed ? "closed":"unclosed") + " polygon to calc tiles, ways: " + polygonWays);
 				mpBbox = null;
 			} 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mkgmap-splitter.git



More information about the Pkg-grass-devel mailing list