org.geotools.xml.Encoder.encode()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(171)

本文整理了Java中org.geotools.xml.Encoder.encode()方法的一些代码示例,展示了Encoder.encode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Encoder.encode()方法的具体详情如下:
包路径:org.geotools.xml.Encoder
类名称:Encoder
方法名:encode

Encoder.encode介绍

[英]Encodes an object.

An object is encoded as an object, name pair, where the name is the name of an element declaration in a schema.
[中]对一个对象进行编码。
对象被编码为对象名称对,其中名称是模式中元素声明的名称。

代码示例

代码示例来源:origin: org.geoserver/gs-wfs

@Override
  protected void encode(Encoder encoder, Object value, OutputStream output, Operation op)
      throws IOException, ServiceException {
    encoder.encode(value, WFS.TransactionResponse, output);
  }
}

代码示例来源:origin: org.geoserver/gs-wfs

@Override
  protected void encode(Encoder encoder, Object value, OutputStream output, Operation op)
      throws IOException, ServiceException {
    encoder.encode(value, WFS.LockFeatureResponse, output);
  }
}

代码示例来源:origin: org.geoserver/gs-wfs

@Override
  protected void encode(Encoder encoder, Object value, OutputStream output, Operation op)
      throws IOException, ServiceException {

    encoder.encode(value, WFS.DescribeStoredQueriesResponse, output);
  }
}

代码示例来源:origin: org.geotools.xsd/gt-core

/**
 * @deprecated use {@link #encode(Object, QName, OutputStream)}.
 *
 */
public void write(Object object, QName name, OutputStream out)
  throws IOException, SAXException {
  encode(object, name, out);
}

代码示例来源:origin: org.geotools/gt2-xml-core

/**
 * @deprecated use {@link #encode(Object, QName, OutputStream)}.
 *
 */
public void write(Object object, QName name, OutputStream out)
  throws IOException, SAXException {
  encode(object, name, out);
}

代码示例来源:origin: org.geoserver/gs-wfs

@Override
  protected void encode(Encoder encoder, Object value, OutputStream output, Operation op)
      throws IOException, ServiceException {
    encoder.encode(value, WFS.DropStoredQueryResponse, output);
  }
}

代码示例来源:origin: org.geoserver/gs-wfs

@Override
  protected void encode(Encoder encoder, Object value, OutputStream output, Operation op)
      throws IOException, ServiceException {
    encoder.encode(value, WFS.CreateStoredQueryResponse, output);
  }
}

代码示例来源: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/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/gs-wfs

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);
}

代码示例来源: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.geotools/gt-wfs

private static void encode(EObject request, Encoder encoder, OutputStream out)
    throws IOException {
  encoder.setIndentSize(1);
  QName encodeElementName = getElementName(request);
  encoder.encode(request, encodeElementName, out);
}

代码示例来源: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.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/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

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);
  }
}

相关文章