com.bbn.openmap.omGraphics
Class FontSizer

java.lang.Object
  |
  +--com.bbn.openmap.omGraphics.FontSizer

public class FontSizer
extends java.lang.Object

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


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)
          Contructor that uses the OMText DEFAULT_FONT as the base font.
FontSizer(java.awt.Font font, float baseScale, int multiplier, int minPointSize, int maxPointSize)
           
 
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 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 java.awt.Font font

lastFont

protected java.awt.Font lastFont

baseScale

protected float baseScale

lastScale

protected float lastScale

curScale

protected 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(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)
Contructor 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()


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