本文整理了Java中org.geotools.xml.Encoder.<init>()
方法的一些代码示例,展示了Encoder.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Encoder.<init>()
方法的具体详情如下:
包路径:org.geotools.xml.Encoder
类名称:Encoder
方法名:<init>
[英]Creates an encoder from a configuration.
This constructor calls through to #Encoder(Configuration,XSDSchema)obtaining the schema instance from Configuration#schema().
[中]根据配置创建编码器。
此构造函数通过调用#编码器(Configuration,XSDSchema)从配置#schema()获取模式实例。
代码示例来源:origin: org.geoserver/gs-wfs
@Override
protected Encoder createEncoder(
Configuration configuration, Map<String, Set<ResourceInfo>> resources, Object request) {
return new Encoder(configuration);
}
代码示例来源:origin: org.geoserver.extension/wps-core
@Override
public void encode(Object obj, ContentHandler handler) throws Exception {
Encoder e = new Encoder( xml );
e.encode( obj, element, handler );
}
代码示例来源:origin: org.geoserver.extension/wps-core
@Override
public void encode(Object obj, ContentHandler handler) throws Exception {
Encoder e = new Encoder(xml);
e.encode(obj, element, handler);
}
代码示例来源:origin: org.geoserver.extension/gs-wps-core
@Override
public void encode(Object obj, ContentHandler handler) throws Exception {
Encoder e = new Encoder(xml);
e.encode(obj, element, handler);
}
代码示例来源:origin: org.geoserver.extension/gs-wps-core
@Override
public void encode(Object obj, ContentHandler handler) throws Exception {
Encoder e = new Encoder(xml);
e.encode(obj, element, handler);
}
代码示例来源:origin: org.geoserver.community/gs-geofence
@Override
public Element marshal(MultiPolygon geometry) throws Exception {
if (geometry == null) {
return null;
}
try {
Encoder encoder = new Encoder(new GMLConfiguration());
return encoder.encodeAsDOM(geometry, org.geotools.gml3.v3_2.GML.MultiGeometry)
.getDocumentElement();
} catch (Exception e) {
throw new Exception("Cannot transform the specified geometry in GML", e);
}
}
代码示例来源:origin: org.n52.wps/52n-wps-io-geotools
private void writeToStream(IData coll, OutputStream os) {
FeatureCollection<?, ?> fc = ((GTVectorDataBinding)coll).getPayload();
Configuration configuration = new KMLConfiguration();
Encoder encoder = new org.geotools.xml.Encoder(configuration);
try{
encoder.encode(fc, KML.kml, os);
}catch(IOException e){
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.geotools/gt-wfs
/**
* Returns a single-line string containing the xml representation of the given filter, as
* appropriate for the {@code FILTER} parameter in a GetFeature request.
*/
protected String encodeGetFeatureGetFilter(final Filter filter) throws IOException {
Configuration filterConfig = getFilterConfiguration();
Encoder encoder = new Encoder(filterConfig);
// do not write the xml declaration
encoder.setOmitXMLDeclaration(true);
encoder.setEncoding(Charset.forName("UTF-8"));
OutputStream out = new ByteArrayOutputStream();
encoder.encode(filter, OGC.Filter, out);
String encoded = out.toString();
encoded = encoded.replaceAll("\n", "");
return encoded;
}
代码示例来源:origin: org.geoserver.extension/wps-core
private void writeBBox(OutputStream os, BoundingBoxType bbox) throws IOException {
Encoder encoder = new Encoder(new OWSConfiguration());
encoder.encode(bbox, OWS.BoundingBox, os);
}
代码示例来源:origin: org.geoserver.extension/gs-wps-core
private void writeBBox(OutputStream os, BoundingBoxType bbox) throws IOException {
Encoder encoder = new Encoder(new OWSConfiguration());
encoder.encode(bbox, OWS.BoundingBox, os);
}
代码示例来源:origin: org.geoserver.extension/gs-wps-core
/**
* Stores the request in a binary resource for efficient later retrieval
*
* @param executionId
* @throws IOException
*/
public void storeRequestObject(ExecuteType execute, String executionId) throws IOException {
Resource resource = getStoredRequest(executionId);
try (OutputStream out = resource.out()) {
WPSConfiguration config = new WPSConfiguration();
Encoder encoder = new Encoder(config);
encoder.encode(execute, WPS.Execute, out);
}
}
代码示例来源:origin: org.geoserver.extension/gs-wps-core
@Override
public void encode(Object obj, ContentHandler handler) throws Exception {
StyleFactory sf = CommonFactoryFinder.getStyleFactory(null);
StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
NamedLayer nl = sf.createNamedLayer();
nl.setName("");
nl.styles().add((Style) obj);
sld.setStyledLayers(new StyledLayer[] {nl});
Encoder e = new Encoder(sldConfiguration);
e.encode(sld, element, handler);
}
代码示例来源:origin: org.geoserver.extension/wps-core
@Override
public void encode(Object obj, ContentHandler handler) throws Exception {
StyleFactory sf = CommonFactoryFinder.getStyleFactory(null);
StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
NamedLayer nl = sf.createNamedLayer();
nl.setName("");
nl.styles().add((Style) obj);
sld.setStyledLayers(new StyledLayer[] { nl });
Encoder e = new Encoder(sldConfiguration);
e.encode(sld, element, handler);
}
代码示例来源:origin: org.geoserver/gs-wfs
void write1_1(LockFeatureResponseType lockResponse, OutputStream output, Operation operation)
throws IOException {
Encoder encoder = new Encoder(configuration, configuration.schema());
encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset()));
LockFeatureType req = (LockFeatureType) operation.getParameters()[0];
encoder.setSchemaLocation(
org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
buildSchemaURL(req.getBaseUrl(), "schemas/wfs/1.1.0/wfs.xsd"));
encoder.encode(lockResponse, org.geoserver.wfs.xml.v1_1_0.WFS.LOCKFEATURERESPONSE, output);
output.flush();
}
}
代码示例来源:origin: org.geoserver.extension/gs-wps-core
@Override
public void encode(Object object, ContentHandler handler) throws Exception {
FeatureCollection features = (FeatureCollection) object;
SimpleFeatureType featureType = (SimpleFeatureType) features.getSchema();
FeatureCollectionType fc = WfsFactory.eINSTANCE.createFeatureCollectionType();
fc.getFeature().add(features);
Encoder e = new Encoder(configuration);
e.getNamespaces().declarePrefix("feature", featureType.getName().getNamespaceURI());
e.encode(fc, getElement(), handler);
}
代码示例来源:origin: org.geoserver.extension/wps-core
@Override
public void encode(Object object, ContentHandler handler) throws Exception {
FeatureCollection features = (FeatureCollection) object;
SimpleFeatureType featureType = (SimpleFeatureType) features.getSchema();
FeatureCollectionType fc = WfsFactory.eINSTANCE.createFeatureCollectionType();
fc.getFeature().add( features );
Encoder e = new Encoder(configuration);
e.getNamespaces().declarePrefix( "feature", featureType.getName().getNamespaceURI() );
e.encode( fc, getElement(), handler );
}
代码示例来源:origin: org.geoserver/gs-wfs
@Override
protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs)
throws IOException {
hits.setNumberOfFeatures(BigInteger.valueOf(0));
Encoder e = new Encoder(new WFSConfiguration());
e.setEncoding(Charset.forName(wfs.getGeoServer().getSettings().getCharset()));
e.setSchemaLocation(
WFS.NAMESPACE, ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/2.0/wfs.xsd"));
e.encode(hits.getAdaptee(), WFS.FeatureCollection, output);
}
}
代码示例来源:origin: org.geoserver/gs-wfs
public void write(Object value, OutputStream output, Operation operation)
throws IOException, ServiceException {
// get the feature
SimpleFeature feature = (SimpleFeature) value;
SimpleFeatureType featureType = feature.getType();
// grab the metadata
FeatureTypeInfo meta = catalog.getFeatureTypeByName(featureType.getName());
// create teh encoder
Encoder encoder = new Encoder(configuration);
encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset()));
encoder.encode(feature, new QName(meta.getNamespace().getURI(), meta.getName()), output);
}
}
代码示例来源:origin: org.geoserver/gs-wfs
protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs)
throws IOException {
Encoder encoder = new Encoder(configuration, configuration.schema());
encoder.setEncoding(Charset.forName(wfs.getGeoServer().getSettings().getCharset()));
encoder.setSchemaLocation(
org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/1.1.0/wfs.xsd"));
encoder.encode(
hits.getAdaptee(), org.geoserver.wfs.xml.v1_1_0.WFS.FEATURECOLLECTION, output);
}
}
代码示例来源:origin: org.geoserver/gs-wfs
@Override
public void write(Object value, OutputStream output, Operation operation)
throws IOException, ServiceException {
Encoder encoder = new Encoder(new WFSConfiguration());
encoder.setEncoding(Charset.forName(getInfo().getGeoServer().getSettings().getCharset()));
encoder.setOmitXMLDeclaration(Dispatcher.REQUEST.get().isSOAP());
String baseURL = (String) EMFUtils.get((EObject) operation.getParameters()[0], "baseUrl");
encoder.setSchemaLocation(WFS.NAMESPACE, buildSchemaURL(baseURL, "wfs/2.0/wfs.xsd"));
encode(encoder, value, output, operation);
}
内容来源于网络,如有侵权,请联系作者删除!