gistoolkit.display.labeler
Class SimpleLabeler

java.lang.Object
  extended bygistoolkit.display.labeler.SimpleLabeler
All Implemented Interfaces:
Labeler
Direct Known Subclasses:
FeatureLabeler, LineLabeler, MultipleLabeler, PolygonLabeler

public abstract class SimpleLabeler
extends java.lang.Object
implements Labeler

Simple Labeler to be extended by more advanced renderers.

Author:
ithaqua

Field Summary
static int CENTER
          The orientation of the label.
static int EAST
           
static int NORTH
           
static int SOUTH
           
static int WEST
           
 
Constructor Summary
SimpleLabeler()
          Creates new BasicLabeler
 
Method Summary
 void beginLabel()
          Called before the layer is initially labeled to allow the labeler to prepare for labeling.
protected abstract  boolean drawLabel(Record inRecord, java.awt.Graphics inGraphics, Converter inConverter)
          Draw the record after checking for not null.
 boolean drawLabel(Record inRecord, java.awt.Graphics inGraphics, Converter inConverter, Shader inShader)
          Draw the label for the record on the graphics context
 boolean drawLabelHighlight(Record inRecord, java.awt.Graphics inGraphics, Converter inConverter, Shader inShader)
          Highlight the Label when the shape is highlighted.
static void drawString(java.lang.String inString, java.awt.Graphics2D inGraphics, float inX, float inY, float inWidth, float inHeight)
          Draw the string even if it contains carrage returns.
 void endLabel()
          Called after the layer has completed labeling.
 boolean getAllowDuplicates()
          Returns true if duplicates are allowed, false otherwise.
 boolean getAllowOverlaps()
          Get the allow overlaps flag.
static java.awt.geom.Rectangle2D getBounds(java.lang.String inString, java.awt.Graphics2D inGraphics)
          Method to get the length and width of the string even if it contains carage returns.
 int getLabelColumn()
          Retrive the label by column.
abstract  java.lang.String getLabelerName()
          A name for this labeler, returns "Simple Labeler".
 int getLabelOffset()
          Get the distance from the label point that the label will be placed.
 int getLabelOrientation()
          Get the orientation of the labels relative to their anchor.
 java.awt.Point getLabelPosition(int inX, int inY, int inWidth, int inHeight)
          Convenience method for subclasses, given the anchor position, calculate the label position.
 Node getNode()
          get the configuration information for this labeler
 OverlapManager getOverlapManager()
          Return the OverlapManager for this labeler.
static java.lang.String[] getStrings(java.lang.String inString)
          Get the individual Strings.
 boolean isDuplicate(java.lang.Object inValue)
          Checks if this is a duplicate value.
 boolean isOverLaps(int inLocX, int inLocY, int inWidth, int inHeight)
          Checks if this is an overlaping value.
 boolean isOverLaps(java.awt.Shape inShape)
          Checks if this is an overlaping value.
 void removeDuplicate(java.lang.Object inValue)
          Removes this entry from the list of duplicates.
 void setAllowDuplicates(boolean inDuplicates)
          Indicates that duplicates are allowed.
 void setAllowOverlaps(boolean inOverlaps)
          Set the allow overlaps flag.
 void setLabelColumn(int inLabelColumn)
          Set the number of the column to label by.
 void setLabelOffset(int inOffset)
          Set the distance from the label point that the label will be placed.
 void setLabelOrientation(int inOrientation)
          Set the orientation of the labels relative to their anchor.
 void setNode(Node inNode)
          Set the configuration information for this labeler
 java.lang.String toString()
          Return the name of the labeler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CENTER

public static final int CENTER
The orientation of the label.

See Also:
Constant Field Values

NORTH

public static final int NORTH
See Also:
Constant Field Values

EAST

public static final int EAST
See Also:
Constant Field Values

SOUTH

public static final int SOUTH
See Also:
Constant Field Values

WEST

public static final int WEST
See Also:
Constant Field Values
Constructor Detail

SimpleLabeler

public SimpleLabeler()
Creates new BasicLabeler

Method Detail

getLabelerName

