-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
40 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 8 additions & 11 deletions
19
aat-lib/src/main/java/ch/bailu/aat_lib/map/tile/MapTileUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
package ch.bailu.aat_lib.map.tile | ||
|
||
import ch.bailu.aat_lib.app.AppGraphicFactory | ||
import ch.bailu.aat_lib.logger.AppLog | ||
import ch.bailu.foc.Foc | ||
import org.mapsforge.core.graphics.TileBitmap | ||
import java.io.IOException | ||
|
||
object MapTileUtil { | ||
fun load(file: Foc, size: Int, transparent: Boolean): TileBitmap? { | ||
var result: TileBitmap? = null | ||
|
||
try { | ||
file.openR()?.use { | ||
result = AppGraphicFactory.instance().createTileBitmap(it, size, transparent) | ||
result?.timestamp = file.lastModified() | ||
fun loadThrow(file: Foc, size: Int, transparent: Boolean): TileBitmap { | ||
file.openR()?.use { | ||
val result = AppGraphicFactory.instance().createTileBitmap(it, size, transparent) | ||
if (result is TileBitmap) { | ||
result.timestamp = file.lastModified() | ||
return result | ||
} | ||
} catch (e: Exception) { | ||
AppLog.e(this, e) | ||
} | ||
return result | ||
throw IOException(file.toString()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters