Hi,
I've been playing around with the API for some time, but I can't seem
to get the LocationLayer to render to the map. If I'm not mistaken,
the BasicLocationHandler should render a few test locations to the map
- though whatever approach I attempt, I can't seem to get it working.
I've looked through the preexisting examples, but they didn't shed
much light on the situation. I've had no difficulties rendering other
layers of choice, but LocationLayer is giving me a headache. I'd
appreciate if someone could point me in the right direction.
Respectfully,
Adrian
public class SimpleMapTest
{
public static void main( String args[] )
{
// Create a Swing frame
JFrame frame = new JFrame( "Simple Map" );
// Size the frame appropriately
frame.setSize( 640, 480 );
// Create a MapBean
MapBean mapBean = new MapBean();
ShapeLayer shapeLayer = new ShapeLayer();
Properties shapeLayerProps = new Properties();
shapeLayerProps.put( "shapeFile", "data/shape/dcwpo-browse.shp" );
shapeLayerProps.put( "spatialIndex", "data/shape/dcwpo-browse.ssx" );
shapeLayer.setProperties( shapeLayerProps );
// Add the political layer to the map
mapBean.add( shapeLayer );
mapBean.add( getLocationLayer() );
// Add the map to the frame
frame.getContentPane().add( mapBean );
frame.addWindowListener( new WindowAdapter()
{
/**
* _at_param e
* Does nothing
*/
_at_Override
public void windowClosing( WindowEvent e )
{
System.exit( 0 );
}
} );
// Display the frame
frame.setVisible( true );
}
private static Component getLocationLayer()
{
LocationLayer locationLayer = new LocationLayer();
BasicLocationHandler locationHandler = new BasicLocationHandler();
locationHandler.setShowLocations( true );
locationHandler.setShowNames( true );
locationHandler.setLayer( locationLayer );
return locationLayer;
}
}
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Feb 10 2009 - 12:07:18 EST