Package org.geotools.styling.visitor
Class UomRescaleStyleVisitor
Object
DuplicatingStyleVisitor
UomRescaleStyleVisitor
- All Implemented Interfaces:
StyleVisitor
Visitor used for rescaling a Style given a map scale (e.g., meters per pixel) and taking into consideration the Unit
of Measure (UOM, e.g., SI.METRE, USCustomary.FOOT) of each symbolizer. The resulting Style's Symbolizer sizes will
all be given in PIXELS, so that they can be directly used by a renderer that is unaware of units of measure or the
current map scale. For example, points with size == 100 meters could be rescaled to 10 pixels for higher levels of
zoom and 2 pixels for a lower level of zoom.
This visitor extends DuplicatingStyleVisitor
and as such yields a copy of the original Style. Usage is
simply to call the desired visit() method and then call getCopy() to retrieve the result.
- Author:
- milton, Andrea Aime - GeoSolutions
-
Field Summary
Fields inherited from class DuplicatingStyleVisitor
copyFilter, ff, pages, sf, STRICT
-
Constructor Summary
ConstructorsConstructorDescriptionUomRescaleStyleVisitor
(double mapScale) Constructor: requires the current mapScale to inform the window to viewport (world to screen) relation in order to correctly rescaleDashArray sizes according to units of measure given in world units (e.g., SI.METRE, USCustomary.FOOT, etc). -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Used to rescaleDashArray the provided unscaled value.protected Expression
rescale
(Expression unscaled, Unit<Length> uom) Used to rescaleDashArray the provided unscaled value.protected List<Expression>
rescaleDashArray
(List<Expression> expressions, Unit<Length> uom) Rescale a list of expressions, can handle null.protected void
rescaleStroke
(Stroke stroke, Unit<Length> uom) Used to rescaleDashArray the provided stroke.void
visit
(LineSymbolizer line) Called when accept is called on a linesymbolizervoid
visit
(PointSymbolizer ps) Called when accept is called on a pointsymbolizervoid
visit
(PolygonSymbolizer poly) Called when accept is called on a polygon symbolizervoid
visit
(TextSymbolizer text) Called when accept is called on a textsymbolizerMethods inherited from class DuplicatingStyleVisitor
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, visit, visit, visit, visit
-
Constructor Details
-
UomRescaleStyleVisitor
public UomRescaleStyleVisitor(double mapScale) Constructor: requires the current mapScale to inform the window to viewport (world to screen) relation in order to correctly rescaleDashArray sizes according to units of measure given in world units (e.g., SI.METRE, USCustomary.FOOT, etc).- Parameters:
mapScale
- The specified map scale, given in pixels per meter.
-
-
Method Details
-
rescale
Used to rescaleDashArray the provided unscaled value.- Parameters:
unscaled
- the unscaled value.uom
- the unit of measure that will be used to scale.- Returns:
- the expression multiplied by the provided scale.
-
rescaleDashArray
Rescale a list of expressions, can handle null. -
rescale
Used to rescaleDashArray the provided unscaled value.- Parameters:
unscaled
- the unscaled value.uom
- the unit of measure that will be used to scale.- Returns:
- the expression multiplied by the provided scale.
-
rescaleStroke
Used to rescaleDashArray the provided stroke.- Parameters:
stroke
- the unscaled stroke, which will be modified in-place.uom
- the unit of measure that will be used to scale.
-
visit
Description copied from interface:StyleVisitor
Called when accept is called on a pointsymbolizer- Specified by:
visit
in interfaceStyleVisitor
- Overrides:
visit
in classDuplicatingStyleVisitor
- Parameters:
ps
- the point symbolizer to visit
-
visit
Description copied from interface:StyleVisitor
Called when accept is called on a linesymbolizer- Specified by:
visit
in interfaceStyleVisitor
- Overrides:
visit
in classDuplicatingStyleVisitor
- Parameters:
line
- the line symbolizer to visit
-
visit
Description copied from interface:StyleVisitor
Called when accept is called on a polygon symbolizer- Specified by:
visit
in interfaceStyleVisitor
- Overrides:
visit
in classDuplicatingStyleVisitor
- Parameters:
poly
- the polygon symbolizer to visit
-
visit
Description copied from interface:StyleVisitor
Called when accept is called on a textsymbolizer- Specified by:
visit
in interfaceStyleVisitor
- Overrides:
visit
in classDuplicatingStyleVisitor
- Parameters:
text
- the text symbolizer to visit
-