use of net.opengis.gml.TimePositionType in project arctic-sea by 52North.
the class GmlDecoderv311 method parseTimePeriod.
private Object parseTimePeriod(TimePeriodType xbTimePeriod) throws DecodingException {
// begin position
TimePositionType xbBeginTPT = xbTimePeriod.getBeginPosition();
TimeInstant begin = null;
if (xbBeginTPT != null) {
begin = parseTimePosition(xbBeginTPT);
} else {
throw new DecodingException("gml:TimePeriod must contain gml:beginPosition Element with valid ISO:8601 String!");
}
// end position
TimePositionType xbEndTPT = xbTimePeriod.getEndPosition();
TimeInstant end = null;
if (xbEndTPT != null) {
end = parseTimePosition(xbEndTPT);
} else {
throw new DecodingException("gml:TimePeriod must contain gml:endPosition Element with valid ISO:8601 String!");
}
TimePeriod timePeriod = new TimePeriod(begin, end);
timePeriod.setGmlId(xbTimePeriod.getId());
return timePeriod;
}
use of net.opengis.gml.TimePositionType in project arctic-sea by 52North.
the class GmlEncoderv311 method createTimePositionType.
private TimePositionType createTimePositionType(final TimePosition timePosition) throws DateTimeFormatException {
final TimePositionType xbTimePosition = TimePositionType.Factory.newInstance();
if (!timePosition.isSetTime()) {
if (timePosition.isSetIndeterminateValue()) {
xbTimePosition.setIndeterminatePosition(TimeIndeterminateValueType.Enum.forString(timePosition.getIndeterminateValue().getValue()));
} else {
xbTimePosition.setIndeterminatePosition(TimeIndeterminateValueType.Enum.forString(IndeterminateValue.UNKNOWN.getValue()));
}
} else {
final String endString = DateTimeHelper.formatDateTime2String(timePosition.getTime(), timePosition.getTimeFormat());
// concat minutes for timeZone offset, because gml requires
// xs:dateTime, which needs minutes in
// timezone offset
// TODO enable really
xbTimePosition.setStringValue(endString);
}
return xbTimePosition;
}
Aggregations