Re: [OpenMap Users] Trouble with AreaHandler Object

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 26 Oct 2004 16:02:23 -0400

On Oct 19, 2004, at 2:09 PM, Todd Krokowski wrote:

> Hello All,
>
> I am trying to use the AreaHandler object to return the political
> boundaries associated with a particular country. I have been using the
> API documentation as my guide and as a result have ensured that I am
> setting all of my properties correctly. More specifically I am first
> creating an AreaShapeLayer and then try to retreive the AreaHandler
> from the newly created AreaShapeLayer. When debugging I find that the
> Hashtable (in AreaHandler) that stores all the PoliticalArea
> information is null. Below is the code I am using to setup and
> initialize the AreaHandler. If anyone could shed some light as to why
> the AreaHandler isn't functioning properly, I would greatlly
> appreciate it.
>
> Sample Code:
>
> // Initialize the properties for AreaShapeLayer
> Properties props = new Properties();
> props.setProperty("layer.shapeFile","data/countries.shp");
> props.setProperty("layer.spatialIndex","data/countries.ssx");
> props.setProperty("layer.csvFile","data/countries.csv");
> props.setProperty("layer.csvFileHasHeader","true");
> props.setProperty("layer.keyIndex","1");
> props.setProperty("layer.nameIndex", "4");
> // Create a new AreaShapeLayer
> AreaShapeLayer shapeLayer = new AreaShapeLayer();
> // Initialize the layer with the above properties
> shapeLayer.setProperties("layer", props);
>  
> AreaHandler areaHandler=shapeLayer.getAreas();
> // Do I need this?

Not really, it gets called the first time getGraphics() gets called on
the AreaHandler from the layer, when the layer is added to the map.
That way, if the layer is never added to the map, the application never
wastes time doing all that organizational work. The null hashtable is
a flag to the AreaHandler in getGraphics that it needs to organize
things.

I guess you would call it if you weren't displaying the contents of the
AreaHandler and you wanted it force it to organize itself.

- Don

> areaHandler.initialize("layer", props);
>
> Regards,
>
> --
> Todd Krokowski
> Software Engineer
>
> PAR Government Systems Corporation
> 314 S. Jay St.
> Rome, NY 13440
> Phone: (315) 339-0491 ext. 490
>
>
>


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
[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 Oct 26 2004 - 16:03:45 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:06 EDT