org.deegree_impl.graphics
Class ScaleBar_Impl

java.lang.Object
  extended byorg.deegree_impl.graphics.ScaleBar_Impl
All Implemented Interfaces:
ScaleBar

public class ScaleBar_Impl
extends java.lang.Object
implements ScaleBar

Version:
$Revision: 1.5 $
Author:
Andreas Poth

Field Summary
private  java.awt.Color barColor
           
private  java.awt.Font barFont
           
private  java.lang.String barStyle
           
private  java.awt.Color bgColor
           
private  int bottomLabel
           
private  java.awt.Color labelColor
           
private  double scale
           
private  int scaleDenominator
           
private  int topLabel
           
private  java.lang.String unit
           
 
Fields inherited from interface org.deegree.graphics.ScaleBar
L_NONE, L_SCALE, L_SCALEDENOMINATOR
 
Constructor Summary
ScaleBar_Impl()
          Constructor just using defaults
ScaleBar_Impl(int topLabel, int bottomLabel, double scale, int scaleDenominator, java.lang.String units, java.awt.Color labelColor, java.awt.Color barColor, java.awt.Color bgColor, java.lang.String barStyle, java.awt.Font barFont)
          Constructor with all Parameters
 
Method Summary
 void paint(java.awt.Graphics g)
          will paint the scale bar to the passed graphic context
 void setBackgroundColor(java.awt.Color color)
          sets the front color of the scale bar
 void setBarColor(java.awt.Color color)
          sets the bar color of the scale bar
 void setBottomLabel(int labelType)
          sets the type of the label below the scale bar
 void setFont(java.awt.Font font)
          sets the font for label rendering
 void setLabelColor(java.awt.Color color)
          sets the label color of the scale bar
 void setScale(double scale)
          sets the scale as defined in the OGC WMS 1.1.1 specification.
 void setScaleDenominator(int scaleDen)
          sets the scale denominator for the scale bar.
 void setStyle(java.lang.String style)
          sets the style of the scale bar. default style is |--------| the list of known styles depends on the implementation
 void setTopLabel(int labelType)
          sets the type of the label above the scale bar
 void setUnits(java.lang.String units)
          sets the units the scale and the scale denominater will be expressed at.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

barColor

private java.awt.Color barColor

labelColor

private java.awt.Color labelColor

bgColor

private java.awt.Color bgColor

barFont

private java.awt.Font barFont

barStyle

private java.lang.String barStyle

unit

private java.lang.String unit

scale

private double scale

bottomLabel

private int bottomLabel

scaleDenominator

private int scaleDenominator

topLabel

private int topLabel
Constructor Detail

ScaleBar_Impl

public ScaleBar_Impl(int topLabel,
                     int bottomLabel,
                     double scale,
                     int scaleDenominator,
                     java.lang.String units,
                     java.awt.Color labelColor,
                     java.awt.Color barColor,
                     java.awt.Color bgColor,
                     java.lang.String barStyle,
                     java.awt.Font barFont)
Constructor with all Parameters

Parameters:
topLabel - type of the label on top of the scale bar. Chose L_NONE or no label, L_SCALE for scale on top and L_SCALEDENOMIATOR for scaledenominator on top.
bottomLabel - the same as above but below the scalebar.
scale - the scale to be displayed. For a value of e.g. 1000 there will be 1:1000 displayed
scaleDenominator - the scaledenominator to be displayed
units - the units the scaledenominator is in. Possible values are inch, Meter, Mile, Kilometer...
labelColor - the Color the label has to be in (and of course the text below and above)
bgColor - not used so far
barStyle - the style the bar appears in. Currently just "default" is supported.
barFont - the font the text above and below the scale bar appears in.

ScaleBar_Impl

public ScaleBar_Impl()
Constructor just using defaults

Method Detail

paint

public void paint(java.awt.Graphics g)
will paint the scale bar to the passed graphic context

Specified by:
paint in interface ScaleBar
Parameters:
g - graphic context

setTopLabel

public void setTopLabel(int labelType)
sets the type of the label above the scale bar

Specified by:
setTopLabel in interface ScaleBar
Parameters:
labelType - lable type

setBottomLabel

public void setBottomLabel(int labelType)
sets the type of the label below the scale bar

Specified by:
setBottomLabel in interface ScaleBar
Parameters:
labelType - lable type

setScale

public void setScale(double scale)
sets the scale as defined in the OGC WMS 1.1.1 specification. Scale is defined as the diagonal size of a pixel in the center of a map measured in meter. The setting of the scale will affect the value of the scale denominator

Specified by:
setScale in interface ScaleBar

setScaleDenominator

public void setScaleDenominator(int scaleDen)
sets the scale denominator for the scale bar. The scale denominator is the scale expression as we know it for printed maps (e.g. 1:10000 1:5000). The passed value is expressed in meters. The setting of the scale denominator will affect the value of the scale

Specified by:
setScaleDenominator in interface ScaleBar
Parameters:
scaleDen - scale denominator value

setUnits

public void setUnits(java.lang.String units)
sets the units the scale and the scale denominater will be expressed at. Settings other than meter will cause that the passed values for scale and scale denominater will be recalculated for painting. it depends on the implementation what units are supported.

Specified by:
setUnits in interface ScaleBar
Parameters:
units - name units (meter, miles, feet etc.)

setBackgroundColor

public void setBackgroundColor(java.awt.Color color)
sets the front color of the scale bar

Specified by:
setBackgroundColor in interface ScaleBar

setLabelColor

public void setLabelColor(java.awt.Color color)
sets the label color of the scale bar

Specified by:
setLabelColor in interface ScaleBar

setBarColor

public void setBarColor(java.awt.Color color)
sets the bar color of the scale bar

Specified by:
setBarColor in interface ScaleBar

setStyle

public void setStyle(java.lang.String style)
sets the style of the scale bar. default style is |--------| the list of known styles depends on the implementation

Specified by:
setStyle in interface ScaleBar
Parameters:
style - style name

setFont

public void setFont(java.awt.Font font)
sets the font for label rendering

Specified by:
setFont in interface ScaleBar
Parameters:
font - awt font object