org.geotools.styling.Rule.getMaxScaleDenominator()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(130)

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

Rule.getMaxScaleDenominator介绍

[英]The largest value for scale denominator at which symbolizers contained by this rule should be applied.
[中]应应用此规则包含的符号的比例分母的最大值。

代码示例

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

/**
 * Checks if a rule can be triggered at the current scale level
 *
 * @param r The rule
 * @return true if the scale is compatible with the rule settings
 */
private boolean isWithInScale(Rule r) {
  return ((r.getMinScaleDenominator() - TOLERANCE) <= scaleDenominator)
      && ((r.getMaxScaleDenominator() + TOLERANCE) > scaleDenominator);
}

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

/**
 * Returns the max scale of the default (first) rule
 *
 * @param fts the feature type style
 * @return min scale or NaN if no max scale is set
 */
public static double maxScale(FeatureTypeStyle fts) {
  if (fts == null || fts.rules().isEmpty()) return Double.NaN;
  return fts.rules().get(0).getMaxScaleDenominator();
}

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

public RuleBuilder reset(Rule rule) {
  if (rule == null) {
    return unset();
  }
  name = rule.getName();
  title = rule.getTitle();
  ruleAbstract = rule.getAbstract();
  minScaleDenominator = rule.getMinScaleDenominator();
  maxScaleDenominator = rule.getMaxScaleDenominator();
  filter = rule.getFilter();
  elseFilter = rule.isElseFilter();
  symbolizers.clear();
  symbolizers.addAll(rule.symbolizers()); // TODO: unpack into builders in order to "copy"
  symbolizerBuilder = null;
  unset = false;
  legend.reset(rule.getLegend());
  return this;
}

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

copy.setFilter(filterCopy);
copy.setElseFilter(rule.isElseFilter());
copy.setMaxScaleDenominator(rule.getMaxScaleDenominator());
copy.setMinScaleDenominator(rule.getMinScaleDenominator());

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

@SuppressWarnings("unchecked")
@Test
public void testCustomFinderOverridesWellKnown() throws IOException {
  String yaml =
      "grid:\n"
          + "  name: WebMercator\n"
          + "feature-styles: \n"
          + "- name: name\n"
          + "  rules:\n"
          + "  - zoom: "
          + tuple(0, 0);
  ZoomContextFinder finder = createMock(ZoomContextFinder.class);
  ZoomContext context = createMock(ZoomContext.class);
  expect(finder.get("WebMercator")).andReturn(context);
  expect(context.getRange(0, 0)).andReturn(new ScaleRange(42, 64));
  replay(finder, context);
  StyledLayerDescriptor sld = Ysld.parse(yaml, Arrays.asList(finder), (ResourceLocator) null);
  FeatureTypeStyle fs = SLD.defaultStyle(sld).featureTypeStyles().get(0);
  fs.rules().get(0).getMaxScaleDenominator();
  assertThat(
      (Iterable<Rule>) fs.rules(),
      hasItems(
          allOf(
              Matchers.<Rule>hasProperty(
                  "maxScaleDenominator", Matchers.closeTo(64, 0.0000001d)),
              Matchers.<Rule>hasProperty(
                  "minScaleDenominator", Matchers.closeTo(42, 0.0000001d)))));
  verify(finder, context);
}

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

@SuppressWarnings("unchecked")
@Test
public void testNamedWithFinder() throws IOException {
  String yaml =
      "grid:\n"
          + "  name: test\n"
          + "feature-styles: \n"
          + "- name: name\n"
          + "  rules:\n"
          + "  - zoom: "
          + tuple(0, 0);
  ZoomContextFinder finder = createMock(ZoomContextFinder.class);
  ZoomContext context = createMock(ZoomContext.class);
  expect(finder.get("test")).andReturn(context);
  expect(context.getRange(0, 0)).andReturn(new ScaleRange(42, 64));
  replay(finder, context);
  StyledLayerDescriptor sld = Ysld.parse(yaml, Arrays.asList(finder), (ResourceLocator) null);
  FeatureTypeStyle fs = SLD.defaultStyle(sld).featureTypeStyles().get(0);
  fs.rules().get(0).getMaxScaleDenominator();
  assertThat(
      (Iterable<Rule>) fs.rules(),
      hasItems(
          allOf(
              Matchers.<Rule>hasProperty(
                  "maxScaleDenominator", Matchers.closeTo(64, 0.0000001d)),
              Matchers.<Rule>hasProperty(
                  "minScaleDenominator", Matchers.closeTo(42, 0.0000001d)))));
  verify(finder, context);
}

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

/**
 * Checks if a rule can be triggered at the current scale level
 * 
 * @param r
 *            The rule
 * @return true if the scale is compatible with the rule settings
 */
