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

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

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

Fill.getGraphicFill介绍

[英]This parameter indicates that a stipple-fill repeated graphic will be used and specifies the fill graphic to use.
[中]此参数表示将使用点画填充重复图形,并指定要使用的填充图形。

代码示例

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

  1. @Test
  2. public void testSEStyleWithRelativePathProtocol() throws IOException {
  3. StyleInfo si = getCatalog().getStyleByName("relative_protocol");
  4. assertNotNull(si);
  5. Style style = si.getStyle();
  6. PolygonSymbolizer ps =
  7. (PolygonSymbolizer)
  8. style.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0);
  9. ExternalGraphic eg =
  10. (ExternalGraphic) ps.getFill().getGraphicFill().graphicalSymbols().get(0);
  11. URI uri = eg.getOnlineResource().getLinkage();
  12. assertNotNull(uri);
  13. File actual = URLs.urlToFile(uri.toURL()).getCanonicalFile();
  14. assertEquals(rockFillSymbolFile, actual);
  15. }

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

  1. @Test
  2. public void testSEStyleWithRelativePath() throws IOException {
  3. StyleInfo si = getCatalog().getStyleByName("relative");
  4. assertNotNull(si);
  5. Style style = si.getStyle();
  6. PolygonSymbolizer ps =
  7. (PolygonSymbolizer)
  8. style.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0);
  9. ExternalGraphic eg =
  10. (ExternalGraphic) ps.getFill().getGraphicFill().graphicalSymbols().get(0);
  11. URI uri = eg.getOnlineResource().getLinkage();
  12. assertNotNull(uri);
  13. File actual = URLs.urlToFile(uri.toURL()).getCanonicalFile();
  14. assertEquals(rockFillSymbolFile, actual);
  15. }

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

  1. @Override
  2. public void visit(Fill fill) {
  3. if (fill.getGraphicFill() != null) {
  4. fill.getGraphicFill().accept(this);
  5. }
  6. }

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

  1. private void rescaleFill(Fill copyFill, Unit<Length> unit) {
  2. // rescale the graphic fill, if any
  3. if (copyFill != null) {
  4. rescale(copyFill.getGraphicFill(), unit);
  5. }
  6. }

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

  1. LOGGER.finest("fill graphic " + fill.getGraphicFill());

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

  1. protected Paint getPaint(Fill fill, Object feature, Symbolizer symbolizer) {
  2. if (fill == null) {
  3. return null;
  4. }
  5. // get fill color
  6. Paint fillPaint = evalToColor(fill.getColor(), feature, null);
  7. // if a graphic fill is to be used, prepare the paint accordingly....
  8. org.geotools.styling.Graphic gr = fill.getGraphicFill();
  9. if (gr != null && gr.graphicalSymbols() != null && gr.graphicalSymbols().size() > 0) {
  10. fillPaint = getTexturePaint(gr, feature, symbolizer);
  11. }
  12. return fillPaint;
  13. }

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

  1. @Override
  2. protected void encode(Fill fill) {
  3. putColor("fill-color", fill.getColor());
  4. put("fill-opacity", nullIf(fill.getOpacity(), 1d));
  5. if (fill.getGraphicFill() != null) {
  6. push("fill-graphic").inline(new GraphicEncoder(fill.getGraphicFill()));
  7. }
  8. }
  9. }

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

  1. public void visit(Fill fill) {
  2. start("Fill");
  3. if (fill.getGraphicFill() != null) {
  4. start("GraphicFill");
  5. fill.getGraphicFill().accept(this);
  6. end("GraphicFill");
  7. }
  8. encodeCssParam("fill", fill.getColor(), "#808080");
  9. encodeCssParam("fill-opacity", fill.getOpacity(), 1.0);
  10. end("Fill");
  11. }

代码示例来源: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. /** Computes and returns the fill based on the feature and the symbolizer */
  2. public java.awt.Paint getFill() {
  3. Fill fill = ps.getFill();
  4. if (fill == null) {
  5. return null;
  6. }
  7. Paint fillPaint = (Color) fill.getColor().evaluate(feature, Color.class);
  8. // if a graphic fill is to be used, prepare the paint accordingly....
  9. org.geotools.styling.Graphic gr = fill.getGraphicFill();
  10. if (gr != null) {
  11. SLDStyleFactory fac = new SLDStyleFactory();
  12. fillPaint = fac.getTexturePaint(gr, feature, ps);
  13. }
  14. return fillPaint;
  15. }

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

  1. /** @see org.geotools.styling.StyleVisitor#visit(org.geotools.styling.Fill) */
  2. public void visit(Fill fill) {
  3. if (fill.getBackgroundColor() != null) {
  4. fill.getBackgroundColor().accept(this, null);
  5. }
  6. if (fill.getColor() != null) {
  7. fill.getColor().accept(this, null);
  8. }
  9. if (fill.getGraphicFill() != null) {
  10. fill.getGraphicFill().accept(this);
  11. }
  12. if (fill.getOpacity() != null) {
  13. fill.getOpacity().accept(this, null);
  14. }
  15. }

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

  1. if (fill.getGraphicFill() != null) {
  2. double size = evalToDouble(fill.getGraphicFill().getSize(), feature, 0);
  3. if (isVectorRenderingEnabled() || size > MAX_RASTERIZATION_SIZE) {
  4. feature, symbolizer, fill.getGraphicFill(), scaleRange, false);
  5. if (!(style2DFill instanceof GraphicStyle2D)) {
  6. style.setGraphicFill(style2DFill);

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

  1. private void rescaleFill(Fill copyFill, double mapScale, Unit<Length> unit) {
  2. // rescale the graphic fill, if any
  3. if (copyFill != null) {
  4. rescale(copyFill.getGraphicFill(), mapScale, unit);
  5. }
  6. }

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

  1. Graphic g = poly.getFill().getGraphicFill();

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

  1. @Override
  2. public void visit(Fill fill) {
  3. if (fill.getColor() != null) {
  4. //fill.getColor().accept(visitor, extraData)
  5. }
  6. if (fill.getGraphicFill() != null) {
  7. fill.getGraphicFill().accept(this);
  8. }
  9. if (fill.getOpacity() != null) {
  10. //fill.getOpacity().accept(visitor, extraData)
  11. }
  12. }

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

  1. Mark mark = SLD.mark(poly.getFill().getGraphicFill());
  2. assertEquals("shape://times", Filters.asString(mark.getWellKnownName()));
  3. assertEquals(1, SLD.width(mark.getStroke()));
  4. assertEquals(16, Filters.asInt(poly.getFill().getGraphicFill().getSize()));

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

  1. Mark rm = (Mark) rps.getStroke().getGraphicStroke().graphicalSymbols().get(0);
  2. assertEquals(10.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d);
  3. rm = (Mark) rps.getFill().getGraphicFill().graphicalSymbols().get(0);
  4. assertEquals(20.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d);

代码示例来源: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. Mark rm = (Mark) rps.getStroke().getGraphicStroke().graphicalSymbols().get(0);
  2. assertEquals(2.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d);
  3. rm = (Mark) rps.getFill().getGraphicFill().graphicalSymbols().get(0);
  4. assertEquals(4.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d);

相关文章