public class RescaleStyleVisitor extends DuplicatingStyleVisitor
The provided scale will be use to modify all line widths, font sizes and so forth. We may need to go the extra distance and play with the min/max scale on rules, and if there is any DPI specific madness going on we are going to cry.
According to the specification we are supposed to use environmental variables to make our styles render in a resolution independent manner. The current GeoTools environment variable visitor only does processing for mapscale but does not have a dpi substitution. On the plus side this visitor accepts a general Expression and you are free to use an environmental variable expression in order to make sure a normal base style is tweaked in all the right spots.
Modifier and Type | Field and Description |
---|---|
protected Unit<Length> |
defaultUnit |
protected Expression |
scale
This is the scale used as a multiplication factory for everything that has a size.
|
copyFilter, ff, pages, sf, STRICT
Constructor and Description |
---|
RescaleStyleVisitor(double scale) |
RescaleStyleVisitor(Expression scale) |
RescaleStyleVisitor(FilterFactory2 filterFactory,
double scale) |
RescaleStyleVisitor(FilterFactory2 filterFactory,
Expression scale) |
Modifier and Type | Method and Description |
---|---|
protected Expression |
rescale(Expression expr)
Used to rescale the provided expr.
|
protected List<Expression> |
rescale(List<Expression> expressions)
Rescale a list of expressions, can handle null.
|
protected void |
rescaleArrayOption(Map<String,String> options,
String key,
int defaultValue)
Rescales the specified vendor option
|
protected List<Expression> |
rescaleDashArray(List<Expression> expressions)
Rescale using listMultiply, if there is only one entry.
|
protected Expression |
rescaleGraphicSize(Graphic gr) |
protected void |
rescaleOption(Map<String,String> options,
String key,
double defaultValue)
Rescales the specified vendor option
|
protected void |
rescaleOption(Map<String,String> options,
String key,
int defaultValue)
Rescales the specified vendor option
|
void |
visit(Graphic gr)
Make graphics (such as used with PointSymbolizer) bigger
|
void |
visit(LineSymbolizer sym)
Called when accept is called on a linesymbolizer
|
void |
visit(PointSymbolizer sym)
Called when accept is called on a pointsymbolizer
|
void |
visit(PolygonSymbolizer sym)
Called when accept is called on a polygon symbolizer
|
void |
visit(RasterSymbolizer sym)
Called when accept is called on a rastersymbolizer
|
void |
visit(Stroke stroke)
Increase stroke width.
|
void |
visit(Symbolizer sym)
since it is impossible to create a Symbolizer this method should generate an exception or
warning.
|
void |
visit(TextSymbolizer text)
Called when accept is called on a textsymbolizer
|
copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copy, copyExpressions, copyFonts, getCopy, setStrict, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
protected Expression scale
protected Unit<Length> defaultUnit
public RescaleStyleVisitor(double scale)
public RescaleStyleVisitor(Expression scale)
public RescaleStyleVisitor(FilterFactory2 filterFactory, double scale)
public RescaleStyleVisitor(FilterFactory2 filterFactory, Expression scale)
protected Expression rescale(Expression expr)
We do optimize the case where the provided expression is a literal; no sense doing a calculation each time if we don't have to.
expr
- protected List<Expression> rescale(List<Expression> expressions)
protected List<Expression> rescaleDashArray(List<Expression> expressions)
expressions
- public void visit(Stroke stroke)
Based on feedback we may need to change the dash array as well.
visit
in interface StyleVisitor
visit
in class DuplicatingStyleVisitor
stroke
- the stroke to visitpublic void visit(Graphic gr)
visit
in interface StyleVisitor
visit
in class DuplicatingStyleVisitor
gr
- the graphic to visitprotected Expression rescaleGraphicSize(Graphic gr)
public void visit(TextSymbolizer text)
StyleVisitor
visit
in interface StyleVisitor
visit
in class DuplicatingStyleVisitor
text
- the text symbolizer to visitpublic void visit(Symbolizer sym)
StyleVisitor
visit
in interface StyleVisitor
visit
in class DuplicatingStyleVisitor
sym
- the symbolizer to visitpublic void visit(PointSymbolizer sym)
StyleVisitor
visit
in interface StyleVisitor
visit
in class DuplicatingStyleVisitor
sym
- the point symbolizer to visitpublic void visit(LineSymbolizer sym)
StyleVisitor
visit
in interface StyleVisitor
visit
in class DuplicatingStyleVisitor
sym
- the line symbolizer to visitpublic void visit(PolygonSymbolizer sym)
StyleVisitor
visit
in interface StyleVisitor
visit
in class DuplicatingStyleVisitor
sym
- the polygon symbolizer to visitpublic void visit(RasterSymbolizer sym)
StyleVisitor
visit
in interface StyleVisitor
visit
in class DuplicatingStyleVisitor
sym
- the raster symbolizer to visitprotected void rescaleOption(Map<String,String> options, String key, double defaultValue)
options
- key
- defaultAutoWrap
- value
- protected void rescaleOption(Map<String,String> options, String key, int defaultValue)
options
- key
- defaultAutoWrap
- value
- Copyright © 1996–2019 Geotools. All rights reserved.