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 StringUsed to rescaleDashArray the provided unscaled value.protected Expressionrescale(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 voidrescaleStroke(Stroke stroke, Unit<Length> uom) Used to rescaleDashArray the provided stroke.voidvisit(LineSymbolizer line) Called when accept is called on a linesymbolizervoidvisit(PointSymbolizer ps) Called when accept is called on a pointsymbolizervoidvisit(PolygonSymbolizer poly) Called when accept is called on a polygon symbolizervoidvisit(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:StyleVisitorCalled when accept is called on a pointsymbolizer- Specified by:
visitin interfaceStyleVisitor- Overrides:
visitin classDuplicatingStyleVisitor- Parameters:
ps- the point symbolizer to visit
-
visit
Description copied from interface:StyleVisitorCalled when accept is called on a linesymbolizer- Specified by:
visitin interfaceStyleVisitor- Overrides:
visitin classDuplicatingStyleVisitor- Parameters:
line- the line symbolizer to visit
-
visit
Description copied from interface:StyleVisitorCalled when accept is called on a polygon symbolizer- Specified by:
visitin interfaceStyleVisitor- Overrides:
visitin classDuplicatingStyleVisitor- Parameters:
poly- the polygon symbolizer to visit
-
visit
Description copied from interface:StyleVisitorCalled when accept is called on a textsymbolizer- Specified by:
visitin interfaceStyleVisitor- Overrides:
visitin classDuplicatingStyleVisitor- Parameters:
text- the text symbolizer to visit
-