public abstract java.lang.String getLabelerName()
A name for this labeler, returns "Simple Labeler".

Specified by:
getLabelerName in interface Labeler

setLabelColumn

public void setLabelColumn(int inLabelColumn)
Set the number of the column to label by.


getLabelColumn

public int getLabelColumn()
Retrive the label by column.


setLabelOffset

public void setLabelOffset(int inOffset)
Set the distance from the label point that the label will be placed.


getLabelOffset

public int getLabelOffset()
Get the distance from the label point that the label will be placed.


setLabelOrientation

public void setLabelOrientation(int inOrientation)
Set the orientation of the labels relative to their anchor.


getLabelOrientation

public int getLabelOrientation()
Get the orientation of the labels relative to their anchor.


setAllowDuplicates

public void setAllowDuplicates(boolean inDuplicates)
Indicates that duplicates are allowed.


getAllowDuplicates

public boolean getAllowDuplicates()
Returns true if duplicates are allowed, false otherwise.


isDuplicate

public boolean isDuplicate(java.lang.Object inValue)
Checks if this is a duplicate value. Always returns true if duplicates are allowed.


removeDuplicate

public void removeDuplicate(java.lang.Object inValue)
Removes this entry from the list of duplicates.


setAllowOverlaps

public void setAllowOverlaps(boolean inOverlaps)
Set the allow overlaps flag. If set to true, then overlaping labels are allowed. If set to false, then overlaping labels are removed.


getAllowOverlaps

public boolean getAllowOverlaps()
Get the allow overlaps flag. If set to true, then overlaping labels are allowed. If set to false, then overlaping labels are removed.


getOverlapManager

public OverlapManager getOverlapManager()
Return the OverlapManager for this labeler.


isOverLaps

public boolean isOverLaps(int inLocX,
                          int inLocY,
                          int inWidth,
                          int inHeight)
Checks if this is an overlaping value. Always returns false if overlaps are allowed.


isOverLaps

public boolean isOverLaps(java.awt.Shape inShape)
Checks if this is an overlaping value. Always returns false if overlaps are allowed.


getLabelPosition

public java.awt.Point getLabelPosition(int inX,
                                       int inY,
                                       int inWidth,
                                       int inHeight)
Convenience method for subclasses, given the anchor position, calculate the label position.


drawLabel

public boolean drawLabel(Record inRecord,
                         java.awt.Graphics inGraphics,
                         Converter inConverter,
                         Shader inShader)
Draw the label for the record on the graphics context

Specified by:
drawLabel in interface Labeler

drawLabel

protected abstract boolean drawLabel(Record inRecord,
                                     java.awt.Graphics inGraphics,
                                     Converter inConverter)
Draw the record after checking for not null.


drawLabelHighlight

public boolean drawLabelHighlight(Record inRecord,
                                  java.awt.Graphics inGraphics,
                                  Converter inConverter,
                                  Shader inShader)
Highlight the Label when the shape is highlighted.

Specified by:
drawLabelHighlight in interface Labeler

toString

public java.lang.String toString()
Return the name of the labeler.


getNode

public Node getNode()
get the configuration information for this labeler

Specified by:
getNode in interface Labeler

setNode

public void setNode(Node inNode)
             throws java.lang.Exception
Set the configuration information for this labeler

Specified by:
setNode in interface Labeler
Throws:
java.lang.Exception

beginLabel

public void beginLabel()
Called before the layer is initially labeled to allow the labeler to prepare for labeling.

Specified by:
beginLabel in interface Labeler

endLabel

public void endLabel()
Called after the layer has completed labeling.

Specified by:
endLabel in interface Labeler

drawString

public static void drawString(java.lang.String inString,
                              java.awt.Graphics2D inGraphics,
                              float inX,
                              float inY,
                              float inWidth,
                              float inHeight)
Draw the string even if it contains carrage returns.


getBounds

public static java.awt.geom.Rectangle2D getBounds(java.lang.String inString,
                                                  java.awt.Graphics2D inGraphics)
Method to get the length and width of the string even if it contains carage returns.


getStrings

public static java.lang.String[] getStrings(java.lang.String inString)
Get the individual Strings.