use of org.opengis.observation.ObservationCollection in project geotoolkit by Geomatys.
the class XmlObservationReader method getPhenomenonNames.
private Collection<String> getPhenomenonNames() throws DataStoreException {
final Set<String> phenomenons = new HashSet<>();
for (Object xmlObject : xmlObjects) {
if (xmlObject instanceof ObservationCollection) {
final ObservationCollection collection = (ObservationCollection) xmlObject;
for (Observation obs : collection.getMember()) {
final AbstractObservation o = (AbstractObservation) obs;
final PhenomenonProperty phenProp = o.getPropertyObservedProperty();
phenomenons.addAll(OMUtils.getPhenomenonsFields(phenProp));
}
} else if (xmlObject instanceof AbstractObservation) {
final AbstractObservation obs = (AbstractObservation) xmlObject;
final PhenomenonProperty phenProp = obs.getPropertyObservedProperty();
phenomenons.addAll(OMUtils.getPhenomenonsFields(phenProp));
}
}
return phenomenons;
}
use of org.opengis.observation.ObservationCollection in project geotoolkit by Geomatys.
the class XmlObservationReader method getFeatureOfInterest.
@Override
public SamplingFeature getFeatureOfInterest(final String samplingFeatureName, final String version) throws DataStoreException {
for (Object xmlObject : xmlObjects) {
if (xmlObject instanceof ObservationCollection) {
final ObservationCollection collection = (ObservationCollection) xmlObject;
for (Observation obs : collection.getMember()) {
final AbstractObservation o = (AbstractObservation) obs;
final FeatureProperty foiProp = o.getPropertyFeatureOfInterest();
if (foiProp != null && foiProp.getAbstractFeature() != null && foiProp.getAbstractFeature().getId() != null && foiProp.getAbstractFeature().getId().equals(samplingFeatureName)) {
return (SamplingFeature) foiProp.getAbstractFeature();
}
}
} else if (xmlObject instanceof AbstractObservation) {
final AbstractObservation obs = (AbstractObservation) xmlObject;
final FeatureProperty foiProp = obs.getPropertyFeatureOfInterest();
if (foiProp != null && foiProp.getAbstractFeature() != null && foiProp.getAbstractFeature().getId() != null && foiProp.getAbstractFeature().getId().equals(samplingFeatureName)) {
return (SamplingFeature) foiProp.getAbstractFeature();
}
}
}
return null;
}
use of org.opengis.observation.ObservationCollection in project geotoolkit by Geomatys.
the class XmlObservationReader method getFeatureOfInterestNames.
private Collection<String> getFeatureOfInterestNames() throws DataStoreException {
final Set<String> featureOfInterest = new HashSet<>();
for (Object xmlObject : xmlObjects) {
if (xmlObject instanceof ObservationCollection) {
final ObservationCollection collection = (ObservationCollection) xmlObject;
for (Observation obs : collection.getMember()) {
final AbstractObservation o = (AbstractObservation) obs;
final FeatureProperty foiProp = o.getPropertyFeatureOfInterest();
featureOfInterest.add(OMUtils.getFOIId(foiProp));
}
} else if (xmlObject instanceof AbstractObservation) {
final AbstractObservation obs = (AbstractObservation) xmlObject;
final FeatureProperty foiProp = obs.getPropertyFeatureOfInterest();
featureOfInterest.add(OMUtils.getFOIId(foiProp));
}
}
return featureOfInterest;
}
use of org.opengis.observation.ObservationCollection in project geotoolkit by Geomatys.
the class XmlObservationReader method getPhenomenons.
@Override
public Collection<Phenomenon> getPhenomenons(final Map<String, Object> hints) throws DataStoreException {
final Set<Phenomenon> phenomenons = new HashSet<>();
String version = (String) hints.get(SOS_VERSION);
Object identifierVal = hints.get(IDENTIFIER);
List<String> identifiers = new ArrayList<>();
if (identifierVal instanceof Collection) {
identifiers.addAll((Collection<? extends String>) identifierVal);
} else if (identifierVal instanceof String) {
identifiers.add((String) identifierVal);
}
for (Object xmlObject : xmlObjects) {
if (xmlObject instanceof ObservationCollection) {
final ObservationCollection collection = (ObservationCollection) xmlObject;
for (Observation obs : collection.getMember()) {
final AbstractObservation o = (AbstractObservation) obs;
final PhenomenonProperty phenProp = o.getPropertyObservedProperty();
final Phenomenon ph = OMUtils.getPhenomenon(phenProp);
if (ph instanceof org.geotoolkit.swe.xml.Phenomenon) {
org.geotoolkit.swe.xml.Phenomenon phe = (org.geotoolkit.swe.xml.Phenomenon) ph;
if (identifiers.isEmpty() || identifiers.contains(phe.getName().getCode())) {
phenomenons.add(ph);
}
}
}
} else if (xmlObject instanceof AbstractObservation) {
final AbstractObservation obs = (AbstractObservation) xmlObject;
final PhenomenonProperty phenProp = obs.getPropertyObservedProperty();
final Phenomenon ph = OMUtils.getPhenomenon(phenProp);
if (ph instanceof org.geotoolkit.swe.xml.Phenomenon) {
org.geotoolkit.swe.xml.Phenomenon phe = (org.geotoolkit.swe.xml.Phenomenon) ph;
if (identifiers.isEmpty() || identifiers.contains(phe.getName().getCode())) {
phenomenons.add(ph);
}
}
}
}
return phenomenons;
}
use of org.opengis.observation.ObservationCollection in project geotoolkit by Geomatys.
the class XmlObservationReader method getProcedureNames.
private Collection<String> getProcedureNames(String sensorType) throws DataStoreException {
// no filter yet
final Set<String> names = new HashSet<>();
for (Object xmlObject : xmlObjects) {
if (xmlObject instanceof ObservationCollection) {
final ObservationCollection collection = (ObservationCollection) xmlObject;
for (Observation obs : collection.getMember()) {
final org.geotoolkit.observation.xml.Process process = (Process) obs.getProcedure();
names.add(process.getHref());
}
} else if (xmlObject instanceof Observation) {
final Observation obs = (Observation) xmlObject;
final Process process = (Process) obs.getProcedure();
names.add(process.getHref());
}
}
return names;
}
Aggregations