shp_renderer.geometry
Class SHPPolyType

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

public abstract class SHPPolyType
extends SHPShape

SHPPolyType - This class stores the data associated with a poly type, which means a shape with a variable series of points. It can be extended to represent polygons or polylines, and perhaps other types.

Author:
Richard McKenna

Constructor Summary
SHPPolyType(double[] initBoundingBox, int initNumBytes, int initNumParts, int initNumPoints, int[] initParts, double[] initXPointsData, double[] initYPointsData)
          This constructor initializes all data needed to render.
 
Method Summary
 void addBytes(int bytesToAdd)
          We add bytes to keep track of the full file size.
 int calculateSize(int partsIndex)
          This method calculates and returns the number of points in the poly type at partsIndex.
 void fillData(int partsIndex, int size, int[] xData, int[] yData, double zoomScale, double viewportCenterX, double viewportCenterY, int panelWidth, int panelHeight)
          This method fills in the xData and yData arrays with the necessary points data for rendering.
 double[] getBoundingBox()
          This method returns the bounding box.
 int getNumBytes()
          This method returns the number of bytes.
 int getNumParts()
          This method returns the number of parts.
 int getNumPoints()
          This method returns the number of points.
 int[] getParts()
          This method returns the parts.
 double[] getXPointsData()
          This method returns the x points data.
 int[] getXRenderData()
          This method returns the x rendering data.
 double[] getYPointsData()
          This method returns the y points data.
 int[] getYRenderData()
          This method returns the y rendering data.
 
Methods inherited from class shp_renderer.geometry.SHPShape
getFillColor, getLineColor, getRecordLength, getRecordNumber, render, setFillColor, setLineColor, setRecordLength, setRecordNumber
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SHPPolyType

public SHPPolyType(double[] initBoundingBox,
                   int initNumBytes,
                   int initNumParts,
                   int initNumPoints,
                   int[] initParts,
                   double[] initXPointsData,
                   double[] initYPointsData)
This constructor initializes all data needed to render.

Parameters:
initBoundingBox - The bounding box for the polygon.
initNumBytes - The number of bytes.
initNumParts - The number of parts.
initNumPoints - The number of points.
initParts - The Parts.
initXPointsData - The x point data.
initYPointsData - The y point data.
Method Detail

getNumBytes

public int getNumBytes()
This method returns the number of bytes.

Returns:
The number of bytes.

getBoundingBox

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

Overrides:
getBoundingBox in class SHPShape
Returns:
The bounding box.

getNumParts

public int getNumParts()
This method returns the number of parts.

Returns:
The number of parts.

getNumPoints

public int getNumPoints()
This method returns the number of points.

Returns:
The number of points.

getParts

public int[] getParts()
This method returns the parts.

Returns:
The parts.

getXPointsData

public double[] getXPointsData()
This method returns the x points data.

Returns:
The x points data.

getYPointsData

public double[] getYPointsData()
This method returns the y points data.

Returns:
The y points data.

getXRenderData

public int[] getXRenderData()
This method returns the x rendering data.

Returns:
the x rendering data.

getYRenderData

public int[] getYRenderData()
This method returns the y rendering data.

Returns:
The y rendering data.

calculateSize

public int calculateSize(int partsIndex)
This method calculates and returns the number of points in the poly type at partsIndex.

Parameters:
partsIndex - The index of the part.

addBytes

public void addBytes(int bytesToAdd)
We add bytes to keep track of the full file size.

Parameters:
bytesToAdd - The bytes that are going to be added.

fillData

public void fillData(int partsIndex,
                     int size,
                     int[] xData,
                     int[] yData,
                     double zoomScale,
                     double viewportCenterX,
                     double viewportCenterY,
                     int panelWidth,
                     int panelHeight)
This method fills in the xData and yData arrays with the necessary points data for rendering.

Parameters:
partsIndex - The index of the part.
size - The size of the fill area.
xData - The array of x data.
yData - The array of y data.
zoomScale - the level of zoom.
viewportCenterX - The center location of the viewport x.
viewportCenterY - The center location of the viewport y.
panelWidth - The width of the panel.
panelHeight - The height of the panel.