本文整理汇总了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);
}
}
}
示例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());
}
}