Search in sources :

Example 11 with Process

use of org.geotoolkit.observation.xml.Process in project geotoolkit by Geomatys.

the class AbstractObservationStore method getResults.

/**
 * {@inheritDoc }
 */
@Override
public ExtractionResult getResults(final String affectedSensorId, final List<String> sensorIDs, Set<Phenomenon> phenomenons, final Set<org.opengis.observation.sampling.SamplingFeature> samplingFeatures) throws DataStoreException {
    if (affectedSensorId != null) {
        LOGGER.warning("This ObservationStore does not allow to override sensor ID");
    }
    final ExtractionResult result = new ExtractionResult();
    result.spatialBound.initBoundary();
    final List<Observation> observations = getAllObservations(sensorIDs);
    for (Observation obs : observations) {
        final AbstractObservation o = (AbstractObservation) obs;
        final Process proc = o.getProcedure();
        final ExtractionResult.ProcedureTree procedure = new ExtractionResult.ProcedureTree(proc.getHref(), proc.getName(), proc.getDescription(), "Component", "timeseries");
        if (sensorIDs == null || sensorIDs.contains(procedure.id)) {
            if (!result.procedures.contains(procedure)) {
                result.procedures.add(procedure);
            }
            final PhenomenonProperty phenProp = o.getPropertyObservedProperty();
            final List<String> fields = OMUtils.getPhenomenonsFields(phenProp);
            for (String field : fields) {
                if (!result.fields.contains(field)) {
                    result.fields.add(field);
                }
            }
            final Phenomenon phen = OMUtils.getPhenomenon(phenProp);
            if (!result.phenomenons.contains(phen)) {
                result.phenomenons.add(phen);
            }
            result.spatialBound.appendLocation(o.getSamplingTime(), o.getFeatureOfInterest());
            procedure.spatialBound.appendLocation(o.getSamplingTime(), o.getFeatureOfInterest());
            procedure.spatialBound.getHistoricalLocations().putAll(getSensorLocations(o.getProcedure().getHref(), "2.0.0"));
            result.observations.add(o);
        }
    }
    return result;
}
Also used : Observation(org.opengis.observation.Observation) AbstractObservation(org.geotoolkit.observation.xml.AbstractObservation) PhenomenonProperty(org.geotoolkit.swe.xml.PhenomenonProperty) Phenomenon(org.opengis.observation.Phenomenon) AbstractObservation(org.geotoolkit.observation.xml.AbstractObservation) Process(org.geotoolkit.observation.xml.Process) ExtractionResult(org.geotoolkit.observation.model.ExtractionResult)

Aggregations

Process (org.geotoolkit.observation.xml.Process)11 IOException (java.io.IOException)8 ProcedureTree (org.geotoolkit.observation.model.ExtractionResult.ProcedureTree)8 GeoSpatialBound (org.geotoolkit.observation.model.GeoSpatialBound)8 Array (ucar.ma2.Array)8 Variable (ucar.nc2.Variable)7 ArrayList (java.util.ArrayList)6 ExtractionResult (org.geotoolkit.observation.model.ExtractionResult)6 SamplingFeature (org.geotoolkit.sampling.xml.SamplingFeature)4 MeasureStringBuilder (org.geotoolkit.sos.MeasureStringBuilder)4 AbstractDataRecord (org.geotoolkit.swe.xml.AbstractDataRecord)4 Phenomenon (org.geotoolkit.swe.xml.Phenomenon)4 Observation (org.opengis.observation.Observation)3 AbstractObservation (org.geotoolkit.observation.xml.AbstractObservation)2 PhenomenonProperty (org.geotoolkit.swe.xml.PhenomenonProperty)2 HashSet (java.util.HashSet)1 org.geotoolkit.observation.xml (org.geotoolkit.observation.xml)1 DirectPosition (org.opengis.geometry.DirectPosition)1 ObservationCollection (org.opengis.observation.ObservationCollection)1 Phenomenon (org.opengis.observation.Phenomenon)1