org.geotools.styling.visitor
Class RescaleStyleVisitor

Object
  extended by DuplicatingStyleVisitor
      extended by RescaleStyleVisitor
All Implemented Interfaces:
StyleVisitor

public class RescaleStyleVisitor
extends DuplicatingStyleVisitor

This is a style visitor that will produce a copy of the provided style rescaled by a provided factor.

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.

Author:
Jody Garnett (Refractions Research)

Field Summary
 
Fields inherited from class DuplicatingStyleVisitor
copyFilter, ff, pages, sf, STRICT
 
Constructor Summary
RescaleStyleVisitor(double scale)
           
RescaleStyleVisitor(Expression scale)
           
RescaleStyleVisitor(FilterFactory2 filterFactory, double scale)
           
RescaleStyleVisitor(FilterFactory2 filterFactory, Expression scale)
           
 
Method Summary
protected  Font copy(Font font)
          Increase font size
protected  Expression rescale(Expression expr)
          Used to rescale the provided expr.
 void visit(Graphic gr)
          Make graphics (such as used with PointSymbolizer) bigger
 void visit(Stroke stroke)
          Increase stroke width.
 
Methods 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, 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, visit, visit
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RescaleStyleVisitor

public RescaleStyleVisitor(double scale)

RescaleStyleVisitor

public RescaleStyleVisitor(Expression scale)

RescaleStyleVisitor

public RescaleStyleVisitor(FilterFactory2 filterFactory,
                           double scale)

RescaleStyleVisitor

public RescaleStyleVisitor(FilterFactory2 filterFactory,
                           Expression scale)
Method Detail

rescale

protected Expression rescale(Expression expr)
Used to rescale the provided 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.

Parameters:
expr -
Returns:
expr multiplied by the provided scale

visit

public void visit(Stroke stroke)
Increase stroke width.

Based on feedback we may need to change the dash array as well.

Specified by:
visit in interface StyleVisitor
Overrides:
visit in class DuplicatingStyleVisitor
Parameters:
stroke - the stroke to visit

copy

protected Font copy(Font font)
Increase font size

Overrides:
copy in class DuplicatingStyleVisitor

visit

public void visit(Graphic gr)
Make graphics (such as used with PointSymbolizer) bigger

Specified by:
visit in interface StyleVisitor
Overrides:
visit in class DuplicatingStyleVisitor
Parameters:
gr - the graphic to visit


Copyright © 1996-2009 Geotools. All Rights Reserved.