Merge branch 'release/1.9'
This commit is contained in:
commit
5cd28903a8
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<artifactId>GpxAndroidSdk</artifactId>
|
<artifactId>GpxAndroidSdk</artifactId>
|
||||||
<groupId>me.bvn13.sdk.android.gpx</groupId>
|
<groupId>me.bvn13.sdk.android.gpx</groupId>
|
||||||
<version>1.8</version>
|
<version>1.9</version>
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ class GpxReader {
|
|||||||
throw IllegalArgumentException("Not a tag at position ${buffer.position}")
|
throw IllegalArgumentException("Not a tag at position ${buffer.position}")
|
||||||
}
|
}
|
||||||
var container = readUntil(dis, buffer, setOf(' ', '\n', '>'))
|
var container = readUntil(dis, buffer, setOf(' ', '\n', '>'))
|
||||||
val tagName = container.buffer.asString().substring(1, container.buffer.size - 1).lowercase()
|
val tagName = container.buffer.asString().substring(1, container.buffer.size - 1)
|
||||||
checker?.invoke(container)
|
checker?.invoke(container)
|
||||||
val xmlObject = XmlObject(tagName)
|
val xmlObject = XmlObject(tagName)
|
||||||
if (container.byte!!.toInt() != '>'.code) {
|
if (container.byte!!.toInt() != '>'.code) {
|
||||||
@ -406,7 +406,7 @@ class GpxReader {
|
|||||||
var value: String? = null
|
var value: String? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
this.type = type.lowercase()
|
this.type = type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ class GpxReaderTest {
|
|||||||
assertEquals(gpxType, gpx)
|
assertEquals(gpxType, gpx)
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("Read test.gpx (generated in OsmAnd Android application")
|
@DisplayName("Read test.gpx (generated in OsmAnd Android application)")
|
||||||
@Test
|
@Test
|
||||||
fun readTestGpx() {
|
fun readTestGpx() {
|
||||||
val gpxType = GpxType.read(javaClass.classLoader.getResource("test.gpx").openStream())
|
val gpxType = GpxType.read(javaClass.classLoader.getResource("test.gpx").openStream())
|
||||||
@ -422,4 +422,12 @@ class GpxReaderTest {
|
|||||||
Assertions.assertEquals(159, gpxType.trk?.get(0)?.trkseg?.get(0)?.extensions?.nested?.get(1)?.nested?.size ?: 0)
|
Assertions.assertEquals(159, gpxType.trk?.get(0)?.trkseg?.get(0)?.extensions?.nested?.get(1)?.nested?.size ?: 0)
|
||||||
Assertions.assertEquals(1, gpxType.extensions?.nested?.size ?: 0)
|
Assertions.assertEquals(1, gpxType.extensions?.nested?.size ?: 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DisplayName("Read track-2023-03-01--21-21-54.gpx")
|
||||||
|
@Test
|
||||||
|
fun readTestGpx_v_1_9() {
|
||||||
|
val gpxType = GpxType.read(javaClass.classLoader.getResource("track-2023-03-01--21-21-54.gpx").openStream())
|
||||||
|
Assertions.assertEquals(20, gpxType.trk?.get(0)?.trkseg?.get(0)?.trkpt?.size ?: 0)
|
||||||
|
Assertions.assertEquals(4, gpxType.trk?.get(0)?.trkseg?.get(0)?.trkpt?.get(0)?.extensions?.size ?: 0)
|
||||||
|
}
|
||||||
}
|
}
|
221
src/test/resources/track-2023-03-01--21-21-54.gpx
Normal file
221
src/test/resources/track-2023-03-01--21-21-54.gpx
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<gpx
|
||||||
|
xmlns="http://www.topografix.com/GPX/1/1"
|
||||||
|
version="1.1"
|
||||||
|
creator="me.bvn13.sdk.android.gpx"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
|
||||||
|
<time>2023-03-01T21:22:03.369+03:00</time>
|
||||||
|
<metadata>
|
||||||
|
<name>2023-03-01T21:22:02.89</name>
|
||||||
|
<desc></desc>
|
||||||
|
<author>
|
||||||
|
<name></name>
|
||||||
|
</author>
|
||||||
|
</metadata>
|
||||||
|
<trk>
|
||||||
|
<name>Track 1</name>
|
||||||
|
<TRKSEG>
|
||||||
|
<trkpt lat="55.8819464" lon="37.637977">
|
||||||
|
<ele>169.1999969482422</ele>
|
||||||
|
<time>7592-05-31T11:41:07+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0133984</speed>
|
||||||
|
<timeNanos>177426232867134</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8819464" lon="37.637977">
|
||||||
|
<ele>169.1999969482422</ele>
|
||||||
|
<time>7592-05-31T11:41:07+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0133984</speed>
|
||||||
|
<timeNanos>177426232867134</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8819464" lon="37.637977">
|
||||||
|
<ele>169.1999969482422</ele>
|
||||||
|
<time>7592-05-31T11:41:07+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0133984</speed>
|
||||||
|
<timeNanos>177426232867134</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8819464" lon="37.637977">
|
||||||
|
<ele>169.1999969482422</ele>
|
||||||
|
<time>7592-05-31T11:41:07+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0133984</speed>
|
||||||
|
<timeNanos>177426232867134</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8819464" lon="37.637977">
|
||||||
|
<ele>169.1999969482422</ele>
|
||||||
|
<time>7592-05-31T11:41:07+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0133984</speed>
|
||||||
|
<timeNanos>177426232867134</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8819588" lon="37.6375427">
|
||||||
|
<ele>170.39999389648438</ele>
|
||||||
|
<time>7592-12-14T07:05:54+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0500889</speed>
|
||||||
|
<timeNanos>177443237154632</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8819588" lon="37.6375427">
|
||||||
|
<ele>170.39999389648438</ele>
|
||||||
|
<time>7592-12-14T07:05:54+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0500889</speed>
|
||||||
|
<timeNanos>177443237154632</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8819588" lon="37.6375427">
|
||||||
|
<ele>170.39999389648438</ele>
|
||||||
|
<time>7592-12-14T07:05:54+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0500889</speed>
|
||||||
|
<timeNanos>177443237154632</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8819588" lon="37.6375427">
|
||||||
|
<ele>170.39999389648438</ele>
|
||||||
|
<time>7592-12-14T07:05:54+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0500889</speed>
|
||||||
|
<timeNanos>177443237154632</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8819588" lon="37.6375427">
|
||||||
|
<ele>170.39999389648438</ele>
|
||||||
|
<time>7592-12-14T07:05:54+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0500889</speed>
|
||||||
|
<timeNanos>177443237154632</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8820349" lon="37.6369261">
|
||||||
|
<ele>170.39999389648438</ele>
|
||||||
|
<time>7593-12-31T05:02:57+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0334443</speed>
|
||||||
|
<timeNanos>177476234577543</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8820349" lon="37.6369261">
|
||||||
|
<ele>170.39999389648438</ele>
|
||||||
|
<time>7593-12-31T05:02:57+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0334443</speed>
|
||||||
|
<timeNanos>177476234577543</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8820349" lon="37.6369261">
|
||||||
|
<ele>170.39999389648438</ele>
|
||||||
|
<time>7593-12-31T05:02:57+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0334443</speed>
|
||||||
|
<timeNanos>177476234577543</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8820349" lon="37.6369261">
|
||||||
|
<ele>170.39999389648438</ele>
|
||||||
|
<time>7593-12-31T05:02:57+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0334443</speed>
|
||||||
|
<timeNanos>177476234577543</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8820349" lon="37.6369261">
|
||||||
|
<ele>170.39999389648438</ele>
|
||||||
|
<time>7593-12-31T05:02:57+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>1.0334443</speed>
|
||||||
|
<timeNanos>177476234577543</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8821806" lon="37.6368125">
|
||||||
|
<ele>170.6999969482422</ele>
|
||||||
|
<time>7594-07-27T10:48:08+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>0.123607546</speed>
|
||||||
|
<timeNanos>177494226488478</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8821806" lon="37.6368125">
|
||||||
|
<ele>170.6999969482422</ele>
|
||||||
|
<time>7594-07-27T10:48:08+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>0.123607546</speed>
|
||||||
|
<timeNanos>177494226488478</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8821806" lon="37.6368125">
|
||||||
|
<ele>170.6999969482422</ele>
|
||||||
|
<time>7594-07-27T10:48:08+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>0.123607546</speed>
|
||||||
|
<timeNanos>177494226488478</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8821806" lon="37.6368125">
|
||||||
|
<ele>170.6999969482422</ele>
|
||||||
|
<time>7594-07-27T10:48:08+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>0.123607546</speed>
|
||||||
|
<timeNanos>177494226488478</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
<trkpt lat="55.8821806" lon="37.6368125">
|
||||||
|
<ele>170.6999969482422</ele>
|
||||||
|
<time>7594-07-27T10:48:08+03:00</time>
|
||||||
|
<extensions>
|
||||||
|
<speed>0.123607546</speed>
|
||||||
|
<timeNanos>177494226488478</timeNanos>
|
||||||
|
<speedAccuracyMetersPerSecond>0.15</speedAccuracyMetersPerSecond>
|
||||||
|
<degrees>5.0</degrees>
|
||||||
|
</extensions>
|
||||||
|
</trkpt>
|
||||||
|
</TRKSEG>
|
||||||
|
</trk>
|
||||||
|
</gpx>
|
Loading…
Reference in New Issue
Block a user