use of org.geotoolkit.swe.xml.v101.DataArrayType in project geotoolkit by Geomatys.
the class ObservationType method getTemporaryTemplate.
/**
* Construit un nouveau template temporaire d'observation a partir d'un template fournit en argument.
* On y rajoute un samplingTime et un id temporaire.
*/
@Override
public ObservationType getTemporaryTemplate(final String temporaryName, TemporalGeometricPrimitive time) {
if (time == null) {
TimePositionType begin = new TimePositionType("1900-01-01T00:00:00");
time = new TimePeriodType(begin);
}
// debugging purpose
Object res = null;
if (this.result != null) {
res = this.result.getValue();
if (this.result.getValue() instanceof DataArrayPropertyType) {
DataArrayType d = ((DataArrayPropertyType) this.result.getValue()).getDataArray();
d.setElementCount(0);
d.setValues("");
}
}
return new ObservationType(temporaryName, this.definition, this.featureOfInterest, this.observedProperty, this.procedure.getHref(), res, (AbstractTimeGeometricPrimitiveType) time);
}
use of org.geotoolkit.swe.xml.v101.DataArrayType in project geotoolkit by Geomatys.
the class ObservationType method updateDataArrayResult.
/**
* Update the result of the obervation by setting the specified String value and numbers of result.
* and the last date of measure.
*
* @param values A datablock of values.
* @param nbResult the number of result in the datablock.
* @param lastDate The last date of measure. If this parameter is null, the last date will be kept.
* @throws IllegalArgumentException if the resulat of the observation is not a DataArray.
*/
public void updateDataArrayResult(final String values, final int nbResult, final Date lastDate) {
if (lastDate != null) {
extendSamplingTime(lastDate);
}
if (getResult() instanceof DataArrayPropertyType) {
DataArrayType array = ((DataArrayPropertyType) getResult()).getDataArray();
array.updateArray(values, nbResult);
} else {
throw new IllegalArgumentException("The result is not a data array.");
}
}
Aggregations