org.squigle.layers
Class PolyLineLayer

java.lang.Object
  |
  +--org.squigle.layers.Layer
        |
        +--org.squigle.layers.PolyLineLayer

public class PolyLineLayer
extends Layer


Field Summary
 
Fields inherited from class org.squigle.layers.Layer
height, max_threshold, min_threshold, screenDiag, vp_lat_1, vp_lat_2, vp_lon_1, vp_lon_2, width
 
Constructor Summary
PolyLineLayer(java.nio.ByteBuffer geoData, int geoDataPointer, java.nio.ByteBuffer metaData, int metaDataHeaderPointer, org.squigle.layers.MetaDataHandler metaDataHandler)
          Constructor for a readable layer
PolyLineLayer(float lon_1, float lat_1, float lon_2, float lat_2, java.awt.Color renderColor, int renderWidth, java.lang.String[] metaDataHeaders, org.squigle.layers.MetaDataHandler metaDataHandler)
          Constructor for writable PolyLineLayer
 
Method Summary
 void addPolyLine(float[][] polyLine, java.lang.String[] metaData)
          Add a polyLine element to a writable PolyLineLayer
 void paint(java.awt.Graphics g)
          A PolyLineLayer specific rendering function
 java.lang.String[][] query(float lon_1, float lat_1, float lon_2, float lat_2)
          Search a layer for metaData within the bounding coordinates
 int sort(int maxWeight, int maxDepth)
          The sort function processes the polyline elements from a writable layer, sorting them into a BSP tree with a depth no greater than maxDepth, and no more than maxWeight elements per node.
 int write(java.io.RandomAccessFile raf)
          Writes a readable PolyLineLayer to a random access file handle
 
Methods inherited from class org.squigle.layers.Layer
boundsCollision, free
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolyLineLayer

public PolyLineLayer(float lon_1,
                     float lat_1,
                     float lon_2,
                     float lat_2,
                     java.awt.Color renderColor,
                     int renderWidth,
                     java.lang.String[] metaDataHeaders,
                     org.squigle.layers.MetaDataHandler metaDataHandler)
Constructor for writable PolyLineLayer

Parameters:
lon_1 - the upper left longitude of layer
lat_1 - the upper left latitude of layer
lon_2 - the lower right longitude of layer
lat_2 - the lower right latitude of layer
renderColor - the color to render the layer as
renderWidth - the thickness of the elements rendered
metaDataHeaders - the column headers for the layers metadata

PolyLineLayer

public PolyLineLayer(java.nio.ByteBuffer geoData,
                     int geoDataPointer,
                     java.nio.ByteBuffer metaData,
                     int metaDataHeaderPointer,
                     org.squigle.layers.MetaDataHandler metaDataHandler)
Constructor for a readable layer

Parameters:
geoData - a refrence to a ByteBuffer that contains the layer data
geoDataPointer - a byte offset in the geoData ByteBuffer that points to the start of the geoData layer
metaData - a refrence to a ByteBuffer that containts the layer's metadata
metaDataHeaderPointer - a byte offset in the metaData ByteBuffer that points to the layers header definitions
Method Detail

addPolyLine

public void addPolyLine(float[][] polyLine,
                        java.lang.String[] metaData)
Add a polyLine element to a writable PolyLineLayer

Parameters:
polyLine - an array of point data that describes the shape of the polyline
metaData - the polyline's metaData table record

sort

public int sort(int maxWeight,
                int maxDepth)
The sort function processes the polyline elements from a writable layer, sorting them into a BSP tree with a depth no greater than maxDepth, and no more than maxWeight elements per node. Depth overrides weight in cases where the max depth is reached but the node has more elements than maxWeight. On completion, sort sets readable = true.

Specified by:
sort in class Layer
Parameters:
maxWeight - the maximum elements a node should hold before splitting
maxDepth - the maximum depth nodes are allowed to split
Returns:
the number of elements processed

paint

public void paint(java.awt.Graphics g)
A PolyLineLayer specific rendering function

Specified by:
paint in class Layer
Parameters:
g - the Graphics object the layer is rendered to

query

public java.lang.String[][] query(float lon_1,
                                  float lat_1,
                                  float lon_2,
                                  float lat_2)
Search a layer for metaData within the bounding coordinates

Specified by:
query in class Layer
Parameters:
lon_1 - the upper left longitude to search from
lat_1 - the upper left latitude to search from
lon_2 - the lower right longitude to search to
lat_2 - the lower right latitude to search to
Returns:
an array of metaData String[]'s

write

public int write(java.io.RandomAccessFile raf)
          throws java.io.IOException
Writes a readable PolyLineLayer to a random access file handle

Specified by:
write in class Layer
Parameters:
raf - the random access file to write the layer to
Returns:
the filepointer to the root of the layer
java.io.IOException