fix: GeometryBuffer.getNumPoints()
This commit is contained in:
parent
3896358ba8
commit
733d9dac96
@ -384,7 +384,7 @@ public class TileDecoder extends PbfDecoder {
|
||||
return coordCnt;
|
||||
}
|
||||
|
||||
@Override
|
||||
//@Override
|
||||
protected int decodeInterleavedPoints(float[] coords, float scale)
|
||||
throws IOException {
|
||||
|
||||
|
@ -229,7 +229,7 @@ public class OSciMap2TileSource extends UrlTileSource {
|
||||
}
|
||||
|
||||
mElem.ensurePointSize(coordCnt, false);
|
||||
int cnt = decodeInterleavedPoints(mElem.points, mScale);
|
||||
int cnt = decodeInterleavedPoints(mElem, mScale);
|
||||
|
||||
if (cnt != coordCnt) {
|
||||
log.debug(mTile + " wrong number of coordintes");
|
||||
|
@ -98,7 +98,7 @@ public class GeometryBuffer {
|
||||
}
|
||||
|
||||
public int getNumPoints() {
|
||||
return index[0] >> 1;
|
||||
return pointPos >> 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,7 @@ package org.oscim.tiling.source.common;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.tiling.source.ITileDecoder;
|
||||
import org.oscim.utils.UTF8Decoder;
|
||||
import org.slf4j.Logger;
|
||||
@ -187,9 +188,10 @@ public abstract class PbfDecoder implements ITileDecoder {
|
||||
return buffer[bufferPos++] != 0;
|
||||
}
|
||||
|
||||
protected int decodeInterleavedPoints(float[] coords, float scale)
|
||||
protected int decodeInterleavedPoints(GeometryBuffer geom, float scale)
|
||||
throws IOException {
|
||||
|
||||
float[] points = geom.points;
|
||||
int bytes = decodeVarint32();
|
||||
fillBuffer(bytes);
|
||||
|
||||
@ -229,11 +231,11 @@ public abstract class PbfDecoder implements ITileDecoder {
|
||||
|
||||
if (even) {
|
||||
lastX = lastX + s;
|
||||
coords[cnt++] = lastX / scale;
|
||||
points[cnt++] = lastX / scale;
|
||||
even = false;
|
||||
} else {
|
||||
lastY = lastY + s;
|
||||
coords[cnt++] = lastY / scale;
|
||||
points[cnt++] = lastY / scale;
|
||||
even = true;
|
||||
}
|
||||
}
|
||||
@ -243,6 +245,8 @@ public abstract class PbfDecoder implements ITileDecoder {
|
||||
|
||||
bufferPos = pos;
|
||||
|
||||
geom.pointPos = cnt;
|
||||
|
||||
// return number of points read
|
||||
return (cnt >> 1);
|
||||
}
|
||||
|
@ -298,8 +298,7 @@ public class TileDecoder extends PbfDecoder {
|
||||
}
|
||||
|
||||
mElem.ensurePointSize(coordCnt, false);
|
||||
int cnt = decodeInterleavedPoints(mElem.points,
|
||||
mScaleFactor);
|
||||
int cnt = decodeInterleavedPoints(mElem, mScaleFactor);
|
||||
|
||||
if (cnt != coordCnt) {
|
||||
log.debug("{} wrong number of coordintes {}/{}", mTile,
|
||||
|
Loading…
x
Reference in New Issue
Block a user