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


Java SAXEventBuffer.isEmpty方法代码示例

本文整理汇总了Java中org.citygml4j.util.xml.SAXEventBuffer.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java SAXEventBuffer.isEmpty方法的具体用法?Java SAXEventBuffer.isEmpty怎么用?Java SAXEventBuffer.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.citygml4j.util.xml.SAXEventBuffer的用法示例。


在下文中一共展示了SAXEventBuffer.isEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: print

import org.citygml4j.util.xml.SAXEventBuffer; //导入方法依赖的package包/类
public void print(AbstractFeature abstractFeature) throws CityGMLWriteException {
	FeatureProperty<? extends AbstractFeature> member = null;

	// wrap feature with a feature property element
	if (abstractFeature instanceof AbstractCityObject) {
		member = new CityObjectMemberImpl();
		((CityObjectMember)member).setCityObject((AbstractCityObject)abstractFeature);
	} 

	else if (abstractFeature instanceof Appearance) {
		member = new AppearanceMemberImpl();
		((AppearanceMember)member).setAppearance((Appearance)abstractFeature);
	} 

	else {
		member = new FeatureMemberImpl();
		((FeatureMember)member).setFeature(abstractFeature);
	}

	if (member != null) {
		try {
			SAXEventBuffer buffer = new SAXEventBuffer();
			Marshaller marshaller = jaxbBuilder.getJAXBContext().createMarshaller();
			marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);

			JAXBElement<?> jaxbElement = jaxbMarshaller.marshalJAXBElement(member);
			if (jaxbElement != null)
				marshaller.marshal(jaxbElement, buffer);

			if (!buffer.isEmpty())
				ioWriterPool.addWork(buffer);
		} catch (JAXBException e) {
			throw new CityGMLWriteException("Caused by: ", e);
		}
	}		
}
 
开发者ID:3dcitydb,项目名称:importer-exporter-oracle,代码行数:37,代码来源:DBExporterManager.java

示例2: process

import org.citygml4j.util.xml.SAXEventBuffer; //导入方法依赖的package包/类
@Override
public void process(AbstractFeature abstractFeature) throws FeatureProcessException {

	// security feature: strip geometry from features
	if (geometryStripper != null) {
		abstractFeature.accept(geometryStripper);
		geometryStripper.reset();
	}

	JAXBElement<?> output = null;
	
	if (writeMemberProperty) {
		MemberPropertyType memberProperty = new MemberPropertyType();

		if (!exporterConfig.getInternal().isRegisterGmlIdInCache() || !isFeatureAlreadyExported(abstractFeature)) {
			// TODO: CityGML 1.0 Appearance elements are not global and hence must be wrapped by an AppearanceProperty 
			memberProperty.getContent().add(jaxbMarshaller.marshalJAXBElement(abstractFeature));
		} else
			memberProperty.setHref("#" + abstractFeature.getId());
		
		output = wfsFactory.createMember(memberProperty);
	} else {
		output = jaxbMarshaller.marshalJAXBElement(abstractFeature);
	}
	
	try {
		SAXEventBuffer buffer = new SAXEventBuffer();
		Marshaller marshaller = jaxbBuilder.getJAXBContext().createMarshaller();
		marshaller.setProperty(Marshaller.JAXB_FRAGMENT, writeMemberProperty);				

		if (output != null)
			marshaller.marshal(output, buffer);
		else
			throw new FeatureProcessException("Failed to write feature with gml:id '" + abstractFeature.getId() + "'.");

		if (!buffer.isEmpty())
			writerPool.addWork(buffer);
		else
			throw new FeatureProcessException("Failed to write feature with gml:id '" + abstractFeature.getId() + "'.");
	} catch (JAXBException e) {
		throw new FeatureProcessException("Failed to write feature with gml:id '" + abstractFeature.getId() + "': " + e.getMessage());
	}
}
 
开发者ID:3dcitydb,项目名称:web-feature-service,代码行数:44,代码来源:FeatureMemberWriter.java


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