本文整理汇总了Java中org.geotools.xml.Encoder类的典型用法代码示例。如果您正苦于以下问题:Java Encoder类的具体用法?Java Encoder怎么用?Java Encoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Encoder类属于org.geotools.xml包,在下文中一共展示了Encoder类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: complexFeatureStreamIntercept
import org.geotools.xml.Encoder; //导入依赖的package包/类
private void complexFeatureStreamIntercept(FeatureCollectionResponse results, OutputStream output,
Encoder encoder) throws IOException {
if (this.getXSLT() == null) {
throw new FileNotFoundException("Unable to locate xslt resource file");
}
// Create a temporary file for the xml dump. _dump is added to ensure the hash create is
// more then 3 char.
File featureOut = File.createTempFile(output.hashCode() + "_dump", ".xml");
// create a buffered output stream to write the output from encode to disk first
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(featureOut));
// create a buffered input stream to read the dumped xml file in
BufferedInputStream in = new BufferedInputStream(new FileInputStream(featureOut));
try {
// the output file has to be unique with each Class object to ensure concurrency
encode(results, out, encoder);
this.transform(in, this.getXSLT(), output);
} catch (TransformerException e) {
throw (IOException) new IOException(e.getMessage()).initCause(e);
} finally {
out.close();
in.close();
featureOut.delete();
}
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:26,代码来源:GML3OutputFormat_ISO.java
示例2: convertToSE_1_1
import org.geotools.xml.Encoder; //导入依赖的package包/类
private void convertToSE_1_1() {
if (style == null) {
JOptionPane.showMessageDialog(this, "Style not defined");
return;
}
org.geotools.sld.v1_1.SLDConfiguration configuration = new org.geotools.sld.v1_1.SLDConfiguration();
Encoder encoder = new org.geotools.xml.Encoder(configuration);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
encoder.encode(style,
org.geotools.sld.bindings.SLD.FEATURETYPESTYLE,
outputStream);
String document = outputStream.toString("UTF-8");
text.setText(document);
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:21,代码来源:StyleConverter.java
示例3: convertToSLD_1_1
import org.geotools.xml.Encoder; //导入依赖的package包/类
private void convertToSLD_1_1() {
if (style == null) {
JOptionPane.showMessageDialog(this, "Style not defined");
return;
}
// Wrap style as an SLD
StyleFactory factory = CommonFactoryFinder.getStyleFactory();
StyledLayerDescriptor sld = factory.createStyledLayerDescriptor();
org.geotools.sld.v1_1.SLDConfiguration configuration = new org.geotools.sld.v1_1.SLDConfiguration();
Encoder encoder = new org.geotools.xml.Encoder(configuration);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
encoder.encode(style,
org.geotools.sld.bindings.SLD.STYLEDLAYERDESCRIPTOR,
outputStream);
String document = outputStream.toString("UTF-8");
display(document, SLD_1_1);
} catch (IOException e) {
e.printStackTrace();
}
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:25,代码来源:StyleConverter.java
示例4: encodeAsXmlObject
import org.geotools.xml.Encoder; //导入依赖的package包/类
public void encodeAsXmlObject(Object geometry, List<Element> geoms) throws IOException, TransformerException, SAXException {
this.encoder = new Encoder(config);
this.encoder.setOmitXMLDeclaration(true);
if (geometry instanceof MultiPolygon) {
encodeMultiPolygon((MultiPolygon) geometry, geoms);
} else if (geometry instanceof Polygon) {
encodePolygon((Polygon) geometry, geoms);
} else if (geometry instanceof LinearRing) {
encodeLinearRing((LinearRing) geometry, geoms);
} else if (geometry instanceof LineString) {
encodeLineString((LineString) geometry, geoms);
} else if (geometry instanceof MultiLineString) {
encodeMultiLineString((MultiLineString) geometry, geoms);
} else if (geometry instanceof Point) {
encodePoint((Point) geometry, geoms);
} else if (geometry instanceof MultiPoint) {
encodeMultiPoint((MultiPoint) geometry, geoms);
}
}
开发者ID:52North,项目名称:WPS4Aviation,代码行数:20,代码来源:GML32MultiGeometryGenerator.java
示例5: toGML
import org.geotools.xml.Encoder; //导入依赖的package包/类
public String toGML(SimpleFeatureCollection featureCollection){
try {
Encoder encoder = new Encoder( configuration );
encoder.getNamespaces().declarePrefix("xs", "http://www.w3.org/2001/XMLSchema");
encoder.setIndenting(true);
ByteArrayOutputStream baBuffer = new ByteArrayOutputStream();
encoder.encode(featureCollection, ns, baBuffer);
baBuffer.flush();
String xml = baBuffer.toString();
baBuffer.close();
return xml;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
开发者ID:Canadensys,项目名称:narwhal-api,代码行数:18,代码来源:GMLWriter.java
示例6: doProduceEcqlFilters
import org.geotools.xml.Encoder; //导入依赖的package包/类
/**
* Generate the eCQL-Filter.
* (based on the query list that has been establish)
*/
private void doProduceEcqlFilters() throws CQLException {
ArrayList<Query> queryList = new ArrayList<>();
if (complexQueries != null && complexQueries.size() > 0) {
for (Query query: complexQueries) {
try {
Filter filter = ECQL.toFilter(query.getValue());
Configuration configuration =
new org.geotools.filter.v2_0.FESConfiguration();
Encoder encoder = new Encoder(configuration);
encoder.setIndenting(true);
encoder.setIndentSize(INDENTSIZE);
encoder.setOmitXMLDeclaration(true);
String filterString = null;
filterString = encoder.encodeAsString(filter, FES.Filter);
if (filterString != null) {
eCQLFilters.add(filterString);
query.seteCQLFilter(filterString);
queryList.add(query);
}
} catch (IOException e) {
// log.log(log.getLevel(), e.getMessage(), e.getCause());
e.printStackTrace();
}
}
complexQueries = queryList;
}
}
开发者ID:gdi-by,项目名称:downloadclient,代码行数:36,代码来源:FilterEncoder.java
示例7: createEncoder
import org.geotools.xml.Encoder; //导入依赖的package包/类
protected Encoder createEncoder(Configuration configuration,
Map<String, Set<ResourceInfo>> featureTypes, Object request ) {
return new Encoder(configuration, configuration.schema());
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:5,代码来源:GML3OutputFormat_ISO.java
示例8: setAdditionalSchemaLocations
import org.geotools.xml.Encoder; //导入依赖的package包/类
protected void setAdditionalSchemaLocations(Encoder encoder, GetFeatureRequest request, WFSInfo wfs) {
//hook for subclasses
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:4,代码来源:GML3OutputFormat_ISO.java
示例9: encode
import org.geotools.xml.Encoder; //导入依赖的package包/类
protected void encode(FeatureCollectionResponse results, OutputStream output, Encoder encoder)
throws IOException {
encoder.encode(results.unadapt(FeatureCollectionType.class),
org.geoserver.wfs.xml.v1_1_0.WFS.FEATURECOLLECTION, output);
}
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:6,代码来源:GML3OutputFormat_ISO.java
示例10: write
import org.geotools.xml.Encoder; //导入依赖的package包/类
public void write(Object obj, OutputStream output) throws IOException {
Encoder encoder = new Encoder(new KMLConfiguration());
encoder.setIndenting(true);
encoder.encode(obj, KML.kml, output);
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:6,代码来源:KmlParser.java
注:本文中的org.geotools.xml.Encoder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论