private List<SamplingFeature> getAllFeaturesFrom(FeatureCollection featureCollection) { List<SamplingFeature> features = new ArrayList<SamplingFeature>(featureCollection.getMembers().size()); for (AbstractFeature abstractFeature : featureCollection.getMembers().values()) { if (abstractFeature instanceof SamplingFeature) { features.add((SamplingFeature) abstractFeature); } else if (abstractFeature instanceof FeatureCollection) { features.addAll(getAllFeaturesFrom((FeatureCollection) abstractFeature)); } } return features; }
public 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); } }