當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。