Fixed map loading
This commit is contained in:
parent
3d39d29608
commit
3a05a71f7f
2 changed files with 8 additions and 8 deletions
|
|
@ -175,7 +175,7 @@ fun MapCanvas(
|
||||||
}
|
}
|
||||||
|
|
||||||
val crossRadius = 24F
|
val crossRadius = 24F
|
||||||
drawCursor(halvedX, halvedY, crossRadius, KhmParser.getHeight(lon, lat, ctx), textMeasurer)
|
drawCursor(halvedX, halvedY, crossRadius, height, textMeasurer)
|
||||||
|
|
||||||
val additionalSize = if (debug) 96F else 0F
|
val additionalSize = if (debug) 96F else 0F
|
||||||
val infoBoxSize = Size(216F, 96F + additionalSize)
|
val infoBoxSize = Size(216F, 96F + additionalSize)
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,15 @@ class KhmParser {
|
||||||
|
|
||||||
fun load(filePath: String, ctx: Context) {
|
fun load(filePath: String, ctx: Context) {
|
||||||
if (fileExists(ctx)) {
|
if (fileExists(ctx)) {
|
||||||
return
|
clear(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
val inp = FileInputStream(filePath)
|
val inp = FileInputStream(filePath)
|
||||||
|
|
||||||
if (checkHeader(inp))
|
|
||||||
ctx.openFileOutput(HEIGHT_FILE, Context.MODE_PRIVATE).use {
|
ctx.openFileOutput(HEIGHT_FILE, Context.MODE_PRIVATE).use {
|
||||||
it.write(inp.readBytes())
|
it.write(inp.readBytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
inp.close()
|
inp.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,7 +93,7 @@ class KhmParser {
|
||||||
|
|
||||||
fun getHeight(lon: Float, lat: Float, ctx: Context): UShort {
|
fun getHeight(lon: Float, lat: Float, ctx: Context): UShort {
|
||||||
if (!fileExists(ctx))
|
if (!fileExists(ctx))
|
||||||
return 0u.toUShort()
|
return 0u
|
||||||
val dis = DataInputStream(ctx.openFileInput(HEIGHT_FILE))
|
val dis = DataInputStream(ctx.openFileInput(HEIGHT_FILE))
|
||||||
dis.use {
|
dis.use {
|
||||||
val header = readHeader(dis)
|
val header = readHeader(dis)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue