Re: [OpenMap Users] Simple question about OMGraphic attributes

From: Don Dietrick <dietrick_at_bbn.com>
Date: Mon, 3 Apr 2006 08:45:06 -0400

Hi Stephane,

You aren't supposed to set the ATT_MAP_KEY attribute in the attribute
table. The ATT_MAP_KEY is there to let the OMGraphic know that the
hashtable it is using for the attributes is the one the OMGraphic
created to hold them, and not some other hashtable that might have
been set previously as the appObject.

I didn't assume that if another hashtable was being held that I could
just use it without it causing problems for someone who might have
depended on its contents.

If you set your own hashtable in setAppObject(), and then set other
attributes, you would get your original hashtable back if you called
getAppObject(), instead of the one the OMGraphic is using for
attributes.

If you call setAttributes while there is an appObject set, the
OMGraphic should place the appObject in the attribute table provided,
inder the ATT_OBJ_KEY, and that appObject would still be returned
with a getAppObject() call.

I think you're right in that there is a bug,

         atts.put(ATT_MAP_KEY, atts);

should be added near the end of setAttributes(Map).

Thanks for the heads-up,

- Don


On Apr 3, 2006, at 4:54 AM, Stéphane Wasserhardt wrote:

> Hello all !
>
> I don't really understand the meaning of the "ATT_MAP_KEY"
> attribute in the attribute map of OMGraphics...
> I understood how appObjects were handled (just one object, or a map
> containing the appObject), but I don't understand why the map
> should point to itself. And why does the "getAttributes" return
> null if it does not (although getAttribute(Object) can return
> something) ?
> Anyway, that's not really the problem.
> In fact, I'm using the method "setAttributes" to directly set a map
> containing multiple attributes.
> If I already have an AppObject, it is appended to the map as expected.
> But the ATT_MAP_KEY attribute is not set by this method !
> I think I should not have to set it myself. It should be
> automatically done in the setAttributes method, as it is done by
> the putAttribute method.
> I think this is a bug which hasn't been noticed since it is rare to
> use the "setAttributes" method (users usually use "putAttribute").
> Am I right ?
> For the moment, I must use "putAttribute" for each attributes in my
> map :(
>
> Thanks in advance for your answers !
>
> Stephane
>
> --
> [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"]

--
[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 Apr 03 2006 - 08:46:06 EDT

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