com.partnersoft.maps.ephemera
Class RotateTextEphemeron

java.lang.Object
  extended by com.partnersoft.maps.ephemera.RotateTextEphemeron
All Implemented Interfaces:
Ephemeron

public class RotateTextEphemeron
extends java.lang.Object
implements Ephemeron

Rotates text around anchor point.

Copyright 2007 Paul Reavis

Version:
$Id$
Author:
Rich Stepanski

Field Summary
protected  XyPoint anchor
           
protected  MapApp app
           
protected  double DEGREE_TO_BIT
           
protected  MapSet mapset
           
protected  int rotation
           
protected  java.lang.String text
           
protected  double textPixelWidth
           
protected  java.lang.String textStyle
           
 
Constructor Summary
RotateTextEphemeron(MapApp app, MapSet mapset, XyPoint anchor, java.lang.String text, java.lang.String textStyle)
          Spins passed text around fixed point.
RotateTextEphemeron(XyPoint anchor, java.lang.String text, java.lang.String textStyle, double textPixelWidth)
          Spins passed text around fixed point.
 
Method Summary
 void draw(DrawingSurface surface, MapViewFrame frame, XyPoint mousePosition)
          Draw appropriate graphics on the given surface with the given frame, mouse position, and any implementation-specific internal state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

anchor

protected XyPoint anchor

text

protected java.lang.String text

textStyle

protected java.lang.String textStyle

rotation

protected transient int rotation

DEGREE_TO_BIT

protected final double DEGREE_TO_BIT
See Also:
Constant Field Values

textPixelWidth

protected double textPixelWidth

mapset

protected MapSet mapset

app

protected MapApp app
Constructor Detail

RotateTextEphemeron

public RotateTextEphemeron(XyPoint anchor,
                           java.lang.String text,
                           java.lang.String textStyle,
                           double textPixelWidth)
Spins passed text around fixed point. Just as rotation ephemeron does with lines.

Uses passed pixel width as length of word.

Parameters:
anchor - - XyPoint to be used for pivot.
text - - text to be drawn.
textStyle - - text style to use for text.
textPixelWidth - - Pixel width of text to be drawn.

RotateTextEphemeron

public RotateTextEphemeron(MapApp app,
                           MapSet mapset,
                           XyPoint anchor,
                           java.lang.String text,
                           java.lang.String textStyle)
Spins passed text around fixed point. Just as rotation ephemeron does with lines.

This constructor attempts to calculate the text style's pixel width. If none can be found, 8 pixels per character is used.

Parameters:
app - - MapApp, used to calculating text width.
mapset - - MapSet where these styles live.
anchor - - XyPoint to be used for pivot.
text - - text to be drawn.
textStyle - - text style to use for text.
Method Detail

draw

public void draw(DrawingSurface surface,
                 MapViewFrame frame,
                 XyPoint mousePosition)
Description copied from interface: Ephemeron
Draw appropriate graphics on the given surface with the given frame, mouse position, and any implementation-specific internal state. The drawing surface is set up with the given frame, and is in map coordinates (not pixels).

Specified by:
draw in interface Ephemeron