com.bbn.openmap.omGraphics
Class FontSizer

java.lang.Object
  extended by com.bbn.openmap.omGraphics.FontSizer
All Implemented Interfaces:
java.io.Serializable

public class FontSizer
extends java.lang.Object
implements java.io.Serializable

Helper class to OMText object that resizes font when scale changes. Font gets bigger as you zoom in.

See Also:
Serialized Form

Field Summary
protected  float baseScale
           
protected  float curScale
           
protected  java.awt.Font font
           
protected  java.awt.Font lastFont
           
protected  float lastScale
           
protected  int maxPointSize
           
protected  int minPointSize
           
protected  int multiplier
          Default of 1.
 
Constructor Summary
FontSizer(float baseScale, int multiplier, int minPointSize, int maxPointSize)
          Constructor that uses the OMText DEFAULT_FONT as the base font.
FontSizer(java.awt.Font font, float baseScale, int multiplier, int minPointSize, int maxPointSize)
           
FontSizer(FontSizer source)
          Create a FontSizer with the same settings as the source.
 
Method Summary
 java.awt.Font getFont()
          Get the base font.
 java.awt.Font getFont(float scale)
          Get a font sized for the scale, given the size restrictions.
 int getMultiplier()
           
protected  java.awt.Font getScaledFont()
           
 void restore(FontSizer source)
           
 void setFont(java.awt.Font font)
          Set the base font.
 void setMultiplier(int mul)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

font

protected transient java.awt.Font font

lastFont

protected transient java.awt.Font lastFont

baseScale

protected float baseScale

lastScale

protected transient float lastScale

curScale

protected transient float curScale

minPointSize

protected int minPointSize

maxPointSize

protected int maxPointSize

multiplier

protected int multiplier
Default of 1. Used against the base scale/current scale ratio to speed up or slow down font size changes based on scale.

Constructor Detail

FontSizer

public FontSizer(FontSizer source)
Create a FontSizer with the same settings as the source.

Parameters:
source -

FontSizer

public FontSizer(java.awt.Font font,
                 float baseScale,
                 int multiplier,
                 int minPointSize,
                 int maxPointSize)
Parameters:
font - the font to use as the base font.
baseScale - the scale where the base font is shown at its natural size.
multiplier - to use against the ratio of base scale:current scale.
minPointSize - the minimum point size to use for the scaled font.
maxPointSize - the maximum point size to use for the scaled font.

FontSizer

public FontSizer(float baseScale,
                 int multiplier,
                 int minPointSize,
                 int maxPointSize)
Constructor that uses the OMText DEFAULT_FONT as the base font.

Parameters:
baseScale - the scale where the base font is shown at its natural size.
multiplier - to use against the ratio of base scale:current scale.
minPointSize - the minimum point size to use for the scaled font.
maxPointSize - the maximum point size to use for the scaled font.
Method Detail

setFont

public void setFont(java.awt.Font font)
Set the base font.


getFont

public java.awt.Font getFont(float scale)
Get a font sized for the scale, given the size restrictions.


getScaledFont

protected java.awt.Font getScaledFont()

getFont

public java.awt.Font getFont()
Get the base font.


setMultiplier

public void setMultiplier(int mul)

getMultiplier

public int getMultiplier()

restore

public void restore(FontSizer source)


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details