Mapsforge maps v5 support improvements #429
This commit is contained in:
parent
cd5a62a2ff
commit
a9a042ea41
@ -25,7 +25,6 @@ import org.oscim.utils.Parameters;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -41,6 +40,8 @@ public class ReadBuffer {
|
|||||||
private int mBufferPosition;
|
private int mBufferPosition;
|
||||||
private final RandomAccessFile mInputFile;
|
private final RandomAccessFile mInputFile;
|
||||||
|
|
||||||
|
private final List<Integer> mTagIds = new ArrayList<>();
|
||||||
|
|
||||||
ReadBuffer(RandomAccessFile inputFile) {
|
ReadBuffer(RandomAccessFile inputFile) {
|
||||||
mInputFile = inputFile;
|
mInputFile = inputFile;
|
||||||
}
|
}
|
||||||
@ -56,14 +57,13 @@ public class ReadBuffer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts four bytes from the read buffer to a float.
|
* Converts four bytes from the read buffer to a float.
|
||||||
|
* <p/>
|
||||||
|
* The byte order is big-endian.
|
||||||
*
|
*
|
||||||
* @return the float value.
|
* @return the float value.
|
||||||
*/
|
*/
|
||||||
public float readFloat() {
|
public float readFloat() {
|
||||||
byte[] bytes = new byte[4];
|
return Float.intBitsToFloat(readInt());
|
||||||
System.arraycopy(mBufferData, mBufferPosition, bytes, 0, 4);
|
|
||||||
mBufferPosition += 4;
|
|
||||||
return ByteBuffer.wrap(bytes).getFloat();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -408,11 +408,11 @@ public class ReadBuffer {
|
|||||||
mBufferPosition += bytes;
|
mBufferPosition += bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean readTags(TagSet tags, Tag[] wayTags, byte numberOfTags) {
|
boolean readTags(TagSet tags, Tag[] tagsArray, byte numberOfTags) {
|
||||||
tags.clear();
|
tags.clear();
|
||||||
List<Integer> ids = new ArrayList<>();
|
mTagIds.clear();
|
||||||
|
|
||||||
int maxTag = wayTags.length;
|
int maxTag = tagsArray.length;
|
||||||
|
|
||||||
for (byte i = 0; i < numberOfTags; i++) {
|
for (byte i = 0; i < numberOfTags; i++) {
|
||||||
int tagId = readUnsignedInt();
|
int tagId = readUnsignedInt();
|
||||||
@ -420,11 +420,11 @@ public class ReadBuffer {
|
|||||||
LOG.warning("invalid tag ID: " + tagId);
|
LOG.warning("invalid tag ID: " + tagId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ids.add(tagId);
|
mTagIds.add(tagId);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Integer id : ids) {
|
for (int tagId : mTagIds) {
|
||||||
Tag tag = wayTags[id];
|
Tag tag = tagsArray[tagId];
|
||||||
// Decode variable values of tags
|
// Decode variable values of tags
|
||||||
if (tag.value.charAt(0) == '%' && tag.value.length() == 2) {
|
if (tag.value.charAt(0) == '%' && tag.value.length() == 2) {
|
||||||
String value = tag.value;
|
String value = tag.value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user