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

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

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

Fill.setOpacity介绍

[英]This specifies the level of translucency to use when rendering the fill.
The value is encoded as a floating-point value between 0.0 and 1.0 with 0.0 representing totally transparent and 1.0 representing totally opaque, with a linear scale of translucency for intermediate values.
For example, "0.65" would represent 65% opacity.
[中]这指定渲染填充时要使用的半透明级别。
该值被编码为介于0.0和1.0之间的浮点值,0.0表示完全透明,1.0表示完全不透明,中间值具有半透明的线性比例。
例如,“0.65”表示65%的不透明度。

代码示例

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

} else if (res.equalsIgnoreCase(opacityString)
    || res.equalsIgnoreCase("fill-opacity")) {
  fill.setOpacity(parseCssParameter(child));

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

public Fill getDefaultFill() {
  Fill fill = new FillImpl(filterFactory);
  try {
    fill.setColor(filterFactory.literal("#808080"));
    fill.setOpacity(filterFactory.literal(new Double(1.0)));
    fill.setBackgroundColor(filterFactory.literal("#FFFFFF"));
  } catch (org.geotools.filter.IllegalFilterException ife) {
    throw new RuntimeException("Error creating fill", ife);
  }
  return fill;
}

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

fill.setOpacity(opacity);

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

public void visit(Fill fill) {
  Fill copy = sf.getDefaultFill();
  copy.setBackgroundColor(copy(fill.getBackgroundColor()));
  copy.setColor(copy(fill.getColor()));
  copy.setGraphicFill(copy(fill.getGraphicFill()));
  copy.setOpacity(copy(fill.getOpacity()));
  if (STRICT && !copy.equals(fill)) {
    throw new IllegalStateException("Was unable to duplicate provided Fill:" + fill);
  }
  pages.push(copy);
}

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

/**
 * create a default fill 50% gray
 *
 * @return the fill created
 */
public Fill createFill() {
  Fill f = sf.getDefaultFill();
  f.setColor(literalExpression("#808080"));
  f.setBackgroundColor(literalExpression("#808080"));
  f.setOpacity(literalExpression(1.0));
  return f;
}

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

public Fill createFill(
    Expression color, Expression backgroundColor, Expression opacity, Graphic graphicFill) {
  Fill fill = new FillImpl(filterFactory);
  if (color == null) {
    color = Fill.DEFAULT.getColor();
  }
  fill.setColor(color);
  if (backgroundColor == null) {
    backgroundColor = Fill.DEFAULT.getBackgroundColor();
  }
  fill.setBackgroundColor(backgroundColor);
  if (opacity == null) {
    opacity = Fill.DEFAULT.getOpacity();
  }
  // would be nice to check if this was within bounds but we have to wait until use since it
  // may depend on an attribute
  fill.setOpacity(opacity);
  fill.setGraphicFill(graphicFill);
  return fill;
}

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

@Override
public void handle(YamlObject<?> obj, YamlParseContext context) {
  YamlMap map = obj.map();
  if (map.has("fill-color")) {
    fill().setColor(Util.color(map.get("fill-color"), factory));
  }
  if (map.has("fill-opacity")) {
    fill().setOpacity(Util.expression(map.str("fill-opacity"), factory));
  }
  context.push(
      "fill-graphic",
      new GraphicParser(factory) {
        @Override
        protected void graphic(Graphic g) {
          fill().setGraphicFill(g);
        }
      });
}

代码示例来源:origin: bcdev/beam

@Override
  public void visit(TextSymbolizer text) {
    super.visit(text);
    TextSymbolizer textCopy = (TextSymbolizer) pages.peek();
    Fill textFill = textCopy.getFill();
    if (textFill != null) {
      textFill.setOpacity(textExp);
    } else {
      textCopy.setFill(defaultTextFill);
    }
  }
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
  public void visit(TextSymbolizer text) {
    super.visit(text);
    TextSymbolizer textCopy = (TextSymbolizer) pages.peek();
    Fill textFill = textCopy.getFill();
    if (textFill != null) {
      textFill.setOpacity(textExp);
    } else {
      textCopy.setFill(defaultTextFill);
    }
  }
}

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

