|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.squigle.layers.Layer
Layer is the abstract base class of all layer implementations. Layers each represent a specific aspect of a geographic area. A layer has a uniform rendering style (color, linewidth, etc) as well as being composed of a one of three geometric data types (point, polyline, polygon). Layers can be either readable or writable. Writable layers start out as empty, unsorted layers that allow geometry and metadata to be added to them. Readable layers are layers where their data is fully populated, sorted, and optimized for display and searching. Readable layers are created by loading a pregenerated layer, or by calling the sort() function on a populated writable layer. Readable layers can be writen to a channel for later use as a pre-rendered layer.
Layers each have their own paint() function that can be overridden for custom rendering needs. Layers also can register a metaDataHandler which can handle how metaData is rendered or processed by the rest of the application. A StreetNameMetaDataHandler would handle positioning and rendering of street names for a polyline layer that stores local road data. A HwyBadgeMetaDataHandler would handle the rendering and positioning of Highway badge graphics for a polyline layer that represents major highways.
Finally, layers can be made searchable. By passing a bounding box to the query() function of a searchable layer, an array of metaData records found within that bounding box are returned.
| Field Summary | |
int |
height
Since the layer also has a render component, we must know the drawing plane dimensions |
float |
max_threshold
|
float |
min_threshold
Thresholds determine the zoom range at which the layer is visible. |
float |
screenDiag
the current viewport diagonal |
double |
vp_lat_1
|
double |
vp_lat_2
|
double |
vp_lon_1
|
double |
vp_lon_2
|
int |
width
Since the layer also has a render component, we must know the drawing plane dimensions |
| Constructor Summary | |
Layer(java.nio.ByteBuffer geoData,
int geoDataPointer,
java.nio.ByteBuffer metaData,
int metaDataHeaderPointer,
org.squigle.layers.MetaDataHandler metaDataHandler)
Constructor for a readable layer |
|
Layer(float lon_1,
float lat_1,
float lon_2,
float lat_2,
java.awt.Color renderColor,
int renderWidth,
int geometryType,
java.lang.String[] metaDataHeaders,
org.squigle.layers.MetaDataHandler metaDataHandler)
Constructor for writable layer |
|
| Method Summary | |
static boolean |
boundsCollision(float[] p1,
float[] p2,
float[] p3,
float[] p4)
|
void |
free()
|
abstract void |
paint(java.awt.Graphics g)
Each layer needs a paint function that can render the layers geometry |
abstract 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 |
abstract int |
sort(int maxWeight,
int maxDepth)
The sort function processes the element 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. |
abstract int |
write(java.io.RandomAccessFile raf)
Writes a readable layer to a random access file handle Must be overridden to handle writing specific geometries |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public double vp_lon_1
public double vp_lat_1
public double vp_lon_2
public double vp_lat_2
public int width
public int height
public float min_threshold
public float max_threshold
public float screenDiag
| Constructor Detail |
public Layer(float lon_1,
float lat_1,
float lon_2,
float lat_2,
java.awt.Color renderColor,
int renderWidth,
int geometryType,
java.lang.String[] metaDataHeaders,
org.squigle.layers.MetaDataHandler metaDataHandler)
lon_1 - the upper left intitude of layerlat_1 - the upper left latitude of layerlon_2 - the lower right intitude of layerlat_2 - the lower right latitude of layerrenderColor - the color to render the layer asrenderWidth - the thickness of the elements renderedgeometryType - the geometry of the layer (point, polyline, polygon)metaDataHeaders - the column headers for the layers metadata
public Layer(java.nio.ByteBuffer geoData,
int geoDataPointer,
java.nio.ByteBuffer metaData,
int metaDataHeaderPointer,
org.squigle.layers.MetaDataHandler metaDataHandler)
geoData - a refrence to a ByteBuffer that contains the layer datageoDataPointer - a byte offset in the geoData ByteBuffer that points to the start of the geoData layermetaData - a refrence to a ByteBuffer that containts the layer's metadatametaDataHeaderPointer - a byte offset in the metaData ByteBuffer that points to the layers header definitions| Method Detail |
public void free()
public abstract int sort(int maxWeight,
int maxDepth)
maxWeight - the maximum elements a node should hold before splittingmaxDepth - the maximum depth nodes are allowed to split
public abstract void paint(java.awt.Graphics g)
g - the Graphics object the layer is rendered to
public abstract java.lang.String[][] query(float lon_1,
float lat_1,
float lon_2,
float lat_2)
lon_1 - the upper left intitude to search fromlat_1 - the upper left latitude to search fromlon_2 - the lower right intitude to search tolat_2 - the lower right latitude to search to
public abstract int write(java.io.RandomAccessFile raf)
throws java.io.IOException
raf - the random access file to write the layer to
java.io.IOException
public static boolean boundsCollision(float[] p1,
float[] p2,
float[] p3,
float[] p4)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||