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

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

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

Encoder.setIndenting介绍

[英]Sets the indentation on and off.

When set on, the default indentation level and default line wrapping is used (see #getIndentSize() and #getLineWidth()). To specify a different indentation level or line wrapping, use #setIndent(int) and #setLineWidth(int)).
[中]打开和关闭缩进。
设置为on时,将使用默认缩进级别和默认换行(请参见#getIndentSize()和#getLineWidth())。要指定不同的缩进级别或换行,请使用#setIndent(int)和#setLineWidth(int))。

代码示例

代码示例来源:origin: org.geoserver.community/gs-oseo-core

private void encodeGmlRssGeometry(Geometry g) {
  try {
    // get the proper element name
    QName elementName = null;
    if (g instanceof Polygon) {
      elementName = org.geotools.gml2.GML.Polygon;
    } else if (g instanceof MultiPoint) {
      elementName = org.geotools.gml2.GML.MultiPoint;
    } else {
      elementName = org.geotools.gml2.GML._Geometry;
    }
    // encode in GML3
    Encoder encoder = new Encoder(GML_CONFIGURATION);
    encoder.setInline(true);
    encoder.setIndenting(true);
    encoder.encode(g, elementName, contentHandler);
  } catch (Exception e) {
    throw new RuntimeException("Cannot transform the specified geometry in GML", e);
  }
}

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

fos = new FileOutputStream(target);
Encoder encoder = new Encoder(cfg);
encoder.setIndenting(true);
encoder.setIndentSize(2);
encoder.encode(gft, elementName, fos);

代码示例来源:origin: org.geoserver/wcs1_1

encoder.setIndenting(true);
encoder.setIndentSize(2);
encoder.setLineWidth(60);

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

encoder.setIndenting(true);
encoder.setIndentSize(2);
encoder.setLineWidth(60);

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

/**
 * Returns the xml encoding of the created request.
 *
 * @param version
 * @throws IOException
 */
public String asXML(String version) throws IOException {
  if ("1.1.1".equals(version)) {
    Encoder encoder = new Encoder(new org.geotools.wcs.v1_1.WCSConfiguration());
    encoder.setIndenting(true);
    encoder.setOmitXMLDeclaration(true);
    // prefix is set to 'null' if we don't declare it explicitly
    encoder.getNamespaces().declarePrefix("ows", "http://www.opengis.net/ows/1.1");
    return encoder.encodeAsString(wcs111GetCoverage, org.geotools.wcs.v1_1.WCS.GetCoverage);
  } else {
    Encoder encoder = new Encoder(new WCSConfiguration());
    encoder.setIndenting(true);
    encoder.setOmitXMLDeclaration(true);
    return encoder.encodeAsString(getCoverageType, WCS.GetCoverage);
  }
}

相关文章