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

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

本文整理了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

  1. @Override
  2. protected void graphic(Graphic g) {
  3. fill().setGraphicFill(g);
  4. }
  5. });

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

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

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

  1. fill.setGraphicFill(graphicFill);

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

  1. public void visit(Fill fill) {
  2. Fill copy = sf.getDefaultFill();
  3. copy.setBackgroundColor(copy(fill.getBackgroundColor()));
  4. copy.setColor(copy(fill.getColor()));
  5. copy.setGraphicFill(copy(fill.getGraphicFill()));
  6. copy.setOpacity(copy(fill.getOpacity()));
  7. if (STRICT && !copy.equals(fill)) {
  8. throw new IllegalStateException("Was unable to duplicate provided Fill:" + fill);
  9. }
  10. pages.push(copy);
  11. }

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

  1. public Fill createFill(
  2. Expression color, Expression backgroundColor, Expression opacity, Graphic graphicFill) {
  3. Fill fill = new FillImpl(filterFactory);
  4. if (color == null) {
  5. color = Fill.DEFAULT.getColor();
  6. }
  7. fill.setColor(color);
  8. if (backgroundColor == null) {
  9. backgroundColor = Fill.DEFAULT.getBackgroundColor();
  10. }
  11. fill.setBackgroundColor(backgroundColor);
  12. if (opacity == null) {
  13. opacity = Fill.DEFAULT.getOpacity();
  14. }
  15. // would be nice to check if this was within bounds but we have to wait until use since it
  16. // may depend on an attribute
  17. fill.setOpacity(opacity);
  18. fill.setGraphicFill(graphicFill);
  19. return fill;
  20. }

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

  1. @Override
  2. protected void graphic(Graphic g) {
  3. fill().setGraphicFill(g);
  4. }
  5. });

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

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

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

  1. @Test
  2. public void testRescalePolygonMargin() throws Exception {
  3. // create a graphic that needs rescaling
  4. StyleBuilder sb = new StyleBuilder();
  5. // a graphic fill
  6. Fill fill = sb.createFill();
  7. fill.setColor(null);
  8. fill.setGraphicFill(
  9. sb.createGraphic(null, sb.createMark("square", null, sb.createStroke(2)), null));
  10. // a polygon and line symbolizer using them
  11. PolygonSymbolizer polygonSymbolizer = sb.createPolygonSymbolizer(sb.createStroke(), fill);
  12. polygonSymbolizer.getOptions().put(PolygonSymbolizer.GRAPHIC_MARGIN_KEY, "1 2 3 4");
  13. // rescale it
  14. polygonSymbolizer.accept(visitor);
  15. PolygonSymbolizer rps = (PolygonSymbolizer) visitor.getCopy();
  16. Mark rm = (Mark) rps.getFill().getGraphicFill().graphicalSymbols().get(0);
  17. assertEquals(4.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d);
  18. assertEquals("2 4 6 8", rps.getOptions().get(PolygonSymbolizer.GRAPHIC_MARGIN_KEY));
  19. }
  20. }

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

  1. @Override
  2. public void visit(Fill fill) {
  3. super.visit(fill);
  4. Fill copy = (Fill) pages.peek();
  5. if (copy.getGraphicFill() != null) {
  6. copy.setGraphicFill(null);
  7. copy.setColor(sb.colorExpression(Color.BLACK));
  8. }
  9. }

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

  1. @Override
  2. public void visit(Fill fill) {
  3. super.visit(fill);
  4. Fill copy = (Fill) pages.peek();
  5. if (copy.getGraphicFill() != null) {
  6. copy.setGraphicFill(null);
  7. }
  8. copy.setColor(colorFunction);
  9. copy.setOpacity(LITERAL_ONE);
  10. }

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

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

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

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

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

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

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

  1. private void butFillActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butFillActionPerformed
  2. JDialog dia = new JDialog();
  3. JGraphicPane pane = new JGraphicPane();
  4. pane.setLayer(layer);
  5. if (fill != null) {
  6. pane.setEdited(fill.getGraphicFill());
  7. }
  8. dia.setContentPane(pane);
  9. dia.pack();
  10. dia.setLocationRelativeTo(butFill);
  11. dia.setModal(true);
  12. dia.setVisible(true);
  13. if (fill == null) {
  14. fill = new StyleBuilder().createFill();
  15. }
  16. fill.setGraphicFill(pane.getEdited());
  17. }//GEN-LAST:event_butFillActionPerformed

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

  1. fill.setGraphicFill(graphicFill);

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

  1. public void visit(Fill fill) {
  2. Fill copy = sf.getDefaultFill();
  3. copy.setBackgroundColor( copy( fill.getBackgroundColor()) );
  4. copy.setColor(copy( fill.getColor()));
  5. copy.setGraphicFill( copy(fill.getGraphicFill()));
  6. copy.setOpacity( copy(fill.getOpacity()));
  7. if( STRICT && !copy.equals( fill )){
  8. throw new IllegalStateException("Was unable to duplicate provided Fill:"+fill );
  9. }
  10. pages.push(copy);
  11. }

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

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

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

  1. public Fill createFill(Expression color, Expression backgroundColor,
  2. Expression opacity, Graphic graphicFill) {
  3. Fill fill = new FillImpl(filterFactory);
  4. if (color == null) {
  5. color = Fill.DEFAULT.getColor();
  6. }
  7. fill.setColor(color);
  8. if (backgroundColor == null) {
  9. backgroundColor = Fill.DEFAULT.getBackgroundColor();
  10. }
  11. fill.setBackgroundColor(backgroundColor);
  12. if (opacity == null) {
  13. opacity = Fill.DEFAULT.getOpacity();
  14. }
  15. // would be nice to check if this was within bounds but we have to wait until use since it may depend on an attribute
  16. fill.setOpacity(opacity);
  17. fill.setGraphicFill(graphicFill);
  18. return fill;
  19. }

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

  1. public Fill createFill(Expression color, Expression backgroundColor,
  2. Expression opacity, Graphic graphicFill) {
  3. Fill fill = new FillImpl();
  4. if (color == null) {
  5. color = Fill.DEFAULT.getColor();
  6. }
  7. fill.setColor(color);
  8. if (backgroundColor == null) {
  9. backgroundColor = Fill.DEFAULT.getBackgroundColor();
  10. }
  11. fill.setBackgroundColor(backgroundColor);
  12. if (opacity == null) {
  13. opacity = Fill.DEFAULT.getOpacity();
  14. }
  15. // would be nice to check if this was within bounds but we have to wait until use since it may depend on an attribute
  16. fill.setOpacity(opacity);
  17. fill.setGraphicFill(graphicFill);
  18. return fill;
  19. }

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

  1. @Test // this one should fail now??
  2. public void testDynamicStrokeInGraphicFill() {
  3. Stroke markStroke = sb.createStroke();
  4. markStroke.setWidth(sb.getFilterFactory().property("myAttribute"));
  5. Mark mark = sb.createMark("square");
  6. mark.setStroke(markStroke);
  7. Graphic graphic = sb.createGraphic(null, mark, null);
  8. PolygonSymbolizer ps = sb.createPolygonSymbolizer();
  9. ps.getFill().setGraphicFill(graphic);
  10. Style style = sb.createStyle(ps);
  11. style.accept(visitor);
  12. Style copy = (Style) visitor.getCopy();
  13. assertNull(copy);
  14. }
  15. }

相关文章