[Git][debian-gis-team/mkgmap][upstream] New upstream version 0.0.0+svn4620
Bas Couwenberg
gitlab at salsa.debian.org
Thu Apr 1 05:39:25 BST 2021
Bas Couwenberg pushed to branch upstream at Debian GIS Project / mkgmap
Commits:
f1de4288 by Bas Couwenberg at 2021-04-01T05:55:28+02:00
New upstream version 0.0.0+svn4620
- - - - -
24 changed files:
- resources/mkgmap-version.properties
- src/uk/me/parabola/imgfmt/MapFailedException.java
- + src/uk/me/parabola/imgfmt/MapTooBigException.java
- src/uk/me/parabola/imgfmt/app/BufferedImgFileWriter.java
- src/uk/me/parabola/imgfmt/app/dem/DEMFile.java
- src/uk/me/parabola/imgfmt/app/lbl/LBLFile.java
- src/uk/me/parabola/imgfmt/app/mdr/Mdr1MapIndex.java
- src/uk/me/parabola/imgfmt/app/net/NETFile.java
- src/uk/me/parabola/imgfmt/app/net/NODFile.java
- src/uk/me/parabola/imgfmt/app/srt/SRTFile.java
- src/uk/me/parabola/imgfmt/app/trergn/RGNFile.java
- src/uk/me/parabola/imgfmt/app/trergn/TREFile.java
- src/uk/me/parabola/imgfmt/app/typ/TYPFile.java
- src/uk/me/parabola/imgfmt/mps/MpsFile.java
- src/uk/me/parabola/mkgmap/CommandArgsReader.java
- src/uk/me/parabola/mkgmap/build/MapBuilder.java
- src/uk/me/parabola/mkgmap/combiners/OverviewBuilder.java
- src/uk/me/parabola/mkgmap/filters/RemoveObsoletePointsFilter.java
- src/uk/me/parabola/mkgmap/filters/RoundCoordsFilter.java
- src/uk/me/parabola/mkgmap/main/Main.java
- src/uk/me/parabola/mkgmap/main/MapMaker.java
- src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberGenerator.java
- src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberIvl.java
- src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
Changes:
=====================================
resources/mkgmap-version.properties
=====================================
@@ -1,2 +1,2 @@
-svn.version: 4604
-build.timestamp: 2021-02-28T07:50:49+0000
+svn.version: 4620
+build.timestamp: 2021-03-28T10:11:16+0100
=====================================
src/uk/me/parabola/imgfmt/MapFailedException.java
=====================================
@@ -12,8 +12,6 @@
*/
package uk.me.parabola.imgfmt;
-import uk.me.parabola.log.Logger;
-
/**
* Used for cases where the current map has failed to compile, but the error
* is expected to be specific to the map (eg it is too big etc). When this
@@ -26,10 +24,10 @@ import uk.me.parabola.log.Logger;
* @author Steve Ratcliffe
*/
public class MapFailedException extends RuntimeException {
- private static final Logger log = Logger.getLogger(MapFailedException.class);
/**
- * Constructs a new runtime exception with the specified detail message.
+ * Constructs a new runtime exception with the calling method name
+ * appended to the detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*
@@ -37,13 +35,13 @@ public class MapFailedException extends RuntimeException {
* later retrieval by the {@link #getMessage()} method.
*/
public MapFailedException(String message) {
- super(message);
- log(message);
+ super(buildMessage(message));
}
/**
- * Constructs a new runtime exception with the specified detail message and
- * cause. <p>Note that the detail message associated with
+ * Constructs a new runtime exception with the calling method name
+ * appended to the detail message and includes the cause.
+ * <p>Note that the detail message associated with
* <code>cause</code> is <i>not</i> automatically incorporated in
* this runtime exception's detail message.
*
@@ -53,23 +51,32 @@ public class MapFailedException extends RuntimeException {
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
- * @since 1.4
*/
public MapFailedException(String message, Throwable cause) {
- super(message, cause);
- log(message);
+ super(buildMessage(message), cause);
}
- private static void log(String message){
+ /**
+ * Constructs a new runtime exception without appending the calling method
+ * name to the detail message. The calling method can be appended by the
+ * derived class if required.
+ */
+ protected MapFailedException(String message, boolean ignored) {
+ super(message);
+ }
+
+ /**
+ * Appends the calling method name to the supplied message.
+ */
+ protected static String buildMessage(String message) {
String thrownBy = "";
try{
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
int callerPosInStack = 3;
String[] caller = stackTraceElements[callerPosInStack].getClassName().split("\\.");
- thrownBy = "(thrown in " + caller[caller.length-1]+ "." +stackTraceElements[callerPosInStack].getMethodName() + "()) ";
+ thrownBy = " (thrown in " + caller[caller.length-1]+ "." +stackTraceElements[callerPosInStack].getMethodName() + "())";
} catch(Exception e){
- log.info(e);
}
- log.error(thrownBy + message);
+ return message + thrownBy;
}
}
\ No newline at end of file
=====================================
src/uk/me/parabola/imgfmt/MapTooBigException.java
=====================================
@@ -0,0 +1,14 @@
+package uk.me.parabola.imgfmt;
+
+public class MapTooBigException extends MapFailedException {
+ protected final long maxAllowedSize;
+
+ public MapTooBigException(long maxSize, String message, String suggestion) {
+ super(message + " The maximum size is " + maxSize + " bytes. " + suggestion, false);
+ maxAllowedSize = maxSize;
+ }
+
+ public long getMaxAllowedSize() {
+ return maxAllowedSize;
+ }
+}
=====================================
src/uk/me/parabola/imgfmt/app/BufferedImgFileWriter.java
=====================================
@@ -20,7 +20,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
-import uk.me.parabola.imgfmt.MapFailedException;
+import uk.me.parabola.imgfmt.MapTooBigException;
import uk.me.parabola.imgfmt.Sized;
import uk.me.parabola.imgfmt.fs.ImgChannel;
import uk.me.parabola.imgfmt.sys.FileLink;
@@ -41,6 +41,7 @@ public class BufferedImgFileWriter implements ImgFileWriter, Sized {
private static final int GUARD_SIZE = KBYTE;
private final ImgChannel chan;
+ private final String subfile;
private ByteBuffer buf = ByteBuffer.allocate(INIT_SIZE);
private int bufferSize = INIT_SIZE;
@@ -55,8 +56,9 @@ public class BufferedImgFileWriter implements ImgFileWriter, Sized {
// The maximum allowed file size.
private long maxAllowedSize = 0xffffff;
- public BufferedImgFileWriter(ImgChannel chan) {
+ public BufferedImgFileWriter(ImgChannel chan, String subfile) {
this.chan = chan;
+ this.subfile = subfile;
buf.order(ByteOrder.LITTLE_ENDIAN);
if (chan instanceof FileLink) {
((FileLink) chan).link(this, this);
@@ -270,11 +272,9 @@ public class BufferedImgFileWriter implements ImgFileWriter, Sized {
while(needed > (bufferSize - GUARD_SIZE))
bufferSize += GROW_SIZE;
if (bufferSize > maxAllowedSize) {
- // Previous message was confusing people, although it is difficult to come
- // up with something that is strictly true in all situations.
- throw new MapFailedException(
- "There is not enough room in a single garmin map for all the input data." +
- " The .osm file should be split into smaller pieces first.");
+ throw new MapTooBigException(maxAllowedSize,
+ "The " + subfile + " section of the map or tile is too big.",
+ "Try splitting the map into smaller tiles or reducing the amount of information included in the map.");
}
ByteBuffer newb = ByteBuffer.allocate(bufferSize);
newb.order(ByteOrder.LITTLE_ENDIAN);
=====================================
src/uk/me/parabola/imgfmt/app/dem/DEMFile.java
=====================================
@@ -15,6 +15,7 @@ package uk.me.parabola.imgfmt.app.dem;
import java.util.List;
+import uk.me.parabola.imgfmt.ExitException;
import uk.me.parabola.imgfmt.Utils;
import uk.me.parabola.imgfmt.app.Area;
import uk.me.parabola.imgfmt.app.BufferedImgFileReader;
@@ -46,7 +47,7 @@ public class DEMFile extends ImgFile {
setHeader(demHeader);
if (write) {
- setWriter(new BufferedImgFileWriter(chan));
+ setWriter(new BufferedImgFileWriter(chan, "DEM"));
position(DEMHeader.HEADER_LEN);
} else {
setReader(new BufferedImgFileReader(chan));
@@ -98,6 +99,8 @@ public class DEMFile extends ImgFile {
}
// last 4 bits of distance should be 0
distance = ((distance + 8) / 16) * 16;
+ if (distance == 0)
+ throw new ExitException("DEM distance is zero");
int xTop = top;
int xLeft = left;
=====================================
src/uk/me/parabola/imgfmt/app/lbl/LBLFile.java
=====================================
@@ -66,7 +66,7 @@ public class LBLFile extends ImgFile {
lblHeader.setOffsetMultiplier(OFFSET_MULTIPLIER);
setHeader(lblHeader);
- setWriter(new BufferedImgFileWriter(chan));
+ setWriter(new BufferedImgFileWriter(chan, "LBL"));
position((long) LBLHeader.HEADER_LEN + lblHeader.getSortDescriptionLength());
=====================================
src/uk/me/parabola/imgfmt/app/mdr/Mdr1MapIndex.java
=====================================
@@ -25,7 +25,7 @@ import uk.me.parabola.imgfmt.app.ImgFileWriter;
*/
public class Mdr1MapIndex {
private final Mdr1SubHeader subHeader = new Mdr1SubHeader();
- private final BufferedImgFileWriter subWriter = new BufferedImgFileWriter(null);
+ private final BufferedImgFileWriter subWriter = new BufferedImgFileWriter(null, "MDR");
private int pointerSize;
=====================================
src/uk/me/parabola/imgfmt/app/net/NETFile.java
=====================================
@@ -51,7 +51,7 @@ public class NETFile extends ImgFile {
public NETFile(ImgChannel chan) {
setHeader(netHeader);
- setWriter(new BufferedImgFileWriter(chan));
+ setWriter(new BufferedImgFileWriter(chan, "NET"));
position(NETHeader.HEADER_LEN);
}
=====================================
src/uk/me/parabola/imgfmt/app/net/NODFile.java
=====================================
@@ -59,7 +59,7 @@ public class NODFile extends ImgFile {
public NODFile(ImgChannel chan, boolean write) {
setHeader(nodHeader);
if (write) {
- setWriter(new BufferedImgFileWriter(chan));
+ setWriter(new BufferedImgFileWriter(chan, "NOD"));
position(NODHeader.HEADER_LEN);
} else {
setReader(new BufferedImgFileReader(chan));
=====================================
src/uk/me/parabola/imgfmt/app/srt/SRTFile.java
=====================================
@@ -40,7 +40,7 @@ public class SRTFile extends ImgFile {
private final List<Integer> srt8Starts = new ArrayList<>();
public SRTFile(ImgChannel chan) {
- BufferedImgFileWriter fileWriter = new BufferedImgFileWriter(chan);
+ BufferedImgFileWriter fileWriter = new BufferedImgFileWriter(chan, "SRT");
fileWriter.setMaxSize(Long.MAX_VALUE);
setWriter(fileWriter);
}
=====================================
src/uk/me/parabola/imgfmt/app/trergn/RGNFile.java
=====================================
@@ -57,7 +57,7 @@ public class RGNFile extends ImgFile {
public RGNFile(ImgChannel chan) {
setHeader(header);
- setWriter(new BufferedImgFileWriter(chan));
+ setWriter(new BufferedImgFileWriter(chan, "RGN"));
// Position at the start of the writable area.
position(HEADER_LEN);
=====================================
src/uk/me/parabola/imgfmt/app/trergn/TREFile.java
=====================================
@@ -64,7 +64,7 @@ public class TREFile extends ImgFile implements Configurable {
public TREFile(ImgChannel chan) {
setHeader(header);
- setWriter(new BufferedImgFileWriter(chan));
+ setWriter(new BufferedImgFileWriter(chan, "TRE"));
// Position at the start of the writable area.
position(header.getHeaderLength());
=====================================
src/uk/me/parabola/imgfmt/app/typ/TYPFile.java
=====================================
@@ -55,7 +55,7 @@ public class TYPFile extends ImgFile {
public TYPFile(ImgChannel chan) {
setHeader(header);
- setWriter(new BufferedImgFileWriter(chan));
+ setWriter(new BufferedImgFileWriter(chan, "TYP"));
position(TYPHeader.HEADER_LEN);
}
=====================================
src/uk/me/parabola/imgfmt/mps/MpsFile.java
=====================================
@@ -46,7 +46,7 @@ public class MpsFile {
public MpsFile(ImgChannel chan) {
assert chan instanceof FileNode;
- writer = new BufferedImgFileWriter(chan);
+ writer = new BufferedImgFileWriter(chan, "MPS");
}
public void sync() throws IOException {
=====================================
src/uk/me/parabola/mkgmap/CommandArgsReader.java
=====================================
@@ -241,8 +241,8 @@ public class CommandArgsReader {
});
try {
opts.readOptionFile(filename);
- } catch (IOException e) {
- throw new ExitException("Failed to read option file", e);
+ } catch (Exception e) {
+ throw new ExitException("Failed to read option file.", e);
}
}
=====================================
src/uk/me/parabola/mkgmap/build/MapBuilder.java
=====================================
@@ -36,6 +36,7 @@ import java.util.stream.Collectors;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import uk.me.parabola.imgfmt.ExitException;
import uk.me.parabola.imgfmt.MapFailedException;
+import uk.me.parabola.imgfmt.MapTooBigException;
import uk.me.parabola.imgfmt.Utils;
import uk.me.parabola.imgfmt.app.Area;
import uk.me.parabola.imgfmt.app.Coord;
@@ -374,9 +375,10 @@ public class MapBuilder implements Configurable {
long t2 = System.currentTimeMillis();
log.info("DEM file calculation for", map.getFilename(), "took", (t2 - t1), "ms");
demFile.write();
+ } catch (MapTooBigException e) {
+ throw new MapTooBigException(e.getMaxAllowedSize(), "The DEM section of the map or tile is too big.", "Try increasing the DEM distance.");
} catch (MapFailedException e) {
- log.error("exception while creating DEM file", e.getMessage());
- throw new MapFailedException("DEM");
+ throw new MapFailedException("Error creating DEM File. " + e.getMessage());
}
}
@@ -501,7 +503,7 @@ public class MapBuilder implements Configurable {
}
}
-
+
private void processRoads(Map map, MapDataSource src) {
LBLFile lbl = map.getLblFile();
MapPoint searchPoint = new MapPoint();
=====================================
src/uk/me/parabola/mkgmap/combiners/OverviewBuilder.java
=====================================
@@ -22,6 +22,7 @@ import uk.me.parabola.imgfmt.FileExistsException;
import uk.me.parabola.imgfmt.FileNotWritableException;
import uk.me.parabola.imgfmt.FileSystemParam;
import uk.me.parabola.imgfmt.MapFailedException;
+import uk.me.parabola.imgfmt.MapTooBigException;
import uk.me.parabola.imgfmt.Utils;
import uk.me.parabola.imgfmt.app.Area;
import uk.me.parabola.imgfmt.app.Coord;
@@ -195,6 +196,10 @@ public class OverviewBuilder implements Combiner {
throw new ExitException("Could not create overview map", e);
} catch (FileNotWritableException e) {
throw new ExitException("Could not write to overview map", e);
+ } catch (MapTooBigException e) {
+ throw new MapTooBigException(e.getMaxAllowedSize(),
+ "The overview map is too big.",
+ "Try reducing the highest overview resolution or reducing the amount of information included in the overview.");
}
}
=====================================
src/uk/me/parabola/mkgmap/filters/RemoveObsoletePointsFilter.java
=====================================
@@ -30,8 +30,6 @@ import uk.me.parabola.mkgmap.general.MapShape;
public class RemoveObsoletePointsFilter implements MapFilter {
private static final Logger log = Logger.getLogger(RemoveObsoletePointsFilter.class);
- final Coord[] areaTest = new Coord[3];
-
private boolean checkPreserved;
@Override
@@ -48,8 +46,8 @@ public class RemoveObsoletePointsFilter implements MapFilter {
MapLine line = (MapLine) element;
List<Coord> points = line.getPoints();
int numPoints = points.size();
- if (numPoints <= 1){
- return;
+ if (numPoints <= 1) {
+ return;
}
int requiredPoints = (line instanceof MapShape ) ? 4:2;
List<Coord> newPoints = new ArrayList<>(numPoints);
@@ -67,13 +65,14 @@ public class RemoveObsoletePointsFilter implements MapFilter {
if (lastP.equals(newP)){
// only add the new point if it has different
// coordinates to the last point or is preserved
- if (checkPreserved && line.isRoad()){
+ if (checkPreserved && line.isRoad()) {
if (!newP.preserved()) {
continue;
- } else if (!lastP.preserved()){
+ } else if (!lastP.preserved()) {
newPoints.set(last, newP); // replace last
- }
- } else {
+ continue;
+ }
+ } else {
continue;
}
}
@@ -116,12 +115,14 @@ public class RemoveObsoletePointsFilter implements MapFilter {
int nPoints = newPoints.size();
switch(Utils.isStraight(newPoints.get(newPoints.size()-2), newPoints.get(0), newPoints.get(1))){
case Utils.STRAIGHT_SPIKE:
+ log.debug("removing closing spike");
newPoints.remove(0);
newPoints.set(newPoints.size()-1, newPoints.get(0));
if (newPoints.get(newPoints.size()-2).equals(newPoints.get(newPoints.size()-1)))
newPoints.remove(newPoints.size()-1);
break;
case Utils.STRICTLY_STRAIGHT:
+ log.debug("removing straight line across closing");
newPoints.remove(newPoints.size()-1);
newPoints.set(0, newPoints.get(newPoints.size()-1));
break;
=====================================
src/uk/me/parabola/mkgmap/filters/RoundCoordsFilter.java
=====================================
@@ -31,8 +31,8 @@ public class RoundCoordsFilter implements MapFilter {
@Override
public void init(FilterConfig config) {
shift = config.getShift();
- keepNodes = config.getLevel() == 0 && config.hasNet();
level = config.getLevel();
+ keepNodes = level == 0 && config.hasNet();
}
/**
@@ -41,12 +41,11 @@ public class RoundCoordsFilter implements MapFilter {
*/
@Override
public void doFilter(MapElement element, MapFilterChain next) {
- MapLine line = (MapLine) element;
- if(shift == 0) {
+ if (shift == 0) {
// do nothing
- next.doFilter(line);
- }
- else {
+ next.doFilter(element);
+ } else {
+ MapLine line = (MapLine) element;
int half = 1 << (shift - 1); // 0.5 shifted
int mask = ~((1 << shift) - 1); // to remove fraction bits
@@ -64,9 +63,9 @@ public class RoundCoordsFilter implements MapFilter {
int lon = (p.getLongitude() + half) & mask;
Coord newP;
- if(p instanceof CoordNode && keepNodes)
+ if (p instanceof CoordNode && keepNodes) {
newP = new CoordNode(lat, lon, p.getId(), p.getOnBoundary(), p.getOnCountryBorder());
- else {
+ } else {
newP = new Coord(lat, lon);
newP.preserved(p.preserved());
newP.setNumberNode(hasNumbers && p.isNumberNode());
@@ -75,7 +74,7 @@ public class RoundCoordsFilter implements MapFilter {
// only add the new point if it has different
// coordinates to the last point or if it's a
// special node
- if (lastP == null || !lastP.equals(newP) || newP.getId() > 0|| (hasNumbers && newP.isNumberNode())) {
+ if (lastP == null || !lastP.equals(newP) || newP.getId() > 0 || (hasNumbers && newP.isNumberNode())) {
newPoints.add(newP);
lastP = newP;
} else if (newP.preserved()) {
@@ -87,7 +86,7 @@ public class RoundCoordsFilter implements MapFilter {
lastP.preserved(true);
}
}
- if(newPoints.size() > 1) {
+ if (newPoints.size() > 1) {
MapLine newLine = line.copy();
newLine.setPoints(newPoints);
next.doFilter(newLine);
=====================================
src/uk/me/parabola/mkgmap/main/Main.java
=====================================
@@ -149,11 +149,8 @@ public class Main implements ArgumentProcessor {
System.err.println("Try using the mkgmap --max-jobs option with a value less than " + mm.maxJobs + " to reduce the memory requirement, or use the Java -Xmx option to increase the available heap memory.");
else
System.err.println("Try using the Java -Xmx option to increase the available heap memory.");
- } catch (MapFailedException e) {
+ } catch (MapFailedException | ExitException e) {
// one of the combiners failed
- e.printStackTrace();
- ++numExitExceptions;
- } catch (ExitException e) {
++numExitExceptions;
String message = e.getMessage();
Throwable cause = e.getCause();
@@ -565,11 +562,12 @@ public class Main implements ArgumentProcessor {
} catch (MapFailedException mfe) {
numMapFailedExceptions++;
setProgramRC(-1);
- } catch (Throwable t) {
- t.printStackTrace();
if (!args.getProperties().getProperty("keep-going", false)) {
throw new ExitException("Exiting - if you want to carry on regardless, use the --keep-going option");
}
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new ExitException("Exiting due to unexpected error");
}
}
}
=====================================
src/uk/me/parabola/mkgmap/main/MapMaker.java
=====================================
@@ -120,10 +120,16 @@ public class MapMaker implements MapProcessor {
map.close();
return outName;
} catch (FileExistsException e) {
+ log.error("File exists already");
throw new MapFailedException("File exists already", e);
} catch (FileNotWritableException e) {
+ log.error("Could not create or write to file");
throw new MapFailedException("Could not create or write to file", e);
}
+ catch (MapFailedException e) {
+ log.error(e.getMessage()); // make sure the filename is logged
+ throw e;
+ }
}
/**
=====================================
src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberGenerator.java
=====================================
@@ -891,17 +891,14 @@ public class HousenumberGenerator {
MapRoad[] uncheckedRoads = new MapRoad[houses.length];
for (int i = 0 ; i < houses.length; i++)
uncheckedRoads[i] = houses[i].getRoad();
- isOK = info.checkRoads();
+ info.checkRoads();
// check if houses are assigned to different roads now
houses = info.getHouseNodes();
for (int i = 0 ; i < houses.length; i++) {
if (houses[i].getRoad() != uncheckedRoads[i]) {
initialHousesForRoads.removeMapping(uncheckedRoads[i], houses[i]);
- if (!houses[i].isIgnored())
+ if (!houses[i].isIgnored()) {
initialHousesForRoads.add(houses[i].getRoad(), houses[i]);
- else {
- if (!isOK)
- log.info("housenumber is assigned to different road after checking addr:interpolation way which turned out to be invalid",houses[i],info );
}
}
}
@@ -1157,8 +1154,7 @@ public class HousenumberGenerator {
if (dupCount > 0) {
log.warn("addr:interpolation way",streetName,hivl,"is ignored, it produces",dupCount,"duplicate number(s) too far from existing nodes");
badIvls.add(hivl);
- }
- else {
+ } else {
housesToAdd.put(hivl, interpolatedHouses);
for (HousenumberMatch hnm : interpolatedHouses)
interpolatedNumbers.put(hnm.getHousenumber(), hnm);
=====================================
src/uk/me/parabola/mkgmap/osmstyle/housenumber/HousenumberIvl.java
=====================================
@@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+
import uk.me.parabola.imgfmt.Utils;
import uk.me.parabola.imgfmt.app.Coord;
import uk.me.parabola.log.Logger;
@@ -200,7 +201,7 @@ public class HousenumberIvl {
HousenumberGenerator.findClosestRoadSegment(test[i], r);
test[i].calcRoadSide();
}
- if (test[i].getRoad() == null || test[i].getDistance() > MAX_INTERPOLATION_DISTANCE_TO_ROAD ){
+ if (test[i].getRoad() == null || test[i].getDistance() > MAX_INTERPOLATION_DISTANCE_TO_ROAD) {
foundSingleRoad = false;
break;
}
@@ -257,7 +258,7 @@ public class HousenumberIvl {
}
}
}
- if (!foundSingleRoad && bestRoad != null){
+ if (!foundSingleRoad && bestRoad != null) {
// not matching road name in original OSM data, use the closest
foundSingleRoad = true;
test[0] = closest[0];
@@ -271,21 +272,26 @@ public class HousenumberIvl {
hasMultipleRoads = true;
return true;
}
- // we found the road that should be used for interpolation
+ for (int i = 0; i < 2; i++) {
+ if (test[i].getSegmentFrac() < 0 || test[i].getSegmentFrac() > 1) {
+ // might still be one road that bends but that will not cause trouble
+ hasMultipleRoads = true;
+ return true;
+ }
+ }
+
+ // we found a single road instance that should be used for all interpolated numbers
roadForInterpolatedHouses = test[0].getRoad();
// we found a single plausible road, make sure that both nodes are using it
- for (int i = 0; i < 2; i++){
- if (knownHouses[i].getRoad() != test[i].getRoad() || knownHouses[i].getSegment() != test[i].getSegment()){
+ for (int i = 0; i < 2; i++) {
+ if (knownHouses[i].getRoad() != test[i].getRoad() || knownHouses[i].getSegment() != test[i].getSegment()) {
copyRoadData(test[i], knownHouses[i]);
knownHouses[i].forgetAlternativeRoads();
}
- if (knownHouses[i].getSegmentFrac() < 0 || knownHouses[i].getSegmentFrac() > 1){
- hasMultipleRoads = true;
- }
}
- if (knownHouses[0].isLeft() != knownHouses[1].isLeft()){
- log.warn("addr:interpolation way crosses road",streetName,this);
+ if (knownHouses[0].isLeft() != knownHouses[1].isLeft()) {
+ log.warn("addr:interpolation way crosses road", streetName, this);
return false;
}
return true;
@@ -479,10 +485,6 @@ public class HousenumberIvl {
return false;
}
- public boolean foundCluster() {
- return foundCluster;
- }
-
public void setEqualEnds() {
this.equalEnds = true;
=====================================
src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
=====================================
@@ -1301,7 +1301,7 @@ public class MultiPolygonRelation extends Relation {
String tagName = tagEntry.getKey();
// all tags are style relevant
// except: type (for relations), mkgmap:*
- boolean isStyleRelevant = !(element instanceof Relation && "typ".equals(tagName))
+ boolean isStyleRelevant = !(element instanceof Relation && "type".equals(tagName))
&& !tagName.startsWith("mkgmap:");
if (isStyleRelevant) {
return true;
View it on GitLab: https://salsa.debian.org/debian-gis-team/mkgmap/-/commit/f1de4288a4c0e447b24d0811f927194e9726ddc6
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/mkgmap/-/commit/f1de4288a4c0e447b24d0811f927194e9726ddc6
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20210401/7661a5a5/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list