[Git][debian-gis-team/mkgmap-splitter][upstream] New upstream version 0.0.0+svn602

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Tue Jun 1 05:18:22 BST 2021



Bas Couwenberg pushed to branch upstream at Debian GIS Project / mkgmap-splitter


Commits:
1f4db4eb by Bas Couwenberg at 2021-06-01T06:01:49+02:00
New upstream version 0.0.0+svn602
- - - - -


11 changed files:

- build.xml
- ivysettings.xml
- resources/splitter-version.properties
- src/uk/me/parabola/splitter/OSMFileHandler.java
- src/uk/me/parabola/splitter/parser/BinaryMapParser.java
- src/uk/me/parabola/splitter/parser/O5mMapParser.java
- src/uk/me/parabola/splitter/writer/AbstractOSMWriter.java
- src/uk/me/parabola/splitter/writer/BinaryMapWriter.java
- src/uk/me/parabola/splitter/writer/O5mMapWriter.java
- src/uk/me/parabola/splitter/writer/OSMXMLWriter.java
- test/uk/me/parabola/splitter/tools/SparseBitSetTest.java


Changes:

=====================================
build.xml
=====================================
@@ -341,10 +341,10 @@
 			<fileset dir="${test.input.cache}" includes="osm/*.osm.pbf" />
 		</copy>
 		<mkdir dir="test/resources/in/osm"/>
-		<get src="http://www.mkgmap.org.uk/testinput/osm/alaska-2016-12-27.osm.pbf"
+		<get src="https://www.mkgmap.org.uk/testinput/osm/alaska-2016-12-27.osm.pbf"
 			dest="test/resources/in/osm/alaska-2016-12-27.osm.pbf" usetimestamp="true"
 			ignoreerrors="true"/>
-		<get src="http://www.mkgmap.org.uk/testinput/osm/hamburg-2016-12-26.osm.pbf"
+		<get src="https://www.mkgmap.org.uk/testinput/osm/hamburg-2016-12-26.osm.pbf"
 			dest="test/resources/in/osm/hamburg-2016-12-26.osm.pbf" usetimestamp="true"
 			ignoreerrors="true"/>
 	</target>


=====================================
ivysettings.xml
=====================================
@@ -1,5 +1,5 @@
 <ivysettings>
-	<property name="mkgmap.ivy.repo" value="http://ivy.mkgmap.org.uk/repo" />
+	<property name="mkgmap.ivy.repo" value="https://ivy.mkgmap.org.uk/repo" />
 	<settings defaultResolver="custom" />
 
 	<include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>


=====================================
resources/splitter-version.properties
=====================================
@@ -1,2 +1,2 @@
-svn.version: 598
-build.timestamp: 2021-02-02T15:27:27+0000
+svn.version: 602
+build.timestamp: 2021-05-07T15:00:54+0100


=====================================
src/uk/me/parabola/splitter/OSMFileHandler.java
=====================================
@@ -81,7 +81,7 @@ public class OSMFileHandler {
 						O5mMapParser o5mParser = new O5mMapParser(processor, fileChannel, skipArray);
 						o5mParser.parse();
 						if (skipArray == null) {
-							skipArray = o5mParser.getSkipArray();
+							skipArray = o5mParser.getNextSkipArray();
 							skipArrayMap.put(filename, skipArray);
 						}
 					}


