|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.styling.visitor.DuplicatingStyleVisitor
org.geotools.styling.visitor.UomRescaleStyleVisitor
public class UomRescaleStyleVisitor
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.METER, NonSI.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.
Field Summary |
---|
Fields inherited from class org.geotools.styling.visitor.DuplicatingStyleVisitor |
---|
copyFilter, ff, pages, sf, STRICT |
Constructor Summary | |
---|---|
UomRescaleStyleVisitor(double mapScale)
Constructor: requires the current mapScale to inform the window to viewport (world to screen) relation in order to correctly rescale sizes according to units of measure given in world units (e.g., SI.METER, NonSI.FOOT, etc). |
Method Summary | |
---|---|
protected double |
computeRescaleMultiplier(double mapScale,
javax.measure.unit.Unit<javax.measure.quantity.Length> uom)
Computes a rescaling multiplier to be applied to an unscaled value. |
protected double |
rescale(double unscaled,
double mapScale,
javax.measure.unit.Unit<javax.measure.quantity.Length> uom)
Used to rescale the provided unscaled value. |
protected org.opengis.filter.expression.Expression |
rescale(org.opengis.filter.expression.Expression unscaled,
double mapScale,
javax.measure.unit.Unit<javax.measure.quantity.Length> uom)
Used to rescale the provided unscaled value. |
protected float[] |
rescale(float[] dashArray,
double mapScale,
javax.measure.unit.Unit<javax.measure.quantity.Length> unitOfMeasure)
Used to rescale the provided dash array. |
protected void |
rescaleStroke(Stroke stroke,
double mapScale,
javax.measure.unit.Unit<javax.measure.quantity.Length> uom)
Used to rescale the provided stroke. |
void |
visit(LineSymbolizer line)
Called when accept is called on a linesymbolizer |
void |
visit(PointSymbolizer ps)
Called when accept is called on a pointsymbolizer |
void |
visit(PolygonSymbolizer poly)
Called when accept is called on a polygon symbolizer |
void |
visit(TextSymbolizer text)
Called when accept is called on a textsymbolizer |
Methods inherited from class org.geotools.styling.visitor.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, copy, 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UomRescaleStyleVisitor(double mapScale)
mapScale
- The specified map scale, given in pixels per meter.Method Detail |
---|
protected double computeRescaleMultiplier(double mapScale, javax.measure.unit.Unit<javax.measure.quantity.Length> uom)
mapScale
- the mapScale in pixels per meter.uom
- the unit of measure that will be used to scale.
protected org.opengis.filter.expression.Expression rescale(org.opengis.filter.expression.Expression unscaled, double mapScale, javax.measure.unit.Unit<javax.measure.quantity.Length> uom)
unscaled
- the unscaled value.mapScale
- the mapScale in pixels per meter.uom
- the unit of measure that will be used to scale.
protected double rescale(double unscaled, double mapScale, javax.measure.unit.Unit<javax.measure.quantity.Length> uom)
unscaled
- the unscaled value.mapScale
- the mapScale in pixels per meter.uom
- the unit of measure that will be used to scale.
protected float[] rescale(float[] dashArray, double mapScale, javax.measure.unit.Unit<javax.measure.quantity.Length> unitOfMeasure)
dashArray
- the unscaled dash array. If null, the method returns null.mapScale
- the mapScale in pixels per meter.uom
- the unit of measure that will be used to scale.
protected void rescaleStroke(Stroke stroke, double mapScale, javax.measure.unit.Unit<javax.measure.quantity.Length> uom)
stroke
- the unscaled stroke, which will be modified in-place.mapScale
- the mapScale in pixels per meter.uom
- the unit of measure that will be used to scale.public void visit(PointSymbolizer ps)
StyleVisitor
visit
in interface StyleVisitor
visit
in class DuplicatingStyleVisitor
ps
- the point symbolizer to visitpublic void visit(LineSymbolizer line)
StyleVisitor
visit
in interface StyleVisitor
visit
in class DuplicatingStyleVisitor
line
- the line symbolizer to visitpublic void visit(PolygonSymbolizer poly)
StyleVisitor
visit
in interface StyleVisitor
visit
in class DuplicatingStyleVisitor
poly
- the polygon symbolizer to visitpublic void visit(TextSymbolizer text)
StyleVisitor
visit
in interface StyleVisitor
visit
in class DuplicatingStyleVisitor
text
- the text symbolizer to visit
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |