net.opengis.gml.TimePeriodType Java Examples
The following examples show how to use
net.opengis.gml.TimePeriodType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GmlDecoderv311.java From arctic-sea with Apache License 2.0 | 6 votes |
@Override public Object decode(XmlObject xmlObject) throws DecodingException { if (xmlObject instanceof EnvelopeDocument) { return getGeometry4BBOX((EnvelopeDocument) xmlObject); } else if (xmlObject instanceof TimeInstantType) { return parseTimeInstant((TimeInstantType) xmlObject); } else if (xmlObject instanceof TimePeriodType) { return parseTimePeriod((TimePeriodType) xmlObject); } else if (xmlObject instanceof TimeInstantDocument) { return parseTimeInstant(((TimeInstantDocument) xmlObject).getTimeInstant()); } else if (xmlObject instanceof TimePeriodDocument) { return parseTimePeriod(((TimePeriodDocument) xmlObject).getTimePeriod()); } else if (xmlObject instanceof CodeType) { return parseCodeType((CodeType) xmlObject); } else if (xmlObject instanceof PointType) { return parsePointType((PointType) xmlObject); } else { throw new UnsupportedDecoderXmlInputException(this, xmlObject); } }
Example #2
Source File: GmlDecoderv311.java From arctic-sea with Apache License 2.0 | 6 votes |
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; }
Example #3
Source File: GmlEncoderv311.java From arctic-sea with Apache License 2.0 | 6 votes |
/** * Creates a XML TimePeriod from the SOS time object. * * @param timePeriod * SOS time object * @param timePeriodType * the xml time period (may be {@code null}) * @return XML TimePeriod * * * @throws EncodingException * if an error occurs. */ private TimePeriodType createTimePeriodType(TimePeriod timePeriod, TimePeriodType timePeriodType) throws EncodingException { try { TimePeriodType tpt; if (timePeriodType == null) { tpt = TimePeriodType.Factory.newInstance(getXmlOptions()); } else { tpt = timePeriodType; } if (timePeriod.getGmlId() != null && !timePeriod.getGmlId().isEmpty()) { tpt.setId(timePeriod.getGmlId()); } tpt.setBeginPosition(createTimePositionType(timePeriod.getStartTimePosition())); tpt.setEndPosition(createTimePositionType(timePeriod.getEndTimePosition())); return tpt; } catch (XmlRuntimeException | XmlValueDisconnectedException x) { throw new EncodingException("Error while creating TimePeriod!", x); } }