Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Aug 25, 2016
2 parents 47fdaac + c58c667 commit f7a7ecf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 36 deletions.
Expand Up @@ -330,12 +330,13 @@ private void setHeading(WptType wptType, Double heading) {

// this is if I create the extensions with JAXB
if (any instanceof JAXBElement) {
JAXBElement<String> element = asJABElement(any);
if ("course".equals(element.getName().getLocalPart())) {
Object anyValue = ((JAXBElement) any).getValue();
if (anyValue instanceof TrackPointExtensionT) {
if (foundHeading || heading == null)
iterator.remove();
else {
element.setValue(formatHeadingAsString(heading));
TrackPointExtensionT trackPoint = (TrackPointExtensionT) anyValue;
trackPoint.setCourse(formatHeading(heading));
foundHeading = true;
}
}
Expand Down Expand Up @@ -407,12 +408,13 @@ private void setTemperature(WptType wptType, Double temperature) {

// this is if I create the extensions with JAXB
if (any instanceof JAXBElement) {
JAXBElement<String> element = asJABElement(any);
if ("atemp".equals(element.getName().getLocalPart())) {
Object anyValue = ((JAXBElement) any).getValue();
if (anyValue instanceof TrackPointExtensionT) {
if (foundTemperature || temperature == null)
iterator.remove();
else {
element.setValue(formatTemperatureAsString(temperature));
TrackPointExtensionT trackPoint = (TrackPointExtensionT) anyValue;
trackPoint.setAtemp(temperature);
foundTemperature = true;
}
}
Expand Down
Expand Up @@ -21,7 +21,6 @@
package slash.navigation.gpx;

import org.junit.Test;
import org.w3c.dom.Element;
import slash.navigation.base.ParserResult;
import slash.navigation.base.ReadWriteTestCallback;
import slash.navigation.base.Wgs84Position;
Expand Down Expand Up @@ -275,25 +274,6 @@ else if ("Waypoint".equals(wptType.getSym()))
assertEquals("http://wpt", wptType.getLink().get(0).getHref());
}

private void checkSpeedExtension(WptType wptType) {
assertNotNull(wptType.getExtensions().getAny());
assertEquals(2, wptType.getExtensions().getAny().size());
Element course = (Element) wptType.getExtensions().getAny().get(0);
assertEquals("course", course.getLocalName());
assertEquals("86.8", course.getTextContent());
Element speed = (Element) wptType.getExtensions().getAny().get(1);
assertEquals("speed", speed.getLocalName());
assertEquals("22.75", speed.getTextContent());
}

private void checkTemperatureExtension(WptType wptType) {
assertNotNull(wptType.getExtensions().getAny());
assertEquals(2, wptType.getExtensions().getAny().size());
Element course = (Element) wptType.getExtensions().getAny().get(0);
assertEquals("atemp", course.getLocalName());
assertEquals("26.0", course.getTextContent());
}

@Test
public void testGpx11Roundtrip() throws IOException {
readWriteRoundtrip(TEST_PATH + "from11.gpx", new ReadWriteTestCallback() {
Expand Down Expand Up @@ -353,8 +333,6 @@ public void test(ParserResult source, ParserResult target) {
GpxPosition sourceWaypoint = sourceWaypoints.getPosition(0);
assertNotNull(sourceWaypoint.getOrigin());
checkUnprocessed(sourceWaypoint.getOrigin(WptType.class));
checkSpeedExtension(sourceWaypoint.getOrigin(WptType.class));
checkTemperatureExtension(sourceWaypoint.getOrigin(WptType.class));

GpxRoute sourceTrack = (GpxRoute) source.getAllRoutes().get(1);
assertNotNull(sourceTrack.getOrigins());
Expand All @@ -364,8 +342,6 @@ public void test(ParserResult source, ParserResult target) {
GpxPosition sourceTrackPoint = sourceTrack.getPosition(0);
assertNotNull(sourceTrackPoint.getOrigin());
checkUnprocessed(sourceTrackPoint.getOrigin(WptType.class));
checkSpeedExtension(sourceTrackPoint.getOrigin(WptType.class));
checkTemperatureExtension(sourceTrackPoint.getOrigin(WptType.class));

GpxRoute targetWaypoints = (GpxRoute) source.getAllRoutes().get(0);
assertNotNull(targetWaypoints.getOrigins());
Expand All @@ -374,8 +350,6 @@ public void test(ParserResult source, ParserResult target) {
GpxPosition targetWaypoint = targetWaypoints.getPosition(0);
assertNotNull(targetWaypoint.getOrigin());
checkUnprocessed(targetWaypoint.getOrigin(WptType.class));
checkSpeedExtension(targetWaypoint.getOrigin(WptType.class));
checkTemperatureExtension(sourceTrackPoint.getOrigin(WptType.class));

GpxRoute targetTrack = (GpxRoute) target.getAllRoutes().get(1);
assertNotNull(targetTrack.getOrigins());
Expand All @@ -385,8 +359,6 @@ public void test(ParserResult source, ParserResult target) {
GpxPosition targetTrackPoint = targetTrack.getPosition(0);
assertNotNull(targetTrackPoint.getOrigin());
checkUnprocessed(targetTrackPoint.getOrigin(WptType.class));
checkSpeedExtension(targetTrackPoint.getOrigin(WptType.class));
checkTemperatureExtension(sourceTrackPoint.getOrigin(WptType.class));

checkHeadingAndAccuracy(sourceTrack, targetTrack);
checkHeadingAndAccuracy(sourceWaypoints, targetWaypoints);
Expand Down
4 changes: 2 additions & 2 deletions route-converter-build/buildNumber.properties
@@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Fri Aug 19 22:50:00 CEST 2016
buildNumber0=778
#Thu Aug 25 21:56:14 CEST 2016
buildNumber0=780

0 comments on commit f7a7ecf

Please sign in to comment.