Java源码示例:net.opengis.waterml.x20.CollectionDocument
示例1
public static void marshalPointDataset(FeatureDatasetPoint fdPoint, List<VariableSimpleIF> dataVars,
OutputStream outputStream) throws IOException, XmlException {
resetIds();
CollectionDocument collectionDoc = CollectionDocument.Factory.newInstance();
NcCollectionType.initCollection(collectionDoc.addNewCollection(), fdPoint, dataVars);
writeObject(collectionDoc, outputStream, true);
}
示例2
public StationSubsetWriterWaterML(FeatureDatasetPoint fdPoint, SubsetParams ncssParams, OutputStream out)
throws XMLStreamException, NcssException, IOException {
super(fdPoint, ncssParams);
this.out = out;
this.collectionDoc = CollectionDocument.Factory.newInstance();
this.collection = collectionDoc.addNewCollection();
}
示例3
/**
* Encodes a SOS GetObservationResponse to a single WaterML 2.0 observation
* or to a WaterML 1.0 ObservationCollection
*
* @param getObservationResonse
* SOS GetObservationResponse
* @return Encoded response
* @throws EncodingException
* If an error occurs
*/
protected XmlObject createWmlGetObservationResponse(GetObservationResponse getObservationResonse)
throws EncodingException {
// TODO: set schemaLocation if final
Map<CodeWithAuthority, String> gmlID4sfIdentifier = Maps.newHashMap();
int sfIdCounter = 1;
try {
if (getObservationResonse.getObservationCollection() != null
&& !getObservationResonse.getObservationCollection().hasNext()) {
ObservationStream observations = getObservationResonse.getObservationCollection();
OmObservation observation = observations.next();
if (!observations.hasNext()) {
OMObservationDocument omObservationDoc =
OMObservationDocument.Factory.newInstance(getXmlOptions());
omObservationDoc.setOMObservation(encodeObservation(observation, gmlID4sfIdentifier, sfIdCounter));
sfIdCounter++;
return omObservationDoc;
} else {
CollectionDocument xmlCollectionDoc = CollectionDocument.Factory.newInstance(getXmlOptions());
CollectionType wmlCollection = xmlCollectionDoc.addNewCollection();
wmlCollection.addNewObservationMember()
.setOMObservation(encodeObservation(observation, gmlID4sfIdentifier, sfIdCounter));
sfIdCounter++;
while (observations.hasNext()) {
wmlCollection.addNewObservationMember().setOMObservation(
encodeObservation(observations.next(), gmlID4sfIdentifier, sfIdCounter));
sfIdCounter++;
}
return xmlCollectionDoc;
}
} else {
// TODO: HydrologieProfile-Exception
throw new EncodingException("Combination does not exists!");
}
} catch (NoSuchElementException | OwsExceptionReport e) {
throw new EncodingException(e);
}
}