read elevation type from rd5
This commit is contained in:
parent
477c675d46
commit
16d019c1d0
3 changed files with 26 additions and 0 deletions
|
@ -385,4 +385,20 @@ public final class NodesCache {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getElevationType(int ilon, int ilat) {
|
||||
int lonDegree = ilon / 1000000;
|
||||
int latDegree = ilat / 1000000;
|
||||
OsmFile[] fileRow = fileRows[latDegree];
|
||||
int ndegrees = fileRow == null ? 0 : fileRow.length;
|
||||
for (int i = 0; i < ndegrees; i++) {
|
||||
if (fileRow[i].lonDegree == lonDegree) {
|
||||
OsmFile osmf = fileRow[i];
|
||||
if (osmf != null) return osmf.elevationType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ final class OsmFile {
|
|||
private int cellsize;
|
||||
private int ncaches;
|
||||
private int indexsize;
|
||||
protected byte elevationType = 3;
|
||||
|
||||
public OsmFile(PhysicalFile rafile, int lonDegree, int latDegree, DataBuffers dataBuffers) throws IOException {
|
||||
this.lonDegree = lonDegree;
|
||||
|
@ -43,6 +44,7 @@ final class OsmFile {
|
|||
|
||||
if (rafile != null) {
|
||||
divisor = rafile.divisor;
|
||||
elevationType = rafile.elevationType;
|
||||
|
||||
cellsize = 1000000 / divisor;
|
||||
ncaches = divisor * divisor;
|
||||
|
|
|
@ -24,6 +24,7 @@ final public class PhysicalFile {
|
|||
String fileName;
|
||||
|
||||
public int divisor = 80;
|
||||
public byte elevationType = 3;
|
||||
|
||||
public static void main(String[] args) {
|
||||
MicroCache.debug = true;
|
||||
|
@ -113,6 +114,10 @@ final public class PhysicalFile {
|
|||
|
||||
if (len == pos) return; // old format o.k.
|
||||
|
||||
if ((len-pos) > extraLen) {
|
||||
extraLen++;
|
||||
}
|
||||
|
||||
if (len < pos + extraLen) { // > is o.k. for future extensions!
|
||||
throw new IOException("file of size " + len + " too short, should be " + (pos + extraLen));
|
||||
}
|
||||
|
@ -134,5 +139,8 @@ final public class PhysicalFile {
|
|||
for (int i = 0; i < 25; i++) {
|
||||
fileHeaderCrcs[i] = dis.readInt();
|
||||
}
|
||||
try {
|
||||
elevationType = dis.readByte();
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue