gpt4 book ai didi

org.geotools.ysld.parse.YsldParser类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 09:01:31 27 4
gpt4 key购买 nike

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

YsldParser介绍

[英]Parses a Yaml/Ysld stream into GeoTools style objects by returning a StyledLayerDescriptor from the #parse() method.
[中]通过从#parse()方法返回StyledLayerDescriptor,将Yaml/Ysld流解析为GeoTools样式的对象。

代码示例

代码示例来源:origin: geotools/geotools

/**
 * Parses a Ysld stream into GeoTools style objects.
 *
 * @param ysld The Ysld content, anything accepted by {@link #reader(Object)}.
 * @param locator Resource locator for resolving relative URIs.
 * @return The GeoTools SLD object.
 */
public static StyledLayerDescriptor parse(
    Object ysld,
    @Nullable List<ZoomContextFinder> zCtxtFinders,
    @Nullable ResourceLocator locator,
    @Nullable UomMapper uomMapper)
    throws IOException {
  YsldInput in = reader(ysld);
  try {
    YsldParser parser = new YsldParser(in.reader);
    if (zCtxtFinders != null) {
      parser.setZoomContextFinders(zCtxtFinders);
    }
    if (locator != null) {
      parser.setResourceLocator(locator);
    }
    if (uomMapper != null) {
      parser.setUomMapper(uomMapper);
    }
    return parser.parse();
  } finally {
    in.close();
  }
}

代码示例来源:origin: geotools/geotools

Style parse(String dir, String file) throws IOException {
  StringWriter writer = new StringWriter();
  transform(YsldTests.sld(dir, file), writer);
  // System.out.println(writer.toString());
  YsldParser p = new YsldParser(new StringReader(writer.toString()));
  return SLD.defaultStyle(p.parse());
}

代码示例来源:origin: geotools/geotools

@Test
public void testEncodeColorMapEntry() throws IOException {
  StyledLayerDescriptor style =
      new YsldParser(
              new ByteArrayInputStream(
                  ("name:  Test\n"
                          + "            - ['#e20374', 1.0, 1, Lorem Ipsum (magenta = covered)]")
                      .getBytes()))
          .parse();

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

/**
 * Parses a Ysld stream into GeoTools style objects.
 *
 * @param ysld The Ysld content, anything accepted by {@link #reader(Object)}.
 * @param locator Resource locator for resolving relative URIs.
 * @return The GeoTools SLD object.
 */
public static StyledLayerDescriptor parse(
    Object ysld,
    @Nullable List<ZoomContextFinder> zCtxtFinders,
    @Nullable ResourceLocator locator,
    @Nullable UomMapper uomMapper)
    throws IOException {
  YsldInput in = reader(ysld);
  try {
    YsldParser parser = new YsldParser(in.reader);
    if (zCtxtFinders != null) {
      parser.setZoomContextFinders(zCtxtFinders);
    }
    if (locator != null) {
      parser.setResourceLocator(locator);
    }
    if (uomMapper != null) {
      parser.setUomMapper(uomMapper);
    }
    return parser.parse();
  } finally {
    in.close();
  }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com