mirror of
https://github.com/Dasemu/NavFrame.git
synced 2026-11-26 15:26:05 +00:00
Merge pull request #9 from Dasemu/fix/gpx-route-track-pair
Fix GPX import with route stops and a detailed track
This commit is contained in:
5 files changed
+40
-15
No files matched your search
@@ -6,7 +6,7 @@ NavFrame is an experimental Android navigation app that renders its own 480×240
|
|||||||
|
|
||||||
The owner has confirmed static and synthetic NavFrame frames on a Xiaomi 11 Lite 5G NE running Android 14 and a 2026 Yamaha MT-07, and the bundled Asturias map working offline on the phone. On 2026-10-12, the owner reported that the latest version displayed the map on the TFT for about 20 minutes, then showed `Mapa no disponible` in La Corredoria (Oviedo) for the rest of the trip while the phone map continued working. An offline map was installed. The exact installed build, diagnostic code and background state were not recorded; the cause is under investigation. This establishes a successful map display followed by a persistent failure, not sustained TFT reliability.
|
The owner has confirmed static and synthetic NavFrame frames on a Xiaomi 11 Lite 5G NE running Android 14 and a 2026 Yamaha MT-07, and the bundled Asturias map working offline on the phone. On 2026-10-12, the owner reported that the latest version displayed the map on the TFT for about 20 minutes, then showed `Mapa no disponible` in La Corredoria (Oviedo) for the rest of the trip while the phone map continued working. An offline map was installed. The exact installed build, diagnostic code and background state were not recorded; the cause is under investigation. This establishes a successful map display followed by a persistent failure, not sustained TFT reliability.
|
||||||
|
|
||||||
The current checkout is version 0.13.5. The 0.13 series adds voice/routing language selection for Spanish, English, German, French, and Italian, plus a system-language option; unsupported system locales resolve to English. Speech still depends on the Android TextToSpeech engine and its installed voice data. The app includes offline map and place data for Asturias, plus installable regional packages. Worldwide regions can be discovered and built on demand through the [regional package workflow](docs/GLOBAL_OFFLINE.md); this is not complete worldwide coverage. Installed packages currently provide map and local place/camera data. Offline route calculation, global camera completeness, and complete worldwide font coverage are not provided.
|
The current checkout is version 0.13.6. The 0.13 series adds voice/routing language selection for Spanish, English, German, French, and Italian, plus a system-language option; unsupported system locales resolve to English. Speech still depends on the Android TextToSpeech engine and its installed voice data. The app includes offline map and place data for Asturias, plus installable regional packages. Worldwide regions can be discovered and built on demand through the [regional package workflow](docs/GLOBAL_OFFLINE.md); this is not complete worldwide coverage. Installed packages currently provide map and local place/camera data. Offline route calculation, global camera completeness, and complete worldwide font coverage are not provided.
|
||||||
|
|
||||||
Route calculation and address search use configurable online services. Spoken output uses the selected language when Android provides voice data; voice availability and offline behavior depend on the device's TextToSpeech engine. Physical validation of route guidance, voice playback, camera alerts, sustained TFT map rendering, and a 30-minute screen-off session remains pending unless a newer test report says otherwise.
|
Route calculation and address search use configurable online services. Spoken output uses the selected language when Android provides voice data; voice availability and offline behavior depend on the device's TextToSpeech engine. Physical validation of route guidance, voice playback, camera alerts, sustained TFT map rendering, and a 30-minute screen-off session remains pending unless a newer test report says otherwise.
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ android {
|
|||||||
applicationId = "dev.navframe.app"
|
applicationId = "dev.navframe.app"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionName = "0.13.5"
|
versionName = "0.13.6"
|
||||||
versionCode = 21
|
versionCode = 22
|
||||||
}
|
}
|
||||||
if (hasReleaseSigning) {
|
if (hasReleaseSigning) {
|
||||||
signingConfigs.create("production") {
|
signingConfigs.create("production") {
|
||||||
|
|||||||
@@ -56,11 +56,16 @@ object GpxRouteImporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class Handler : DefaultHandler2() {
|
private class Handler : DefaultHandler2() {
|
||||||
val points = mutableListOf<GeoPoint>()
|
private val routePoints = mutableListOf<GeoPoint>()
|
||||||
var name: String? = null
|
private val trackPoints = mutableListOf<GeoPoint>()
|
||||||
|
private var routeName: String? = null
|
||||||
|
private var trackName: String? = null
|
||||||
|
val points: List<GeoPoint> get() = if (tracks > 0) trackPoints else routePoints
|
||||||
|
val name: String? get() = if (tracks > 0) trackName else routeName
|
||||||
private val path = mutableListOf<String>()
|
private val path = mutableListOf<String>()
|
||||||
private var rootNamespace = ""
|
private var rootNamespace = ""
|
||||||
private var candidates = 0
|
private var routes = 0
|
||||||
|
private var tracks = 0
|
||||||
private var nonemptySegments = 0
|
private var nonemptySegments = 0
|
||||||
private var segmentPoints = 0
|
private var segmentPoints = 0
|
||||||
private var nameText: StringBuilder? = null
|
private var nameText: StringBuilder? = null
|
||||||
@@ -77,18 +82,20 @@ object GpxRouteImporter {
|
|||||||
val route = path == listOf("gpx", "rte")
|
val route = path == listOf("gpx", "rte")
|
||||||
val track = path == listOf("gpx", "trk")
|
val track = path == listOf("gpx", "trk")
|
||||||
if (route || track) {
|
if (route || track) {
|
||||||
candidates++
|
if (route) routes++ else tracks++
|
||||||
if (candidates > 1) fail("El GPX contiene varias rutas o tracks. Exporta solo la ruta que quieras seguir.")
|
if (routes > 1 || tracks > 1) fail("El GPX contiene varias rutas o tracks. Exporta solo la ruta que quieras seguir.")
|
||||||
}
|
}
|
||||||
if (path == listOf("gpx", "trk", "trkseg")) segmentPoints = 0
|
if (path == listOf("gpx", "trk", "trkseg")) segmentPoints = 0
|
||||||
if (path == listOf("gpx", "rte", "name") || path == listOf("gpx", "trk", "name")) nameText = StringBuilder()
|
if (path == listOf("gpx", "rte", "name") || path == listOf("gpx", "trk", "name")) nameText = StringBuilder()
|
||||||
if (path == listOf("gpx", "rte", "rtept") || path == listOf("gpx", "trk", "trkseg", "trkpt")) {
|
if (path == listOf("gpx", "rte", "rtept") || path == listOf("gpx", "trk", "trkseg", "trkpt")) {
|
||||||
if (points.size >= MAX_POINTS) fail("El GPX supera los 10000 puntos. Simplifica la ruta antes de importarla.")
|
if (routePoints.size + trackPoints.size >= MAX_POINTS) fail("El GPX supera los 10000 puntos. Simplifica la ruta antes de importarla.")
|
||||||
val lat = attributes.getValue("lat")?.toDoubleOrNull()
|
val lat = attributes.getValue("lat")?.toDoubleOrNull()
|
||||||
val lon = attributes.getValue("lon")?.toDoubleOrNull()
|
val lon = attributes.getValue("lon")?.toDoubleOrNull()
|
||||||
if (lat == null || lon == null || !lat.isFinite() || !lon.isFinite() || lat !in -90.0..90.0 || lon !in -180.0..180.0) fail("El GPX contiene coordenadas inválidas.")
|
if (lat == null || lon == null || !lat.isFinite() || !lon.isFinite() || lat !in -90.0..90.0 || lon !in -180.0..180.0) fail("El GPX contiene coordenadas inválidas.")
|
||||||
points.add(GeoPoint(lat, lon))
|
if (path[1] == "trk") {
|
||||||
if (path[1] == "trk") segmentPoints++
|
trackPoints.add(GeoPoint(lat, lon))
|
||||||
|
segmentPoints++
|
||||||
|
} else routePoints.add(GeoPoint(lat, lon))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
override fun characters(ch: CharArray, start: Int, length: Int) {
|
override fun characters(ch: CharArray, start: Int, length: Int) {
|
||||||
@@ -97,7 +104,10 @@ object GpxRouteImporter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
override fun endElement(uri: String, localName: String, qName: String) {
|
override fun endElement(uri: String, localName: String, qName: String) {
|
||||||
if (path == listOf("gpx", "rte", "name") || path == listOf("gpx", "trk", "name")) { name = nameText?.toString(); nameText = null }
|
if (path == listOf("gpx", "rte", "name") || path == listOf("gpx", "trk", "name")) {
|
||||||
|
if (path[1] == "trk") trackName = nameText?.toString() else routeName = nameText?.toString()
|
||||||
|
nameText = null
|
||||||
|
}
|
||||||
if (path == listOf("gpx", "trk", "trkseg") && segmentPoints > 0) {
|
if (path == listOf("gpx", "trk", "trkseg") && segmentPoints > 0) {
|
||||||
nonemptySegments++
|
nonemptySegments++
|
||||||
if (nonemptySegments > 1) fail("El GPX contiene varios segmentos separados. Exporta un solo segmento continuo.")
|
if (nonemptySegments > 1) fail("El GPX contiene varios segmentos separados. Exporta un solo segmento continuo.")
|
||||||
|
|||||||
@@ -36,10 +36,25 @@ class GpxRouteImporterTest {
|
|||||||
}
|
}
|
||||||
@Test fun `rejects multiple candidates and disconnected segments`() {
|
@Test fun `rejects multiple candidates and disconnected segments`() {
|
||||||
rejected("<gpx><rte>$points</rte><rte>$points</rte></gpx>", "varias")
|
rejected("<gpx><rte>$points</rte><rte>$points</rte></gpx>", "varias")
|
||||||
rejected("<gpx><rte>$points</rte><trk/></gpx>", "varias")
|
rejected("<gpx><rte>$points</rte><trk/></gpx>")
|
||||||
|
rejected("<gpx><trk/><trk/></gpx>", "varias")
|
||||||
val segment = "<trkseg>${points.replace("rtept", "trkpt")}</trkseg>"
|
val segment = "<trkseg>${points.replace("rtept", "trkpt")}</trkseg>"
|
||||||
rejected("<gpx><trk>$segment$segment</trk></gpx>", "segmentos")
|
rejected("<gpx><trk>$segment$segment</trk></gpx>", "segmentos")
|
||||||
}
|
}
|
||||||
|
@Test fun `route stop list with a detailed track follows only the track in either order`() {
|
||||||
|
val stops = "<rte><name>Stops</name>$points</rte>"
|
||||||
|
val trace = "<trk><name>Detailed trace</name><trkseg><trkpt lat=\"43\" lon=\"-5\"/><trkpt lat=\"43.0005\" lon=\"-5.001\"/><trkpt lat=\"43.001\" lon=\"-5\"/></trkseg></trk>"
|
||||||
|
for (body in listOf(stops + trace, trace + stops)) {
|
||||||
|
val result = parse("<gpx>$body</gpx>")
|
||||||
|
assertEquals("Detailed trace", result.name)
|
||||||
|
assertEquals(3, result.route.geometry.size)
|
||||||
|
assertEquals(GeoPoint(43.0005, -5.001), result.route.geometry[1])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Test fun `route and track share the point budget`() {
|
||||||
|
val stops = "<rte>" + "<rtept lat=\"1\" lon=\"1\"/>".repeat(GpxRouteImporter.MAX_POINTS) + "</rte>"
|
||||||
|
rejected("<gpx>$stops<trk><trkseg><trkpt lat=\"1\" lon=\"1\"/></trkseg></trk></gpx>", "10000")
|
||||||
|
}
|
||||||
@Test fun `rejects DTD internal and external entities`() {
|
@Test fun `rejects DTD internal and external entities`() {
|
||||||
rejected("<!DOCTYPE gpx [<!ENTITY name 'expanded'>]><gpx><rte><name>&name;</name>$points</rte></gpx>")
|
rejected("<!DOCTYPE gpx [<!ENTITY name 'expanded'>]><gpx><rte><name>&name;</name>$points</rte></gpx>")
|
||||||
rejected("<!DOCTYPE gpx SYSTEM 'file:///etc/passwd'><gpx><rte>$points</rte></gpx>")
|
rejected("<!DOCTYPE gpx SYSTEM 'file:///etc/passwd'><gpx><rte>$points</rte></gpx>")
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ Precise location permission is required to start navigation. If a recent fix wit
|
|||||||
|
|
||||||
## Supported files
|
## Supported files
|
||||||
|
|
||||||
GPX 1.0 and 1.1 routes (`rte/rtept`) and tracks (`trk/trkseg/trkpt`) are supported, including GPX files without a namespace. Export exactly one route or one track containing a single nonempty continuous segment. Multiple routes, tracks or nonempty segments are rejected: the app must not create a fictitious connection between separate tracks. Waypoints alone do not define a route.
|
GPX 1.0 and 1.1 routes (`rte/rtept`) and tracks (`trk/trkseg/trkpt`) are supported, including GPX files without a namespace. Export one route or one track containing a single nonempty continuous segment. A file containing one route plus one track is also supported: the track supplies the detailed geometry and its name; route stops are not connected or added to the trace. An empty or invalid track is rejected rather than silently following the route stops. Multiple routes, multiple tracks or multiple nonempty segments are rejected: the app must not create a fictitious connection between separate tracks. Waypoints alone do not define a route.
|
||||||
|
|
||||||
Files are limited to 5 MiB, 10,000 trace points and 64 XML nesting levels. Coordinates must be finite and within latitude/longitude bounds, with at least two distinct points. DTD declarations and external entities are rejected. Route names are capped at 256 characters. An invalid or inaccessible file leaves any running navigation untouched.
|
Files are limited to 5 MiB, 10,000 total route and track points and 64 XML nesting levels. Coordinates must be finite and within latitude/longitude bounds, with at least two distinct points. DTD declarations and external entities are rejected. Route names are capped at 256 characters. An invalid or inaccessible file leaves any running navigation untouched.
|
||||||
|
|
||||||
## Following a trace
|
## Following a trace
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user