[OpenMap Users] Strange Properties Problem

From: Sutphin, William B CIV NUWC NWPT <william.sutphin_at_navy.mil>
Date: Mon, 9 Feb 2009 09:16:23 -0500

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 Mon Feb 09 2009 - 09:30:15 EST

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