org.squigle.layers
Class MetaDataHandler

java.lang.Object
  |
  +--org.squigle.layers.MetaDataHandler
Direct Known Subclasses:
PolygonLabelHandler, PolygonLabelMetaDataHandler, PolyLineLabelHandler

public class MetaDataHandler
extends java.lang.Object

MetaDataHandlers are used to keep a state of the metaData rendered by a layer, analyzing that data, and then performing some function based on that overall analysis. In most cases, they will be used to aggregate repeating street or landmark labels, analyze them in whole for the best position (angle, color, font, etc), and then finally to render the metadata overtop the geometry of the layer. MetaDataHandler's evaluate functions are called by the layers rendering loop as the layer draws the base geometry. The process function is called as the last step in a layers rendering process. It takes an object as a parameter, which is normally the Graphics object passed from the layer paint function, though it could be any object that has data that needs to be accessed or manipulated in the process stage.

As the base class, MetaDataHandler has null functionality. It will ignore all metadata evaluated and do nothing for the process step.


Constructor Summary
MetaDataHandler()
           
 
Method Summary
 void evaluateLine(float[][] pl, java.lang.String[] metaData)
          override to store polyline data and a pointer to its metaData for later evaluation
 void evaluatePoint(float[] p, java.lang.String[] metaDataPointer)
          override to store point data and a pointer to its metaData for later evaluation
 void evaluatePolygon(float[] pg, int metaDataPointer)
          override to store polygon data and a pointer to its metaData for later evaluation
 void process(java.lang.Object o)
          process the collected data
 void reset()
          clear the previous state from before evaluating the next frame
 void setLayer(org.squigle.layers.Layer layer)
          Stores a refrence to the layer this handler was registered to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaDataHandler

public MetaDataHandler()
Method Detail

setLayer

public void setLayer(org.squigle.layers.Layer layer)
Stores a refrence to the layer this handler was registered to. The refrence is used to access the metaData ByteBuffer as well as the header hash lookup.

Parameters:
layer - the parent layer

evaluatePoint

public void evaluatePoint(float[] p,
                          java.lang.String[] metaDataPointer)
override to store point data and a pointer to its metaData for later evaluation

Parameters:
p - point to be evaluated
metaDataPointer - the offset in the layers metaData ByteBuffer for this point

evaluateLine

public void evaluateLine(float[][] pl,
                         java.lang.String[] metaData)
override to store polyline data and a pointer to its metaData for later evaluation

Parameters:
pl - polyline to be evaluated

evaluatePolygon

public void evaluatePolygon(float[] pg,
                            int metaDataPointer)
override to store polygon data and a pointer to its metaData for later evaluation

Parameters:
pg - polygon to be evaluated
metaDataPointer - the offset in the layers metaData ByteBuffer for this polygon

process

public void process(java.lang.Object o)
process the collected data

Parameters:
o - an external object to be used by the process stage

reset

public void reset()
clear the previous state from before evaluating the next frame