public Fill getDefaultFill() {
  Fill fill = new FillImpl();
  try {
    fill.setColor(filterFactory.literal("#808080"));
    fill.setOpacity(filterFactory.literal(
        new Double(1.0)));
  } catch (org.geotools.filter.IllegalFilterException ife) {
    throw new RuntimeException("Error creating fill", ife);
  }
  return fill;
}

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

public void apply() {
  if (fill != null) {
    fill.setColor(guiColor.getExpression());
    fill.setOpacity(guiAlpha.getExpression());
  }
}

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

@Override
public void visit(Fill fill) {
  super.visit(fill);
  Fill copy = (Fill) pages.peek();
  if (copy.getGraphicFill() != null) {
    copy.setGraphicFill(null);
  }
  copy.setColor(colorFunction);
  copy.setOpacity(LITERAL_ONE);
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public void visit(PolygonSymbolizer poly) {
  super.visit(poly);
  PolygonSymbolizer polyCopy = (PolygonSymbolizer) pages.peek();
  Fill polyFill = polyCopy.getFill();
  if (polyFill != null) {
    polyFill.setOpacity(polyFillExp);
  }
  Stroke polyStroke = polyCopy.getStroke();
  if (polyStroke != null) {
    polyStroke.setOpacity(polyStrokeExp);
  }
}

代码示例来源:origin: bcdev/beam

@Override
public void visit(PolygonSymbolizer poly) {
  super.visit(poly);
  PolygonSymbolizer polyCopy = (PolygonSymbolizer) pages.peek();
  Fill polyFill = polyCopy.getFill();
  if (polyFill != null) {
    polyFill.setOpacity(polyFillExp);
  }
  Stroke polyStroke = polyCopy.getStroke();
  if (polyStroke != null) {
    polyStroke.setOpacity(polyStrokeExp);
  }
}

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

public Fill getDefaultFill() {
  Fill fill = new FillImpl(filterFactory);
  try {
    fill.setColor(filterFactory.literal("#808080"));
    fill.setOpacity(filterFactory.literal(
        new Double(1.0)));
    fill.setBackgroundColor(filterFactory.literal("#FFFFFF"));
  } catch (org.geotools.filter.IllegalFilterException ife) {
    throw new RuntimeException("Error creating fill", ife);
  }
  return fill;
}

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

public void visit(Fill fill) {
  Fill copy = sf.getDefaultFill();
  copy.setBackgroundColor( copy( fill.getBackgroundColor()) );
  copy.setColor(copy( fill.getColor()));
  copy.setGraphicFill( copy(fill.getGraphicFill()));
  copy.setOpacity( copy(fill.getOpacity()));
  
  if( STRICT && !copy.equals( fill )){
    throw new IllegalStateException("Was unable to duplicate provided Fill:"+fill );
  }
  pages.push(copy);
}

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

/**
 * create a default fill 50% gray
 *
 * @return the fill created
 */
public Fill createFill() {
  Fill f = sf.getDefaultFill();
  f.setColor(literalExpression("#808080"));
  f.setBackgroundColor(literalExpression("#808080"));
  f.setOpacity(literalExpression(1.0));
  return f;
}

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

/**
 * create a default fill 50% gray
 *
 * @return the fill created
 */
public Fill createFill() {
  Fill f = sf.getDefaultFill();
  f.setColor(literalExpression("#808080"));
  f.setBackgroundColor(literalExpression("#808080"));
  f.setOpacity(literalExpression(1.0));
  return f;
}

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

public Style createPolygonStyle() {
  Style style = null;
  PolygonSymbolizer ps = sb.createPolygonSymbolizer(randomColor(), randomWidth());
  ps.getFill().setOpacity(sb.literalExpression(0.6f));
  style = sb.createStyle();
  style.addFeatureTypeStyle(sb.createFeatureTypeStyle(ps));
  return style;
}

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

@Override
public void handle(YamlObject<?> obj, YamlParseContext context) {
  YamlMap map = obj.map();
  if (map.has("fill-color")) {
    fill().setColor(Util.color(map.get("fill-color"), factory));
  }
  if (map.has("fill-opacity")) {
    fill().setOpacity(Util.expression(map.str("fill-opacity"), factory));
  }
  context.push(
      "fill-graphic",
      new GraphicParser(factory) {
        @Override
        protected void graphic(Graphic g) {
          fill().setGraphicFill(g);
        }
      });
}

相关文章