use of org.n52.shetland.ogc.gml.time.TimePeriod in project arctic-sea by 52North.
the class GetCapabilitiesResponseEncoder method encodeResultTime.
private void encodeResultTime(SosObservationOffering offering, int offeringCounter, ObservationOfferingType xbObsOff) throws EncodingException {
// set resultTime [0..1]
if (offering.getResultTime() instanceof TimePeriod) {
TimePeriod tp = (TimePeriod) offering.getResultTime();
tp.setGmlId(String.format(ID_FORMAT_STRING, Sos2Constants.EN_RESULT_TIME, offeringCounter));
if (!tp.isEmpty()) {
XmlObject xmlObject = encodeGml(tp);
xbObsOff.addNewResultTime().addNewTimePeriod().set(xmlObject);
xbObsOff.getResultTime().substitute(Sos2Constants.QN_SOS_RESULT_TIME, xbObsOff.getResultTime().schemaType());
}
}
}
use of org.n52.shetland.ogc.gml.time.TimePeriod in project arctic-sea by 52North.
the class GetCapabilitiesResponseEncoder method encodePhenomenonTime.
private void encodePhenomenonTime(SosObservationOffering offering, int offeringCounter, ObservationOfferingType xbObsOff) throws EncodingException {
// set up phenomenon time [0..1]
if (offering.getPhenomenonTime() instanceof TimePeriod) {
TimePeriod tp = (TimePeriod) offering.getPhenomenonTime();
if (!tp.isEmpty()) {
tp.setGmlId(String.format(ID_FORMAT_STRING, Sos2Constants.EN_PHENOMENON_TIME, offeringCounter));
XmlObject xmlObject = encodeGml(tp);
xbObsOff.addNewPhenomenonTime().addNewTimePeriod().set(xmlObject);
xbObsOff.getPhenomenonTime().substitute(Sos2Constants.QN_SOS_PHENOMENON_TIME, xbObsOff.getPhenomenonTime().schemaType());
}
}
}
use of org.n52.shetland.ogc.gml.time.TimePeriod in project arctic-sea by 52North.
the class FesEncoderv20 method encodeTemporalFilterDuring.
private XmlObject encodeTemporalFilterDuring(TemporalFilter temporalFilter) throws EncodingException {
final DuringDocument duringDoc = DuringDocument.Factory.newInstance(getXmlOptions());
final BinaryTemporalOpType during = duringDoc.addNewDuring();
if (temporalFilter.getTime() instanceof TimePeriod) {
during.set(encodeObjectToXml(GmlConstants.NS_GML_32, temporalFilter.getTime(), EncodingContext.of(XmlBeansEncodingFlags.DOCUMENT)));
} else {
throw new EncodingException("The temporal filter value is not a TimePeriod!");
}
checkAndAddValueReference(during, temporalFilter);
return duringDoc;
}
use of org.n52.shetland.ogc.gml.time.TimePeriod in project arctic-sea by 52North.
the class AbstractOmEncoderv20 method addResultTime.
/**
* Method to add the result time to the XML observation object
*
* @param xbObs
* XML observation object
* @param sosObservation
* SOS observation object
* @throws EncodingException
* If an error occurs.
*/
private void addResultTime(OMObservationType xbObs, OmObservation sosObservation) throws EncodingException {
TimeInstant resultTime = sosObservation.getResultTime();
Time phenomenonTime = sosObservation.getPhenomenonTime();
// get result time from SOS result time representation
if (sosObservation.getResultTime() != null) {
if (resultTime.equals(phenomenonTime)) {
xbObs.addNewResultTime().setHref("#" + phenomenonTime.getGmlId());
} else {
addResultTime(xbObs, resultTime);
}
} else {
// representation
if (phenomenonTime instanceof TimeInstant) {
xbObs.addNewResultTime().setHref("#" + phenomenonTime.getGmlId());
} else if (phenomenonTime instanceof TimePeriod) {
TimeInstant rsTime = new TimeInstant(((TimePeriod) sosObservation.getPhenomenonTime()).getEnd());
addResultTime(xbObs, rsTime);
}
}
}
use of org.n52.shetland.ogc.gml.time.TimePeriod in project arctic-sea by 52North.
the class AbstractAqdResponseEncoder method processObservation.
protected void processObservation(OmObservation observation, TimePeriod timePeriod, TimeInstant resultTime, FeatureCollection featureCollection, AbstractEReportingHeader eReportingHeader, int counter) {
if (observation.isSetPhenomenonTime()) {
// generate gml:id
observation.setGmlId(getObservationId(counter));
// add xlink:href to eReportingHeader.content
eReportingHeader.addContent((AbstractFeature) new OmObservation().setIdentifier(new CodeWithAuthority(getObservationXlink(observation.getGmlId()))));
timePeriod.extendToContain(observation.getPhenomenonTime());
observation.setResultTime(resultTime);
featureCollection.addMember(observation);
}
}
Aggregations