de.fhpotsdam.unfolding.ui
Class BarScaleUI

java.lang.Object
  extended by de.fhpotsdam.unfolding.ui.BarScaleUI

public class BarScaleUI
extends java.lang.Object


Field Summary
 float x
           
 float y
           
 
Constructor Summary
BarScaleUI(processing.core.PApplet p, UnfoldingMap map)
           
BarScaleUI(processing.core.PApplet p, UnfoldingMap map, float x, float y)
           
 
Method Summary
protected  float closest(float of, java.util.List<java.lang.Float> in)
           
 void draw()
          Draws a bar scale at given position according to current zoom level.
protected  float getClosestDistance(float distance)
          Returns the nearest distance to display as well as to use for calculation.
 void setStyle(int color, int barWeight, int barCapOffset, processing.core.PFont font)
          Set the style of the bar scale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

public float x

y

public float y
Constructor Detail

BarScaleUI

public BarScaleUI(processing.core.PApplet p,
                  UnfoldingMap map,
                  float x,
                  float y)

BarScaleUI

public BarScaleUI(processing.core.PApplet p,
                  UnfoldingMap map)
Method Detail

draw

public void draw()
Draws a bar scale at given position according to current zoom level. Calculates distance at equator (scale is dependent on Latitude). Uses a distance to display from fixed set of distance numbers, so length of bar may vary.


setStyle

public void setStyle(int color,
                     int barWeight,
                     int barCapOffset,
                     processing.core.PFont font)
Set the style of the bar scale.

Parameters:
color - the color of the scale.
barWeight - the weight of the scale.
barCapOffset - the offset of the scale.
font - the font to use for the bar scale.

getClosestDistance

protected float getClosestDistance(float distance)
Returns the nearest distance to display as well as to use for calculation.

Parameters:
distance - The original distance
Returns:
A distance from the set of DISPLAY_DISTANCES

closest

protected float closest(float of,
                        java.util.List<java.lang.Float> in)