本文整理汇总了Java中net.opengis.sampling.x10.SamplingPointDocument类的典型用法代码示例。如果您正苦于以下问题:Java SamplingPointDocument类的具体用法?Java SamplingPointDocument怎么用?Java SamplingPointDocument使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SamplingPointDocument类属于net.opengis.sampling.x10包,在下文中一共展示了SamplingPointDocument类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unmarshalFeatures
import net.opengis.sampling.x10.SamplingPointDocument; //导入依赖的package包/类
@Override
public OXFFeatureCollection unmarshalFeatures(final OperationResult opsRes)
throws OXFException {
ByteArrayInputStream is = opsRes.getIncomingResultAsStream();
try {
final net.opengis.gml.FeatureCollectionDocument2 xb_featureCollDoc = net.opengis.gml.FeatureCollectionDocument2.Factory
.parse(is);
final net.opengis.gml.AbstractFeatureCollectionType xb_collection = xb_featureCollDoc
.getFeatureCollection();
return unmarshalFeatures(xb_collection);
} catch (final Exception e1) {
try {
is = opsRes.getIncomingResultAsStream();
final SamplingPointDocument spd = SamplingPointDocument.Factory
.parse(is);
final OXFAbstractFeatureCollectionType oxf_abstFeatureCollType = new OXFAbstractFeatureCollectionType();
// create empty OXFFeatureCollection-object:
final OXFFeatureCollection oxf_featureCollection = new OXFFeatureCollection(
"any_ID", oxf_abstFeatureCollType);
oxf_featureCollection.add(OXFSamplingPointType.create(spd));
return oxf_featureCollection;
} catch (final Exception e2) {
throw new OXFException(e2);
}
}
}
示例2: testSamplingPointCreation
import net.opengis.sampling.x10.SamplingPointDocument; //导入依赖的package包/类
public void testSamplingPointCreation() {
SamplingPointDocument sa = SamplingPointDocument.Factory.newInstance();
SamplingPointType point = sa.addNewSamplingPoint();
FeaturePropertyType feat = point.addNewSampledFeature();
feat.setHref("ha");
PointPropertyType pos = point.addNewPosition();;
PointType posP = pos.addNewPoint();
DirectPositionType posPPos = posP.addNewPos();
posPPos.setListValue(Arrays.asList(52.0, 6.0));
SamplingFeatureType feature = SamplingFeatureType.Factory.newInstance();
feat.setFeature(feature);
XmlUtil.qualifySubstitutionGroup(feat.getFeature(), SamplingFeatureDocument.type.getDocumentElementName());
BoundingShapeType bb = point.addNewBoundedBy();
EnvelopeType env = bb.addNewEnvelope();
env.setSrsName("EPSG:4326");
DirectPositionType low = env.addNewPos();
low.setListValue(Arrays.asList(52.0, 7.0));
DirectPositionType up = env.addNewPos();
up.setListValue(Arrays.asList(53.0, 8.0));
XMLBeansParser.registerLaxValidationCase(new LaxValidationCase() {
@Override
public boolean shouldPass(XmlValidationError xve) {
if (xve.getExpectedQNames() != null &&
xve.getExpectedQNames().contains(
FeatureDocument.type.getDocumentElementName())) {
return true;
}
return false;
}
@Override
public boolean shouldPass(XmlError validationError) {
if (validationError instanceof XmlValidationError) {
return shouldPass((XmlValidationError) validationError);
}
return false;
}
});
Collection<XmlError> err = XMLBeansParser.validate(sa);
assertTrue(err.isEmpty());
SamplingPointDocument parsedSa;
try {
parsedSa = SamplingPointDocument.Factory.parse(sa.toString());
err = XMLBeansParser.validate(parsedSa);
assertTrue(err.isEmpty());
} catch (XmlException e) {
e.printStackTrace();
}
}