private boolean isWithInScale(Rule r) {
  return ((r.getMinScaleDenominator() - TOLERANCE) <= scaleDenominator)
  && ((r.getMaxScaleDenominator() + TOLERANCE) > scaleDenominator);
}

代码示例来源:origin: org.geotools/gt-widgets-swing-pending

public Component getComponent(TreePath[] selection) {
  ContextTreeNode node = (ContextTreeNode) selection[0].getLastPathComponent();  
  rule = (Rule) node.getUserObject() ;
  gui_scale.setValue( rule.getMaxScaleDenominator() );
  return this;
}

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

/**
 * Checks if a rule can be triggered at the current scale level
 * 
 * @param r
 *            The rule
 * @return true if the scale is compatible with the rule settings
 */
public static boolean isWithInScale(Rule r, double scaleDenominator) {
  return ((r.getMinScaleDenominator() - TOLERANCE) <= scaleDenominator)
      && ((r.getMaxScaleDenominator() + TOLERANCE) > scaleDenominator);
}

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

/**
 * Checks if a rule can be triggered at the current scale level
 * 
 * @param r The rule
 * @return true if the scale is compatible with the rule settings
 */
private boolean isWithInScale( Rule r ) {
  return ((r.getMinScaleDenominator() - TOLERANCE) <= scaleDenominator)
      && ((r.getMaxScaleDenominator() + TOLERANCE) > scaleDenominator);
}

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

/**
 * Checks if a rule can be triggered at the current scale level
 * 
 * @param r
 *            The rule
 * @return true if the scale is compatible with the rule settings
 */
private boolean isWithInScale(Rule r) {
  return ((r.getMinScaleDenominator() - TOLERANCE) <= scaleDenominator)
      && ((r.getMaxScaleDenominator() + TOLERANCE) > scaleDenominator);
}

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

/**
 * Checks if a rule can be triggered at the current scale level
 * 
 * @return true if the scale is compatible with the rule settings
 */
private static boolean isWithInScale(Rule r, double scaleDenominator) {
  /** Tolerance used to compare doubles for equality */
  final double TOLERANCE = 1e-6;
  return ((r.getMinScaleDenominator() - TOLERANCE) <= scaleDenominator)
      && ((r.getMaxScaleDenominator() + TOLERANCE) > scaleDenominator);
}

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

/**
 * Checks if a rule can be triggered at the current scale level
 *
 * @return true if the scale is compatible with the rule settings
 */
private static boolean isWithInScale(Rule r, double scaleDenominator) {
  /** Tolerance used to compare doubles for equality */
  final double TOLERANCE = 1e-6;
  return ((r.getMinScaleDenominator() - TOLERANCE) <= scaleDenominator)
      && ((r.getMaxScaleDenominator() + TOLERANCE) > scaleDenominator);
}

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

/**
 * Returns the max scale of the default (first) rule
 *
 * @param fts the feature type style
 *
 * @return min scale or NaN if no max scale is set
 */
public static double maxScale( FeatureTypeStyle fts ) {
  if(fts == null || fts.rules().isEmpty())
    return Double.NaN;
  return fts.rules().get(0).getMaxScaleDenominator();
}

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

if (rule.getMaxScaleDenominator() != Double.POSITIVE_INFINITY) {
  element("MaxScaleDenominator", rule.getMaxScaleDenominator() + "");

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

assertEquals(180000000d, rule.getMaxScaleDenominator(), 0.1);
assertEquals(360000000d, rule.getMaxScaleDenominator(), 0.1);
assertEquals(180000000d, rule.getMinScaleDenominator(), 0.1);

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

Rule rule = style.featureTypeStyles().get(0).rules().get(0);
assertEquals("Large", rule.getName());
assertEquals(160000000.0, rule.getMaxScaleDenominator(), 0.1);
assertEquals("Medium", rule.getName());
assertEquals(160000000.0, rule.getMinScaleDenominator(), 0.1);
assertEquals(320000000.0, rule.getMaxScaleDenominator(), 0.1);

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

Tuple.of(
        toStringOrNull(rule.getMinScaleDenominator(), "min"),
        toStringOrNull(rule.getMaxScaleDenominator(), "max"));
if (!t.isNull()) {
  put("scale", t);

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

assertEquals(100000000d, rule.getMaxScaleDenominator(), 0.1);
assertEquals(200000000d, rule.getMaxScaleDenominator(), 0.1);
assertEquals(100000000d, rule.getMinScaleDenominator(), 0.1);

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

public void visit(Rule rule) {
  if (rule.getMinScaleDenominator() < scaleDenominator
      && rule.getMaxScaleDenominator() > scaleDenominator) {
    for (Symbolizer s : rule.symbolizers()) s.accept(this);
  }
}

相关文章