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

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

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

Fill.setGraphicFill介绍

[英]This parameter indicates that a stipple-fill repeated graphic will be used and specifies the fill graphic to use.
[中]

代码示例

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

@Override
  protected void graphic(Graphic g) {
    fill().setGraphicFill(g);
  }
});

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

if (LOGGER.isLoggable(Level.FINEST))
  LOGGER.finest("setting fill graphic with " + g);
fill.setGraphicFill(g);

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

fill.setGraphicFill(graphicFill);

代码示例来源: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

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: org.geotools/gt-ysld

@Override
  protected void graphic(Graphic g) {
    fill().setGraphicFill(g);
  }
});

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

public void testTexturePaintNoSize() throws Exception {
  PolygonSymbolizer symb = sf.createPolygonSymbolizer();
  Mark myMark = sf.createMark();
  myMark.setWellKnownName(ff.literal("square"));
  org.geotools.styling.Fill fill = sf.createFill(null);
  fill.setGraphicFill(sf.createGraphic(null, new Mark[] {myMark}, null, null, null, null));
  symb.setFill(fill);
  PolygonStyle2D ps = sld.createPolygonStyle(feature, symb, range);
  assertTrue(ps.getFill() instanceof TexturePaint);
}

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

@Test
  public void testRescalePolygonMargin() throws Exception {
    // create a graphic that needs rescaling
    StyleBuilder sb = new StyleBuilder();

    // a graphic fill
    Fill fill = sb.createFill();
    fill.setColor(null);
    fill.setGraphicFill(
        sb.createGraphic(null, sb.createMark("square", null, sb.createStroke(2)), null));

    // a polygon and line symbolizer using them
    PolygonSymbolizer polygonSymbolizer = sb.createPolygonSymbolizer(sb.createStroke(), fill);
    polygonSymbolizer.getOptions().put(PolygonSymbolizer.GRAPHIC_MARGIN_KEY, "1 2 3 4");

    // rescale it
    polygonSymbolizer.accept(visitor);
    PolygonSymbolizer rps = (PolygonSymbolizer) visitor.getCopy();
    Mark rm = (Mark) rps.getFill().getGraphicFill().graphicalSymbols().get(0);
    assertEquals(4.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d);
    assertEquals("2 4 6 8", rps.getOptions().get(PolygonSymbolizer.GRAPHIC_MARGIN_KEY));
  }
}

代码示例来源: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(sb.colorExpression(Color.BLACK));
  }
}

代码示例来源: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: org.geotools/gt-main

if (LOGGER.isLoggable(Level.FINEST))
  LOGGER.finest("setting fill graphic with " + g);
fill.setGraphicFill(g);

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

Graphic g = parseGraphic(child);
LOGGER.finest("setting fill graphic with " + g);
fill.setGraphicFill(g);

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

fill.setGraphicFill(
    sb.createGraphic(null, sb.createMark("square", null, sb.createStroke(2)), null));

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

private void butFillActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butFillActionPerformed
  JDialog dia = new JDialog();
  JGraphicPane pane = new JGraphicPane();
  pane.setLayer(layer);
  if (fill != null) {
    pane.setEdited(fill.getGraphicFill());
  }
  dia.setContentPane(pane);
  dia.pack();
  dia.setLocationRelativeTo(butFill);
  dia.setModal(true);
  dia.setVisible(true);
  if (fill == null) {
    fill = new StyleBuilder().createFill();
  }
  fill.setGraphicFill(pane.getEdited());
}//GEN-LAST:event_butFillActionPerformed

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

fill.setGraphicFill(graphicFill);

代码示例来源: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: geotools/geotools

fill.setGraphicFill(
    sb.createGraphic(null, sb.createMark("square", null, sb.createStroke(2)), null));

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

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: org.geotools/gt2-main

public Fill createFill(Expression color, Expression backgroundColor,
  Expression opacity, Graphic graphicFill) {
  Fill fill = new FillImpl();
  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: org.geoserver/gs-wms

@Test // this one should fail now??
  public void testDynamicStrokeInGraphicFill() {
    Stroke markStroke = sb.createStroke();
    markStroke.setWidth(sb.getFilterFactory().property("myAttribute"));
    Mark mark = sb.createMark("square");
    mark.setStroke(markStroke);
    Graphic graphic = sb.createGraphic(null, mark, null);
    PolygonSymbolizer ps = sb.createPolygonSymbolizer();
    ps.getFill().setGraphicFill(graphic);

    Style style = sb.createStyle(ps);
    style.accept(visitor);
    Style copy = (Style) visitor.getCopy();
    assertNull(copy);
  }
}

相关文章