use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.ObjectFactory in project RouteConverter by cpesch.
the class GpxPositionExtension method setHeading.
public void setHeading(Double heading) {
if (wptType.getExtensions() == null)
wptType.setExtensions(new ObjectFactory().createExtensionsType());
List<Object> anys = wptType.getExtensions().getAny();
boolean foundHeading = false;
for (Object any : anys) {
if (any instanceof JAXBElement) {
Object anyValue = ((JAXBElement) any).getValue();
if (anyValue instanceof slash.navigation.gpx.trackpoint2.TrackPointExtensionT) {
slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint = (slash.navigation.gpx.trackpoint2.TrackPointExtensionT) anyValue;
trackPoint.setCourse(formatHeading(heading));
foundHeading = true;
}
} else if (any instanceof Element) {
Element element = (Element) any;
if ("course".equalsIgnoreCase(element.getLocalName())) {
element.setTextContent(formatHeadingAsString(heading));
foundHeading = true;
}
}
}
if (!foundHeading) {
slash.navigation.gpx.trackpoint2.ObjectFactory trackpoint2Factory = new slash.navigation.gpx.trackpoint2.ObjectFactory();
slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPointExtensionT = trackpoint2Factory.createTrackPointExtensionT();
trackPointExtensionT.setCourse(formatHeading(heading));
anys.add(trackpoint2Factory.createTrackPointExtension(trackPointExtensionT));
}
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.ObjectFactory in project RouteConverter by cpesch.
the class GpxPositionExtension method setTemperature.
public void setTemperature(Double temperature) {
if (wptType.getExtensions() == null)
wptType.setExtensions(new ObjectFactory().createExtensionsType());
List<Object> anys = wptType.getExtensions().getAny();
boolean foundTemperature = false;
for (Object any : anys) {
if (any instanceof JAXBElement) {
Object anyValue = ((JAXBElement) any).getValue();
if (anyValue instanceof slash.navigation.gpx.garmin3.TrackPointExtensionT) {
slash.navigation.gpx.garmin3.TrackPointExtensionT trackPoint = (slash.navigation.gpx.garmin3.TrackPointExtensionT) anyValue;
trackPoint.setTemperature(formatTemperatureAsDouble(temperature));
foundTemperature = true;
} else if (anyValue instanceof slash.navigation.gpx.trackpoint1.TrackPointExtensionT) {
slash.navigation.gpx.trackpoint1.TrackPointExtensionT trackPoint = (slash.navigation.gpx.trackpoint1.TrackPointExtensionT) anyValue;
if (isEmpty(trackPoint.getAtemp()) && isEmpty(temperature))
trackPoint.setWtemp(null);
trackPoint.setAtemp(formatTemperatureAsDouble(temperature));
foundTemperature = true;
} else if (anyValue instanceof slash.navigation.gpx.trackpoint2.TrackPointExtensionT) {
slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint = (slash.navigation.gpx.trackpoint2.TrackPointExtensionT) anyValue;
if (isEmpty(trackPoint.getAtemp()) && isEmpty(temperature))
trackPoint.setWtemp(null);
trackPoint.setAtemp(formatTemperatureAsDouble(temperature));
foundTemperature = true;
}
} else if (any instanceof Element) {
Element element = (Element) any;
if ("temperature".equalsIgnoreCase(element.getLocalName())) {
element.setTextContent(formatTemperatureAsString(temperature));
foundTemperature = true;
}
}
}
// create new TrackPointExtension v2 element if there was no existing value found
if (!foundTemperature) {
slash.navigation.gpx.trackpoint2.ObjectFactory trackpoint2Factory = new slash.navigation.gpx.trackpoint2.ObjectFactory();
slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPointExtensionT = trackpoint2Factory.createTrackPointExtensionT();
trackPointExtensionT.setAtemp(formatTemperatureAsDouble(temperature));
anys.add(trackpoint2Factory.createTrackPointExtension(trackPointExtensionT));
}
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.ObjectFactory in project RouteConverter by cpesch.
the class GpxPositionExtension method setSpeed.
public void setSpeed(Double speed) {
if (wptType.getExtensions() == null)
wptType.setExtensions(new ObjectFactory().createExtensionsType());
List<Object> anys = wptType.getExtensions().getAny();
boolean foundSpeed = false;
for (Object any : anys) {
if (any instanceof JAXBElement) {
Object anyValue = ((JAXBElement) any).getValue();
if (anyValue instanceof slash.navigation.gpx.trackpoint2.TrackPointExtensionT) {
slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint = (slash.navigation.gpx.trackpoint2.TrackPointExtensionT) anyValue;
trackPoint.setSpeed(formatSpeedAsDouble(kmhToMs(speed)));
foundSpeed = true;
}
} else if (any instanceof Element) {
Element element = (Element) any;
if ("speed".equalsIgnoreCase(element.getLocalName())) {
element.setTextContent(formatSpeedAsString(kmhToMs(speed)));
foundSpeed = true;
}
}
}
// create new TrackPointExtension v2 element if there was no existing value found
if (!foundSpeed) {
slash.navigation.gpx.trackpoint2.ObjectFactory trackpoint2Factory = new slash.navigation.gpx.trackpoint2.ObjectFactory();
slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPointExtensionT = trackpoint2Factory.createTrackPointExtensionT();
trackPointExtensionT.setSpeed(formatSpeedAsDouble(kmhToMs(speed)));
anys.add(trackpoint2Factory.createTrackPointExtension(trackPointExtensionT));
}
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.ObjectFactory in project RouteConverter by cpesch.
the class GpxPositionExtension method setHeartBeat.
public void setHeartBeat(Short heartBeat) {
if (wptType.getExtensions() == null)
wptType.setExtensions(new ObjectFactory().createExtensionsType());
List<Object> anys = wptType.getExtensions().getAny();
boolean foundHeartBeat = false;
for (Object any : anys) {
if (any instanceof JAXBElement) {
Object anyValue = ((JAXBElement) any).getValue();
if (anyValue instanceof slash.navigation.gpx.trackpoint1.TrackPointExtensionT) {
slash.navigation.gpx.trackpoint1.TrackPointExtensionT trackPoint = (slash.navigation.gpx.trackpoint1.TrackPointExtensionT) anyValue;
trackPoint.setHr(heartBeat);
foundHeartBeat = true;
} else if (anyValue instanceof slash.navigation.gpx.trackpoint2.TrackPointExtensionT) {
slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPoint = (slash.navigation.gpx.trackpoint2.TrackPointExtensionT) anyValue;
trackPoint.setHr(heartBeat);
foundHeartBeat = true;
}
} else if (any instanceof Element) {
Element element = (Element) any;
if ("hr".equalsIgnoreCase(element.getLocalName())) {
element.setTextContent(formatShortAsString(heartBeat));
foundHeartBeat = true;
}
}
}
// create new TrackPointExtension v2 element if there was no existing value found
if (!foundHeartBeat) {
slash.navigation.gpx.trackpoint2.ObjectFactory trackpoint2Factory = new slash.navigation.gpx.trackpoint2.ObjectFactory();
slash.navigation.gpx.trackpoint2.TrackPointExtensionT trackPointExtensionT = trackpoint2Factory.createTrackPointExtensionT();
trackPointExtensionT.setHr(heartBeat);
anys.add(trackpoint2Factory.createTrackPointExtension(trackPointExtensionT));
}
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_02.ObjectFactory in project RouteConverter by cpesch.
the class Kml22Format method createKmlType.
private KmlType createKmlType(List<KmlRoute> routes) {
ObjectFactory objectFactory = new ObjectFactory();
KmlType kmlType = objectFactory.createKmlType();
DocumentType documentType = objectFactory.createDocumentType();
kmlType.setAbstractFeatureGroup(objectFactory.createDocument(documentType));
documentType.setOpen(TRUE);
if (hasCharacteristics(routes, Route))
documentType.getAbstractStyleSelectorGroup().add(objectFactory.createStyle(createLineStyle(ROUTE_LINE_STYLE, getLineWidth(), getRouteLineColor())));
if (hasCharacteristics(routes, Track)) {
documentType.getAbstractStyleSelectorGroup().add(objectFactory.createStyle(createLineStyle(TRACK_LINE_STYLE, getLineWidth(), getTrackLineColor())));
if (isWriteSpeed())
for (StyleType style : createSpeedTrackColors(getSpeedLineWidth())) documentType.getAbstractStyleSelectorGroup().add(objectFactory.createStyle(style));
}
for (KmlRoute route : routes) {
switch(route.getCharacteristics()) {
case Waypoints:
FolderType wayPointsFolder = objectFactory.createFolderType();
wayPointsFolder.setName(createPlacemarkName(WAYPOINTS, route));
wayPointsFolder.setDescription(asDescription(route.getDescription()));
documentType.getAbstractFeatureGroup().add(objectFactory.createFolder(wayPointsFolder));
List<PlacemarkType> wayPoints = createWayPoints(route, 0, route.getPositionCount());
for (PlacemarkType wayPoint : wayPoints) wayPointsFolder.getAbstractFeatureGroup().add(objectFactory.createPlacemark(wayPoint));
break;
case Route:
FolderType routeFolder = objectFactory.createFolderType();
routeFolder.setName(createPlacemarkName(ROUTE, route));
documentType.getAbstractFeatureGroup().add(objectFactory.createFolder(routeFolder));
PlacemarkType routePlacemarks = createRoute(route);
routeFolder.getAbstractFeatureGroup().add(objectFactory.createPlacemark(routePlacemarks));
if (isWriteMarks())
routeFolder.getAbstractFeatureGroup().add(objectFactory.createFolder(createMarks(route, 0, route.getPositionCount())));
break;
case Track:
FolderType trackFolder = objectFactory.createFolderType();
trackFolder.setName(createPlacemarkName(TRACK, route));
documentType.getAbstractFeatureGroup().add(objectFactory.createFolder(trackFolder));
PlacemarkType track = createTrack(route, 0, route.getPositionCount());
trackFolder.getAbstractFeatureGroup().add(objectFactory.createPlacemark(track));
if (isWriteSpeed()) {
FolderType speed = createSpeed(route, 0, route.getPositionCount());
if (speed != null)
trackFolder.getAbstractFeatureGroup().add(objectFactory.createFolder(speed));
}
if (isWriteMarks())
trackFolder.getAbstractFeatureGroup().add(objectFactory.createFolder(createMarks(route, 0, route.getPositionCount())));
break;
default:
throw new IllegalArgumentException("Unknown RouteCharacteristics " + route.getCharacteristics());
}
}
return kmlType;
}
Aggregations