本文整理了Java中org.geotools.styling.Fill.getGraphicFill()
方法的一些代码示例,展示了Fill.getGraphicFill()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Fill.getGraphicFill()
方法的具体详情如下:
包路径:org.geotools.styling.Fill
类名称:Fill
方法名:getGraphicFill
[英]This parameter indicates that a stipple-fill repeated graphic will be used and specifies the fill graphic to use.
[中]此参数表示将使用点画填充重复图形,并指定要使用的填充图形。
代码示例来源:origin: geoserver/geoserver
@Test
public void testSEStyleWithRelativePathProtocol() throws IOException {
StyleInfo si = getCatalog().getStyleByName("relative_protocol");
assertNotNull(si);
Style style = si.getStyle();
PolygonSymbolizer ps =
(PolygonSymbolizer)
style.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0);
ExternalGraphic eg =
(ExternalGraphic) ps.getFill().getGraphicFill().graphicalSymbols().get(0);
URI uri = eg.getOnlineResource().getLinkage();
assertNotNull(uri);
File actual = URLs.urlToFile(uri.toURL()).getCanonicalFile();
assertEquals(rockFillSymbolFile, actual);
}
代码示例来源:origin: geoserver/geoserver
@Test
public void testSEStyleWithRelativePath() throws IOException {
StyleInfo si = getCatalog().getStyleByName("relative");
assertNotNull(si);
Style style = si.getStyle();
PolygonSymbolizer ps =
(PolygonSymbolizer)
style.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0);
ExternalGraphic eg =
(ExternalGraphic) ps.getFill().getGraphicFill().graphicalSymbols().get(0);
URI uri = eg.getOnlineResource().getLinkage();
assertNotNull(uri);
File actual = URLs.urlToFile(uri.toURL()).getCanonicalFile();
assertEquals(rockFillSymbolFile, actual);
}
代码示例来源:origin: geotools/geotools
@Override
public void visit(Fill fill) {
if (fill.getGraphicFill() != null) {
fill.getGraphicFill().accept(this);
}
}
代码示例来源:origin: geotools/geotools
private void rescaleFill(Fill copyFill, Unit<Length> unit) {
// rescale the graphic fill, if any
if (copyFill != null) {
rescale(copyFill.getGraphicFill(), unit);
}
}
代码示例来源:origin: geotools/geotools
LOGGER.finest("fill graphic " + fill.getGraphicFill());
代码示例来源:origin: geotools/geotools
protected Paint getPaint(Fill fill, Object feature, Symbolizer symbolizer) {
if (fill == null) {
return null;
}
// get fill color
Paint fillPaint = evalToColor(fill.getColor(), feature, null);
// if a graphic fill is to be used, prepare the paint accordingly....
org.geotools.styling.Graphic gr = fill.getGraphicFill();
if (gr != null && gr.graphicalSymbols() != null && gr.graphicalSymbols().size() > 0) {
fillPaint = getTexturePaint(gr, feature, symbolizer);
}
return fillPaint;
}
代码示例来源:origin: geotools/geotools
@Override
protected void encode(Fill fill) {
putColor("fill-color", fill.getColor());
put("fill-opacity", nullIf(fill.getOpacity(), 1d));
if (fill.getGraphicFill() != null) {
push("fill-graphic").inline(new GraphicEncoder(fill.getGraphicFill()));
}
}
}
代码示例来源:origin: geotools/geotools
public void visit(Fill fill) {
start("Fill");
if (fill.getGraphicFill() != null) {
start("GraphicFill");
fill.getGraphicFill().accept(this);
end("GraphicFill");
}
encodeCssParam("fill", fill.getColor(), "#808080");
encodeCssParam("fill-opacity", fill.getOpacity(), 1.0);
end("Fill");
}
代码示例来源: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
/** Computes and returns the fill based on the feature and the symbolizer */
public java.awt.Paint getFill() {
Fill fill = ps.getFill();
if (fill == null) {
return null;
}
Paint fillPaint = (Color) fill.getColor().evaluate(feature, Color.class);
// if a graphic fill is to be used, prepare the paint accordingly....
org.geotools.styling.Graphic gr = fill.getGraphicFill();
if (gr != null) {
SLDStyleFactory fac = new SLDStyleFactory();
fillPaint = fac.getTexturePaint(gr, feature, ps);
}
return fillPaint;
}
代码示例来源:origin: geotools/geotools
/** @see org.geotools.styling.StyleVisitor#visit(org.geotools.styling.Fill) */
public void visit(Fill fill) {
if (fill.getBackgroundColor() != null) {
fill.getBackgroundColor().accept(this, null);
}
if (fill.getColor() != null) {
fill.getColor().accept(this, null);
}
if (fill.getGraphicFill() != null) {
fill.getGraphicFill().accept(this);
}
if (fill.getOpacity() != null) {
fill.getOpacity().accept(this, null);
}
}
代码示例来源:origin: geotools/geotools
if (fill.getGraphicFill() != null) {
double size = evalToDouble(fill.getGraphicFill().getSize(), feature, 0);
if (isVectorRenderingEnabled() || size > MAX_RASTERIZATION_SIZE) {
feature, symbolizer, fill.getGraphicFill(), scaleRange, false);
if (!(style2DFill instanceof GraphicStyle2D)) {
style.setGraphicFill(style2DFill);
代码示例来源:origin: org.geotools/gt-main
private void rescaleFill(Fill copyFill, double mapScale, Unit<Length> unit) {
// rescale the graphic fill, if any
if (copyFill != null) {
rescale(copyFill.getGraphicFill(), mapScale, unit);
}
}
代码示例来源:origin: geotools/geotools
Graphic g = poly.getFill().getGraphicFill();
代码示例来源: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.geotools/gt-main
@Override
public void visit(Fill fill) {
if (fill.getColor() != null) {
//fill.getColor().accept(visitor, extraData)
}
if (fill.getGraphicFill() != null) {
fill.getGraphicFill().accept(this);
}
if (fill.getOpacity() != null) {
//fill.getOpacity().accept(visitor, extraData)
}
}
代码示例来源:origin: geotools/geotools
Mark mark = SLD.mark(poly.getFill().getGraphicFill());
assertEquals("shape://times", Filters.asString(mark.getWellKnownName()));
assertEquals(1, SLD.width(mark.getStroke()));
assertEquals(16, Filters.asInt(poly.getFill().getGraphicFill().getSize()));
代码示例来源:origin: geotools/geotools
Mark rm = (Mark) rps.getStroke().getGraphicStroke().graphicalSymbols().get(0);
assertEquals(10.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d);
rm = (Mark) rps.getFill().getGraphicFill().graphicalSymbols().get(0);
assertEquals(20.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d);
代码示例来源: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
Mark rm = (Mark) rps.getStroke().getGraphicStroke().graphicalSymbols().get(0);
assertEquals(2.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d);
rm = (Mark) rps.getFill().getGraphicFill().graphicalSymbols().get(0);
assertEquals(4.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d);
内容来源于网络,如有侵权,请联系作者删除!