main
Class DrawingParameters

java.lang.Object
  extended by main.DrawingParameters

public class DrawingParameters
extends java.lang.Object

The DrawingParameters class contains information about how to draw a component on the map, independent of the component itself. It contains ranges for specifying the color and size of the component.


Field Summary
private  java.lang.String colorDescription
           
private  DisplayRanges colorRanges
           
private static int COLORRANGES
           
private static int NULL
           
private  java.lang.String sizeDescription
           
private  DisplayRanges sizeRanges
           
private static int SIZERANGES
           
 
Constructor Summary
DrawingParameters(java.lang.String rawParams)
          Creates a new instance of DrawingParameters, initialized with drawing parameters from an unparsed string from an external input file.
 
Method Summary
 boolean componentExists(MapComponent component)
          Returns true if the component should be drawn, false otherwise.
 java.awt.Color determineColor(MapComponent component)
          Returns the color that the map component should be drawn.
 int determineSize(MapComponent component)
          Returns the size that the map component should be drawn.
 java.lang.String getColorDescription()
          Gets the String containing the color ranges description.
 DisplayRanges getColorRanges()
          Gets the DisplayRanges containing the color ranges associated with the map component.
 java.lang.String getSizeDescription()
          Gets the String containing the size ranges description.
 DisplayRanges getSizeRanges()
          Gets the DisplayRanges containing the size ranges associated with the map component.
private  void parseLine(int property, java.lang.String line)
           
private  boolean parseSpecialCommand(int property, java.lang.String line)
           
 void setColorDescription(java.lang.String colorDescription)
           
 void setColorRanges(DisplayRanges colorRanges)
           
 void setSizeDescription(java.lang.String sizeDescription)
           
 void setSizeRanges(DisplayRanges sizeRanges)
           
 java.lang.String toString()
          Returns a string representation of this DrawingParameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL

private static final int NULL
See Also:
Constant Field Values

COLORRANGES

private static final int COLORRANGES
See Also:
Constant Field Values

SIZERANGES

private static final int SIZERANGES
See Also:
Constant Field Values

colorRanges

private DisplayRanges colorRanges

sizeRanges

private DisplayRanges sizeRanges

colorDescription

private java.lang.String colorDescription

sizeDescription

private java.lang.String sizeDescription
Constructor Detail

DrawingParameters

public DrawingParameters(java.lang.String rawParams)
                  throws java.text.ParseException
Creates a new instance of DrawingParameters, initialized with drawing parameters from an unparsed string from an external input file.

Parameters:
rawParams - a String of unparsed data from an input file
Throws:
java.text.ParseException - if there is a problem parsing the input file
Method Detail

parseLine

private void parseLine(int property,
                       java.lang.String line)
                throws java.text.ParseException
Throws:
java.text.ParseException

parseSpecialCommand

private boolean parseSpecialCommand(int property,
                                    java.lang.String line)
                             throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

componentExists

public boolean componentExists(MapComponent component)
Returns true if the component should be drawn, false otherwise.

Parameters:
component - - a MapComponent
Returns:
whether or not the map component should be drawn

determineColor

public java.awt.Color determineColor(MapComponent component)
Returns the color that the map component should be drawn.

Parameters:
component - a MapComponent
Returns:
the color that the map component should be drawn

determineSize

public int determineSize(MapComponent component)
Returns the size that the map component should be drawn.

Parameters:
component - a MapComponent
Returns:
the size that the map component should be drawn

getColorRanges

public DisplayRanges getColorRanges()
Gets the DisplayRanges containing the color ranges associated with the map component. The client and use it to add and remove ranges using its methods.

Returns:
the color ranges

getSizeRanges

public DisplayRanges getSizeRanges()
Gets the DisplayRanges containing the size ranges associated with the map component. The client and use it to add and remove ranges using its methods.

Returns:
the size ranges

getColorDescription

public java.lang.String getColorDescription()
Gets the String containing the color ranges description.

Returns:
the color ranges description

getSizeDescription

public java.lang.String getSizeDescription()
Gets the String containing the size ranges description.

Returns:
the size ranges description

toString

public java.lang.String toString()
Returns a string representation of this DrawingParameters. The string's format is in a valid input file format.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this DrawingParameters

setColorRanges

public void setColorRanges(DisplayRanges colorRanges)

setSizeRanges

public void setSizeRanges(DisplayRanges sizeRanges)

setColorDescription

public void setColorDescription(java.lang.String colorDescription)

setSizeDescription

public void setSizeDescription(java.lang.String sizeDescription)