[OpenMap Users] RE: Strange Properties Problem

From: Sutphin, William B CIV NUWC NWPT <william.sutphin_at_navy.mil>
Date: Tue, 10 Feb 2009 07:18:30 -0500

I found the issue. It is NetBeans not displaying the "next" reference for
Hashtable. When I used "props.list(System.out)" it printed them all
correctly. However, the reason I chased down this slippery slope was that
ShapeLayer was complaining. I need to have a look at that.

Bill Sutphin
Naval Undersea Warfare Center, Division Newport
Bldg 1351, Room 211C
Newport, RI 02841
(401) 832-5813
DSN 432-5813


-----Original Message-----
From: Sutphin, William B CIV NUWC NWPT
Sent: Monday, February 09, 2009 9:16
To: openmap-users_at_bbn.com
Subject: Strange Properties Problem

Hi
 
I'm just getting started with OM. I'm trying to load a shape file from a
menu of my own implementation, but I am having a strange problem with
Properties. I noticed it because OM prints out a few messages when I am
debugging with netbeans if the required property strings aren't set.
 
I do this to set up the ShapeLayer
 
   Properties props = new Properties();
 
   props.put(ShapeLayer.PrettyNameProperty, label);
   props.put(ShapeLayer.MinScaleProperty, "10.0");
   props.put(ShapeLayer.MaxScaleProperty, "80000000.0");
   props.put(ShapeLayer.shapeFileProperty, shapefilePath);
   props.put(ShapeLayer.spatialIndexProperty, spatialfilePath);
 
   layer.setProperties(props);

It looks innocent enough, but remarkably the "spatialIndexProperty" key and
value is overwriting the "shapeFileProperty" key and value. According to
the debugger in netbeans, the backing Hashtable has the correct number of
entries (five), but only four items are set. Also, upon checking the return
from "put", no indication is given of the previous value that was replaced.
Needless to say, without the shapefile path, OM is not happy. The only way
I've been able to address it is to use "getPropertyInfo(null)". It will
send back a Properties object with the keys set correctly. I just replace
the above keys to the values I need.

It appears as if a collision is occuring in the Hashtable and that the
collision is not being handled correctly. I can reproduce the issue with a
"raw" Hashtable and solve it by doing "new Hashtable<String, String>(50)" so
there are no collisions.

Please tell me I'm missing something. I'd like to believe it is something
I'm doing wrong.
 
Thanks
 
Bill Sutphin

 



--
[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 - 07:34:27 EST

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