Search in sources :

Example 16 with DataArrayType

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);
}
Also used : DataArrayPropertyType(org.geotoolkit.swe.xml.v101.DataArrayPropertyType) DataArrayType(org.geotoolkit.swe.xml.v101.DataArrayType)

Example 17 with DataArrayType

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.");
    }
}
Also used : DataArrayPropertyType(org.geotoolkit.swe.xml.v101.DataArrayPropertyType) DataArrayType(org.geotoolkit.swe.xml.v101.DataArrayType)

Aggregations

DataArrayType (net.opengis.swe.x20.DataArrayType)6 DataArrayType (net.opengis.swe.x101.DataArrayType)5 DataRecordType (net.opengis.swe.x20.DataRecordType)5 XmlObject (org.apache.xmlbeans.XmlObject)5 ArrayList (java.util.ArrayList)4 DataArrayType (org.geotoolkit.swe.xml.v101.DataArrayType)4 NotYetSupportedEncodingException (org.n52.svalbard.encode.exception.NotYetSupportedEncodingException)4 DataComponentPropertyType (net.opengis.swe.x101.DataComponentPropertyType)3 SimpleDataRecordType (net.opengis.swe.x101.SimpleDataRecordType)3 BooleanType (net.opengis.swe.x20.BooleanType)3 CategoryType (net.opengis.swe.x20.CategoryType)3 CountRangeType (net.opengis.swe.x20.CountRangeType)3 CountType (net.opengis.swe.x20.CountType)3 DataArrayDocument (net.opengis.swe.x20.DataArrayDocument)3 DataArrayPropertyType (net.opengis.swe.x20.DataArrayPropertyType)3 QuantityRangeType (net.opengis.swe.x20.QuantityRangeType)3 QuantityType (net.opengis.swe.x20.QuantityType)3 TextType (net.opengis.swe.x20.TextType)3 TimeRangeType (net.opengis.swe.x20.TimeRangeType)3 TimeType (net.opengis.swe.x20.TimeType)3