当前位置: 首页>>代码示例>>Java>>正文


Java SamplingPointDocument类代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:52North,项目名称:uDig-SOS-plugin,代码行数:29,代码来源:UDIGSOSFOIStore.java

示例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();
	}
	
}
 
开发者ID:52North,项目名称:SES,代码行数:55,代码来源:SamplingPointTest.java


注:本文中的net.opengis.sampling.x10.SamplingPointDocument类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。