shp_renderer.geometry
Class SHPShape

java.lang.Object
  extended by shp_renderer.geometry.SHPShape
Direct Known Subclasses:
SHPPolyType

public abstract class SHPShape
extends java.lang.Object

This class serves as the parent type for all types of shapes that might be needed to render a shapefile. Note that we're really only using the polygon type (5), but in case we wanted to add others, we could extend this class.

Author:
Richard McKenna

Constructor Summary
SHPShape(double[] initBoundingBox)
          Init this shape with a loaded bounding box and some default colors.
 
Method Summary
 double[] getBoundingBox()
          This method returns the bounding box.
 java.awt.Color getFillColor()
          This method returns the fill color.
 java.awt.Color getLineColor()
          This method returns the line color.
 int getRecordLength()
          This method returns the record length.
 int getRecordNumber()
          This method returns the record number.
abstract  void render(java.awt.Graphics2D g2, double zoomScale, double viewportX, double viewportY, int panelWidth, int panelHeight)
          This method would be implemented by all subclasses, since each may be rendered differently.
 void setFillColor(java.awt.Color initFillColor)
          This method sets the fill color to the new input color.
 void setLineColor(java.awt.Color initLineColor)
          This method sets the line color to the new input color.
 void setRecordLength(int initRecordLength)
          This method sets the record length to the new input value.
 void setRecordNumber(int initRecordNumber)
          This method sets the record number to the new input value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SHPShape

public SHPShape(double[] initBoundingBox)
Init this shape with a loaded bounding box and some default colors.

Parameters:
initBoundingBox - The bounding box for the shape.
Method Detail

render

public abstract void render(java.awt.Graphics2D g2,
                            double zoomScale,
                            double viewportX,
                            double viewportY,
                            int panelWidth,
                            int panelHeight)
This method would be implemented by all subclasses, since each may be rendered differently.

Parameters:
g2 - The graphics used for rendering.
zoomScale - The level of zoom.
viewportX - The viewport center x.
viewportY - The viewport center y.
panelWidth - The width of the panel.
panelHeight - The height of the panel.

getRecordNumber

public int getRecordNumber()
This method returns the record number.

Returns:
The record number.

getRecordLength

public int getRecordLength()
This method returns the record length.

Returns:
The record length.

getLineColor

public java.awt.Color getLineColor()
This method returns the line color.

Returns:
The line color.

getFillColor

public java.awt.Color getFillColor()
This method returns the fill color.

Returns:
The fill color.

setRecordNumber

public void setRecordNumber(int initRecordNumber)
This method sets the record number to the new input value.

Parameters:
initRecordNumber - The new record number.

setRecordLength

public void setRecordLength(int initRecordLength)
This method sets the record length to the new input value.

Parameters:
initRecordLength - The new record length.

getBoundingBox

public double[] getBoundingBox()
This method returns the bounding box.

Returns:
The bounding box value.

setLineColor

public void setLineColor(java.awt.Color initLineColor)
This method sets the line color to the new input color.

Parameters:
initLineColor - The new line color.

setFillColor

public void setFillColor(java.awt.Color initFillColor)
This method sets the fill color to the new input color.

Parameters:
initFillColor - The new fill color.