org.geotools.ysld.parse.YamlParseContext.getDocHint()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(94)

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

YamlParseContext.getDocHint介绍

暂无

代码示例

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

protected ZoomContext getZoomContext(YamlParseContext context) {
    return Util.forceDefaultForNull(
        (ZoomContext) context.getDocHint(ZoomContext.HINT_ID),
        WellKnownZoomContextFinder.getInstance().get("DEFAULT"));
  }
}

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

@Test
  public void testDocHints() throws Exception {
    YamlParseContext ctxt = new YamlParseContext();
    YamlParseHandler handler = createMock(YamlParseHandler.class);
    YamlObject obj1 = createMock(YamlObject.class);

    replay(handler);

    ctxt.push(obj1, handler);

    assertThat(ctxt.getDocHint("testHint1"), nullValue());
    ctxt.setDocHint("testHint1", "th1v1");
    assertThat((String) ctxt.getDocHint("testHint1"), is("th1v1"));
    ctxt.setDocHint("testHint1", "th1v2");
    assertThat((String) ctxt.getDocHint("testHint1"), is("th1v2"));

    assertThat(ctxt.getDocHint("testHint2"), nullValue());
    ctxt.setDocHint("testHint2", "th2v1");
    assertThat((String) ctxt.getDocHint("testHint2"), is("th2v1"));
    assertThat((String) ctxt.getDocHint("testHint1"), is("th1v2"));

    verify(handler);
  }
}

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

@Override
  public void handle(YamlObject<?> obj, YamlParseContext context) {
    YamlMap map = obj.map();
    sym.setName(map.str("name"));
    if (map.has("geometry")) {
      sym.setGeometry(Util.expression(map.str("geometry"), factory));
    }
    UomMapper uomMapper = (UomMapper) context.getDocHint(UomMapper.KEY);
    if (map.has("uom")) {
      sym.setUnitOfMeasure(uomMapper.getUnit(map.str("uom")));
    }
    sym.getOptions().putAll(Util.vendorOptions(map));
  }
}

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

@Override
  public void handle(YamlObject<?> obj, YamlParseContext context) {
    externalGraphic(external);
    YamlMap map = obj.map();
    if (map.has("url")) {
      String value = map.str("url");
      try {
        external.setLocation(
            ((ResourceLocator) context.getDocHint("resourceLocator"))
                .locateResource(value));
      } catch (IllegalArgumentException e) {
        external.setURI("file:" + value);
      }
    }
    external.setFormat(map.str("format"));
  }
}

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

protected ZoomContext getZoomContext(YamlParseContext context) {
    return Util.forceDefaultForNull(
        (ZoomContext) context.getDocHint(ZoomContext.HINT_ID),
        WellKnownZoomContextFinder.getInstance().get("DEFAULT"));
  }
}

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

@Override
  public void handle(YamlObject<?> obj, YamlParseContext context) {
    YamlMap map = obj.map();
    sym.setName(map.str("name"));
    if (map.has("geometry")) {
      sym.setGeometry(Util.expression(map.str("geometry"), factory));
    }
    UomMapper uomMapper = (UomMapper) context.getDocHint(UomMapper.KEY);
    if (map.has("uom")) {
      sym.setUnitOfMeasure(uomMapper.getUnit(map.str("uom")));
    }
    sym.getOptions().putAll(Util.vendorOptions(map));
  }
}

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

@Override
  public void handle(YamlObject<?> obj, YamlParseContext context) {
    externalGraphic(external);
    YamlMap map = obj.map();
    if (map.has("url")) {
      String value = map.str("url");
      try {
        external.setLocation(
            ((ResourceLocator) context.getDocHint("resourceLocator"))
                .locateResource(value));
      } catch (IllegalArgumentException e) {
        external.setURI("file:" + value);
      }
    }
    external.setFormat(map.str("format"));
  }
}

相关文章