=====================================
src/uk/me/parabola/splitter/parser/BinaryMapParser.java
=====================================
@@ -57,13 +57,13 @@ public class BinaryMapParser extends BinaryParser {
 		this.skipRels = processor.skipRels();
 		this.msgLevel = msgLevel;
 
-		if (skipNodes == false) {
+		if (!skipNodes) {
 			wantedTypeMask |= TYPE_DENSE;
 			wantedTypeMask |= TYPE_NODES;
 		}
-		if (skipWays == false)
+		if (!skipWays)
 			wantedTypeMask |= TYPE_WAYS;
-		if (skipRels == false)
+		if (!skipRels)
 			wantedTypeMask |= TYPE_RELS;
 	}
 
@@ -81,11 +81,9 @@ public class BinaryMapParser extends BinaryParser {
 			if (blockType != 0 && (blockType & wantedTypeMask) == 0)
 				return true;
 		} else if (blockType != -1) {
-			// System.out.println("previous block contained " + blockType );
 			blockTypes.add(blockType);
 		}
 		blockType = 0;
-		// System.out.println("Seeing block of type: "+block.getType());
 		if (block.getType().equals("OSMData"))
 			return false;
 		if (block.getType().equals("OSMHeader"))
@@ -101,40 +99,36 @@ public class BinaryMapParser extends BinaryParser {
 		// So do nothing else.
 	}
 
-	// Per-block state for parsing, set when processing the header of a block;
 	@Override
 	protected void parseDense(Osmformat.DenseNodes nodes) {
 		blockType |= TYPE_DENSE;
 		if (skipNodes)
 			return;
-		long last_id = 0, last_lat = 0, last_lon = 0;
+		long lastId = 0, lastLat = 0, lastLon = 0;
 		int j = 0;
 		int maxi = nodes.getIdCount();
-		Node tmp = new Node();
 		for (int i = 0; i < maxi; i++) {
-			long lat = nodes.getLat(i) + last_lat;
-			last_lat = lat;
-			long lon = nodes.getLon(i) + last_lon;
-			last_lon = lon;
-			long id = nodes.getId(i) + last_id;
-			last_id = id;
+			long lat = nodes.getLat(i) + lastLat;
+			lastLat = lat;
+			long lon = nodes.getLon(i) + lastLon;
+			lastLon = lon;
+			long id = nodes.getId(i) + lastId;
+			lastId = id;
 			double latf = parseLat(lat), lonf = parseLon(lon);
 
-			tmp = new Node();
+			Node tmp = new Node();
 			tmp.set(id, latf, lonf);
 			if (nodes.hasDenseinfo())
 				tmp.setVersion(nodes.getDenseinfo().getVersion(i));
 
-			if (!skipTags) {
-				if (nodes.getKeysValsCount() > 0) {
-					while (nodes.getKeysVals(j) != 0) {
-						int keyid = nodes.getKeysVals(j++);
-						int valid = nodes.getKeysVals(j++);
-						tmp.addTag(getStringById(keyid), getStringById(valid));
-					}
-					j++; // Skip over the '0' delimiter.
-
+			if (!skipTags && nodes.getKeysValsCount() > 0) {
+				while (nodes.getKeysVals(j) != 0) {
+					int keyid = nodes.getKeysVals(j++);
+					int valid = nodes.getKeysVals(j++);
+					tmp.addTag(getStringById(keyid), getStringById(valid));
 				}
+				j++; // Skip over the '0' delimiter.
+
 			}
 			processor.processNode(tmp);
 			elemCounter.countNode(tmp.getId());
@@ -143,7 +137,7 @@ public class BinaryMapParser extends BinaryParser {
 
 	@Override
 	protected void parseNodes(List<Osmformat.Node> nodes) {
-		if (nodes.size() == 0)
+		if (nodes.isEmpty())
 			return;
 		blockType |= TYPE_NODES;
 		if (skipNodes)
@@ -174,14 +168,14 @@ public class BinaryMapParser extends BinaryParser {
 			return;
 		for (Osmformat.Way i : ways) {
 			Way tmp = new Way();
-			if (skipTags == false) {
+			if (!skipTags) {
 				for (int j = 0; j < i.getKeysCount(); j++)
 					tmp.addTag(getStringById(i.getKeys(j)), getStringById(i.getVals(j)));
 			}
-			long last_id = 0;
+			long lastId = 0;
 			for (long j : i.getRefsList()) {
-				tmp.addRef(j + last_id);
-				last_id = j + last_id;
+				tmp.addRef(j + lastId);
+				lastId = j + lastId;
 			}
 
 			long id = i.getId();
@@ -196,14 +190,14 @@ public class BinaryMapParser extends BinaryParser {
 
 	@Override
 	protected void parseRelations(List<Osmformat.Relation> rels) {
-		if (rels.size() == 0)
+		if (rels.isEmpty())
 			return;
 		blockType |= TYPE_RELS;
 		if (skipRels)
 			return;
 		for (Osmformat.Relation i : rels) {
 			Relation tmp = new Relation();
-			if (skipTags == false) {
+			if (!skipTags) {
 				for (int j = 0; j < i.getKeysCount(); j++)
 					tmp.addTag(getStringById(i.getKeys(j)), getStringById(i.getVals(j)));
 			}
@@ -211,10 +205,10 @@ public class BinaryMapParser extends BinaryParser {
 			tmp.setId(id);
 			tmp.setVersion(i.getInfo().getVersion());
 
-			long last_mid = 0;
+			long lastMemId = 0;
 			for (int j = 0; j < i.getMemidsCount(); j++) {
-				long mid = last_mid + i.getMemids(j);
-				last_mid = mid;
+				long mid = lastMemId + i.getMemids(j);
+				lastMemId = mid;
 				String role = getStringById(i.getRolesSid(j));
 				String etype = null;
 


=====================================
src/uk/me/parabola/splitter/parser/O5mMapParser.java
=====================================
@@ -16,6 +16,7 @@ package uk.me.parabola.splitter.parser;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.channels.FileChannel;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 
 import uk.me.parabola.splitter.Area;
@@ -93,7 +94,8 @@ public class O5mMapParser {
 	private long[] lastRef;
 	private long lastTs;
 	private long lastChangeSet;
-	private int lastLon, lastLat;
+	private int lastLon;
+	private int lastLat;
 	
 	/**
 	 * A parser for the o5m format.
@@ -101,9 +103,8 @@ public class O5mMapParser {
 	 * @param fc the file channel for the input file 
 	 * @param skipArray An Array of longs that is used to hold information of file position of the first occurrence of 
 	 * each known 05m data type (esp. nodes, ways, and relations). 
-	 * @throws IOException 
 	 */
-	public O5mMapParser(MapProcessor processor, FileChannel fc, long[] skipArray) throws IOException{
+	public O5mMapParser(MapProcessor processor, FileChannel fc, long[] skipArray) {
 		this.fileChannel = fc;
 		this.processor = processor;
 		this.skipArray = skipArray;
@@ -130,13 +131,11 @@ public class O5mMapParser {
 		int start = get() & 0xff;
 		if (start != RESET_FLAG) 
 			throw new IOException("wrong header byte " + start);
-		if (skipArray != null) {
-			if (skipNodes) {
-				if (skipWays)
-					filePos = skipArray[REL_DATASET]; // jump to first relation
-				else
-					filePos = skipArray[WAY_DATASET]; // jump to first way
-			}
+		if (skipArray != null && skipNodes) {
+			if (skipWays)
+				filePos = skipArray[REL_DATASET]; // jump to first relation
+			else 
+				filePos = skipArray[WAY_DATASET]; // jump to first way
 		}
 		if (filePos >= 0)
 			readFile();
@@ -152,20 +151,17 @@ public class O5mMapParser {
 			long size = 0;
 			int fileType = get() & 0xff;
 			if (fileType >= 0 && fileType < 0xf0) {
-				if (skipArray == null) {
+				if (skipArray == null && firstPosInFile[fileType] == -1) {
 					// save first occurrence of a data set type
-					if (firstPosInFile[fileType] == -1) {
-						firstPosInFile[fileType] = Math.max(0, filePos- 1);
-					}
+					firstPosInFile[fileType] = Math.max(0, filePos- 1);
 				}
 				size = readUnsignedNum64();
 				nextFilePos = filePos + size;
 				
 				
-				boolean doSkip = false;
-				if (fileType == NODE_DATASET && skipNodes) doSkip = true;
-				else if (fileType == WAY_DATASET && skipWays) doSkip = true;
-				else if (fileType == REL_DATASET && skipRels) doSkip = true;
+				boolean doSkip = ((fileType == NODE_DATASET && skipNodes) 
+						|| (fileType == WAY_DATASET && skipWays)
+						|| (fileType == REL_DATASET && skipRels));
 				switch(fileType) {
 				case NODE_DATASET: 
 				case WAY_DATASET: 
@@ -456,7 +452,7 @@ public class O5mMapParser {
 		while (true) {
 			final int b = get();
 			if (b == 0)
-				return new String(cnvBuffer, 0, length, "UTF-8");
+				return new String(cnvBuffer, 0, length, StandardCharsets.UTF_8);
 			cnvBuffer[length++] = (byte) b;
 		}
 		
@@ -590,8 +586,8 @@ public class O5mMapParser {
 		return result;
 	}
 
-	public long[] getSkipArray() {
-		return firstPosInFile;
+	public long[] getNextSkipArray() {
+		return firstPosInFile; 
 	}
 	
 	/**


=====================================
src/uk/me/parabola/splitter/writer/AbstractOSMWriter.java
=====================================
@@ -36,7 +36,7 @@ public abstract class AbstractOSMWriter implements OSMWriter{
 	protected int versionMethod; 
 	
 
-	public AbstractOSMWriter(Area bounds, File outputDir, int mapId, int extra) {
+	protected AbstractOSMWriter(Area bounds, File outputDir, int mapId, int extra) {
 		this.mapId = mapId;
 		this.bounds = bounds;
 		this.outputDir = outputDir;
@@ -61,21 +61,26 @@ public abstract class AbstractOSMWriter implements OSMWriter{
 
 	}
 	
+	@Override
 	public Area getBounds() {
 		return bounds;
 	}
 	
+	@Override
 	public Area getExtendedBounds() {
 		return extendedBounds;
 	}
+	@Override
 	public int getMapId(){
 		return mapId;
 	}
 	
+	@Override
 	public Rectangle getBBox(){
 		return bbox;
 	}
 	
+	@Override
 	public void write (Element element) throws IOException {
 		if (element instanceof Node) {
 			write((Node) element);


=====================================
src/uk/me/parabola/splitter/writer/BinaryMapWriter.java
=====================================
@@ -175,6 +175,7 @@ public class BinaryMapWriter extends AbstractOSMWriter {
 
 		private class NodeGroup extends Prim<Node> implements PrimGroupWriterInterface {
 
+			@Override
 			public Osmformat.PrimitiveGroup serialize() {
 				if (useDense)
 					return serializeDense();
@@ -185,7 +186,7 @@ public class BinaryMapWriter extends AbstractOSMWriter {
 			 * Serialize all nodes in the 'dense' format.
 			 */
 			public Osmformat.PrimitiveGroup serializeDense() {
-				if (contents.size() == 0) {
+				if (contents.isEmpty()) {
 					return null;
 				}
 				// System.out.format("%d Dense ",nodes.size());
@@ -238,7 +239,7 @@ public class BinaryMapWriter extends AbstractOSMWriter {
 			 *            Add to this PrimitiveBlock.
 			 */
 			public Osmformat.PrimitiveGroup serializeNonDense() {
-				if (contents.size() == 0) {
+				if (contents.isEmpty()) {
 					return null;
 				}
 				// System.out.format("%d Nodes ",nodes.size());
@@ -269,8 +270,9 @@ public class BinaryMapWriter extends AbstractOSMWriter {
 		}
 
 		private class WayGroup extends Prim<Way> implements PrimGroupWriterInterface {
+			@Override
 			public Osmformat.PrimitiveGroup serialize() {
-				if (contents.size() == 0) {
+				if (contents.isEmpty()) {
 					return null;
 				}
 
@@ -302,6 +304,7 @@ public class BinaryMapWriter extends AbstractOSMWriter {
 		}
 
 		private class RelationGroup extends Prim<Relation> implements PrimGroupWriterInterface {
+			@Override
 			public void addStringsToStringtable() {
 				StringTable stable = serializer.getStringTable();
 				super.addStringsToStringtable();
@@ -312,8 +315,9 @@ public class BinaryMapWriter extends AbstractOSMWriter {
 				}
 			}
 
+			@Override
 			public Osmformat.PrimitiveGroup serialize() {
-				if (contents.size() == 0) {
+				if (contents.isEmpty()) {
 					return null;
 				}
 
@@ -432,7 +436,7 @@ public class BinaryMapWriter extends AbstractOSMWriter {
 				groups.add(relations);
 				relations = null;
 			} else {
-				return; // No data. Is this an empty file?
+				// No data. Is this an empty file?
 			}
 		}
 
@@ -450,6 +454,7 @@ public class BinaryMapWriter extends AbstractOSMWriter {
 		super(bounds, outputDir, mapId, extra);
 	}
 
+	@Override
 	public void initForWrite() {
 		String filename = String.format(Locale.ROOT, "%08d.osm.pbf", mapId);
 		try {
@@ -496,6 +501,7 @@ public class BinaryMapWriter extends AbstractOSMWriter {
 		headerWritten = true;
 	}
 
+	@Override
 	public void finishWrite() {
 		try {
 			serializer.switchTypes();
@@ -507,14 +513,17 @@ public class BinaryMapWriter extends AbstractOSMWriter {
 		}
 	}
 
+	@Override
 	public void write(Node node) {
 		serializer.processor.process(node);
 	}
 
+	@Override
 	public void write(Way way) {
 		serializer.processor.process(way);
 	}
 
+	@Override
 	public void write(Relation relation) {
 		serializer.processor.process(relation);
 	}


=====================================
src/uk/me/parabola/splitter/writer/O5mMapWriter.java
=====================================
@@ -18,6 +18,7 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -35,7 +36,7 @@ import uk.me.parabola.splitter.Way;
 
 /**
  * Implements the needed methods to write the result in the o5m format. 
- * The routines to are based on the osmconvert.c source from Markus Weber who allows 
+ * The routines are based on the osmconvert.c source from Markus Weber who allows 
  * to copy them for any o5m IO, thanks a lot for that. 
  *
  * @author GerdP
@@ -69,7 +70,7 @@ public class O5mMapWriter extends AbstractOSMWriter{
 	private long lastNodeId;
 	private long lastWayId;
 	private long lastRelId;
-	private long lastRef[];
+	private long[] lastRef;
 	private int lastLon,lastLat;
 	
 	private int lastWrittenDatasetType = 0;
@@ -77,22 +78,22 @@ public class O5mMapWriter extends AbstractOSMWriter{
 	// index of last entered element in string table
 	private short stw__tabi= 0; 
 	
-	  // has table; elements point to matching strings in stw__tab[];
-	  // -1: no matching element;
+	  // has table; elements point to matching strings in stw__tab[]
+	  // -1: no matching element
 	private short[] stw__hashtab;
 	  // for to chaining of string table rows which match
-	  // the same hash value; matching rows are chained in a loop;
-	  // if there is only one row matching, it will point to itself;
+	  // the same hash value; matching rows are chained in a loop
+	  // if there is only one row matching, it will point to itself
 	private short[] stw__tabprev;
 	private short[] stw__tabnext;
-	  // has value of this element as a link back to the hash table;
-	  // a -1 element indicates that the string table entry is not used; 	
+	  // has value of this element as a link back to the hash table
+	  // a -1 element indicates that the string table entry is not used 	
 	private short[] stw__tabhash;
 	
 	private byte[] numberConversionBuf;
 
-	private final static Map<String, byte[]> wellKnownTagKeys = new HashMap<>(60, 0.25f);
-	private final static Map<String, byte[]> wellKnownTagVals = new HashMap<>(20, 0.25f);
+	private static final Map<String, byte[]> wellKnownTagKeys = new HashMap<>(60, 0.25f);
+	private static final Map<String, byte[]> wellKnownTagVals = new HashMap<>(20, 0.25f);
 	
 	static {
 		try {
@@ -114,7 +115,7 @@ public class O5mMapWriter extends AbstractOSMWriter{
 						"ele", "tiger:separated", "tiger:zip_right", 
 						"yh:WIDTH", "place", "foot"
 					)) {
-				wellKnownTagKeys.put(s, s.getBytes("UTF-8"));
+				wellKnownTagKeys.put(s, s.getBytes(StandardCharsets.UTF_8));
 			}
 
 			for (String s : Arrays.asList(
@@ -122,7 +123,7 @@ public class O5mMapWriter extends AbstractOSMWriter{
 					"footway", "Bing", "PGS", "private", "stream", "service",
 					"house", "unclassified", "track", "traffic_signals","restaurant","entrance"
 					)) {
-				wellKnownTagVals.put(s, s.getBytes("UTF-8"));
+				wellKnownTagVals.put(s, s.getBytes(StandardCharsets.UTF_8));
 			}
 		} catch (Exception e) {
 			// should not happen
@@ -150,17 +151,18 @@ public class O5mMapWriter extends AbstractOSMWriter{
 		stw_reset();
 	}
 	
+	@Override
 	public void initForWrite() {
-		  // has table; elements point to matching strings in stw__tab[];
-		  // -1: no matching element;
+		  // has table; elements point to matching strings in stw__tab[]
+		  // -1: no matching element
 		stw__hashtab = new short[STW_HASH_TAB_MAX];
 		  // for to chaining of string table rows which match
-		  // the same hash value; matching rows are chained in a loop;
-		  // if there is only one row matching, it will point to itself;
+		  // the same hash value; matching rows are chained in a loop
+		  // if there is only one row matching, it will point to itself
 		stw__tabprev = new short[STW__TAB_MAX];
 		stw__tabnext = new short[STW__TAB_MAX];
-		  // has value of this element as a link back to the hash table;
-		  // a -1 element indicates that the string table entry is not used; 	
+		  // has value of this element as a link back to the hash table
+		  // a -1 element indicates that the string table entry is not used 	
 		stw__tabhash = new short[STW__TAB_MAX];
 		lastRef = new long[3];
 		numberConversionBuf = new byte[60];
@@ -202,6 +204,7 @@ public class O5mMapWriter extends AbstractOSMWriter{
 		lastWrittenDatasetType = fileType;
 	}
 
+	@Override
 	public void finishWrite() {
 		try {
 			os.write(EOD_FLAG);
@@ -238,6 +241,7 @@ public class O5mMapWriter extends AbstractOSMWriter{
 		writeDataset(NODE_DATASET,stream);
 	}
 
+	@Override
 	public void write(Way way) throws IOException {
 		if (lastWrittenDatasetType != WAY_DATASET){
 			reset();
@@ -260,6 +264,7 @@ public class O5mMapWriter extends AbstractOSMWriter{
 		writeDataset(WAY_DATASET,stream);
 	}
 
+	@Override
 	public void write(Relation rel) throws IOException {
 		if (lastWrittenDatasetType != REL_DATASET){
 			reset();
@@ -325,12 +330,12 @@ public class O5mMapWriter extends AbstractOSMWriter{
 		int ref;
 		s1Bytes = wellKnownTagKeys.get(s1);
 		if (s1Bytes == null){
-			s1Bytes = s1.getBytes("UTF-8");
+			s1Bytes = s1.getBytes(StandardCharsets.UTF_8);
 		}
 		if (s2 != null){
 			s2Bytes = wellKnownTagVals.get(s2);
 			if (s2Bytes == null){ 
-				s2Bytes= s2.getBytes("UTF-8");
+				s2Bytes= s2.getBytes(StandardCharsets.UTF_8);
 			}
 		}
 		else 
@@ -397,7 +402,7 @@ public class O5mMapWriter extends AbstractOSMWriter{
 			i = stw__hashtab[hash];
 			if(i < 0)  // no reference in hash table until now
 				stw__tabprev[stw__tabi] = stw__tabnext[stw__tabi] = stw__tabi;
-			// self-link the new element;
+			// self-link the new element
 			else {  // there is already a reference in hash table
 				// in-chain the new element
 				stw__tabnext[stw__tabi] = (short) i;
@@ -457,9 +462,8 @@ public class O5mMapWriter extends AbstractOSMWriter{
 	 * @param s1 
 	 * @return  hash value in the range 0..(STW__TAB_MAX-1) 
 	 * or -1 if the strings are longer than STW_TAB_STR_MAX bytes in total
-	 * @throws IOException 
 	 */
-	private int stw_hash(String s1, String s2) throws IOException{
+	private int stw_hash(String s1, String s2) {
 		int len = s1Bytes.length;
 		if (s2Bytes != null)
 			len += s2Bytes.length;
@@ -493,7 +497,7 @@ public class O5mMapWriter extends AbstractOSMWriter{
 	private int writeSignedNum(long num, OutputStream stream)throws IOException {
 		int cntBytes = 0;
 		  // write a long as signed varying integer.
-		  // return: bytes written;
+		  // return: bytes written
 		long u;
 		int part;
 


=====================================
src/uk/me/parabola/splitter/writer/OSMXMLWriter.java
=====================================
@@ -13,19 +13,13 @@
 
 package uk.me.parabola.splitter.writer;
 
-import it.unimi.dsi.fastutil.longs.LongArrayList;
-import uk.me.parabola.splitter.Area;
-import uk.me.parabola.splitter.Element;
-import uk.me.parabola.splitter.Node;
-import uk.me.parabola.splitter.Relation;
-import uk.me.parabola.splitter.Utils;
-import uk.me.parabola.splitter.Way;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.nio.charset.StandardCharsets;
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
 import java.util.Iterator;
@@ -33,6 +27,14 @@ import java.util.List;
 import java.util.Locale;
 import java.util.zip.GZIPOutputStream;
 
+import it.unimi.dsi.fastutil.longs.LongArrayList;
+import uk.me.parabola.splitter.Area;
+import uk.me.parabola.splitter.Element;
+import uk.me.parabola.splitter.Node;
+import uk.me.parabola.splitter.Relation;
+import uk.me.parabola.splitter.Utils;
+import uk.me.parabola.splitter.Way;
+
 public class OSMXMLWriter extends AbstractOSMWriter{
 	private final DecimalFormat numberFormat = new DecimalFormat(
 			"0.#######;-0.#######",
@@ -45,13 +47,14 @@ public class OSMXMLWriter extends AbstractOSMWriter{
 		super(bounds, outputDir, mapId, extra);
 	}
 
+	@Override
 	public void initForWrite() {
 
 		String filename = String.format(Locale.ROOT, "%08d.osm.gz", mapId);
 		try {
 			FileOutputStream fos = new FileOutputStream(new File(outputDir, filename));
 			OutputStream zos = new GZIPOutputStream(fos);
-			writer = new OutputStreamWriter(zos, "utf-8");
+			writer = new OutputStreamWriter(zos, StandardCharsets.UTF_8);
 			writeHeader();
 		} catch (IOException e) {
 			System.out.println("Could not open or write file header. Reason: " + e.getMessage());
@@ -76,6 +79,7 @@ public class OSMXMLWriter extends AbstractOSMWriter{
 		writeString("'/>\n");
 	}
 
+	@Override
 	public void finishWrite() {
 		try {
 			writeString("</osm>\n");
@@ -87,6 +91,7 @@ public class OSMXMLWriter extends AbstractOSMWriter{
 		}
 	}
 
+	@Override
 	public void write(Node node) throws IOException {
 		writeString("<node id='");
 		writeLong(node.getId());
@@ -106,6 +111,7 @@ public class OSMXMLWriter extends AbstractOSMWriter{
 
 	}
 
+	@Override
 	public void write(Way way) throws IOException {
 		writeString("<way id='");
 		writeLong(way.getId());
@@ -123,6 +129,7 @@ public class OSMXMLWriter extends AbstractOSMWriter{
 		writeString("</way>\n");
 	}
 
+	@Override
 	public void write(Relation rel) throws IOException {
 		writeString("<relation id='");
 		writeLong(rel.getId());


=====================================
test/uk/me/parabola/splitter/tools/SparseBitSetTest.java
=====================================
@@ -14,7 +14,7 @@
 package uk.me.parabola.splitter.tools;
 
 import static org.junit.Assert.assertEquals;
-import uk.me.parabola.splitter.tools.SparseBitSet;
+
 import org.junit.Test;
 
 /**



View it on GitLab: https://salsa.debian.org/debian-gis-team/mkgmap-splitter/-/commit/1f4db4eb5e1c6ea597ce4b515efd45130c043620

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/mkgmap-splitter/-/commit/1f4db4eb5e1c6ea597ce4b515efd45130c043620
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/20210601/3e36dc56/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list