[OpenMap Users] OMGraphicList and appObject

From: Tore Halset <halset_at_pvv.ntnu.no>
Date: Tue, 27 Feb 2007 14:49:20 +0100


All my OMGraphics have appObject to point back to the underlying
feature object. In a Layer I can then do a prepare().findAll(...) if
a user wants information about some features.

This works pretty well in most situations, but not so elegant for
features that need a OMGraphicList to represent the view. The problem
is that OMGraphicList.setAppObject does not make sure all the
graphics in the list have the same appObject, so findAll() may return
OMGraphics without a appObject.

To overcome this problem I have created my own subclass of
OMGraphicList that overrides setAppObject to set appObject on all
subgraphics as well and _add to set the appObject on OMGraphics added
at a later point in time. See attached code.

Do you think this should be the default behaviour of OMGraphicList?
Any reason to why this may *not* be a good

(On a side note: I sure hope it (in the future) will be possible to
still have the appObject as a single Object ref and not a Map as I
operate with a huge number of OMGraphics and do not want all those
extra Map-objects.)

  - Tore.

     public synchronized void setAppObject(Object obj) {

         for (Iterator it = iterator(); it.hasNext();) {
             OMGraphic g = (OMGraphic) it.next();
             if (g.getAppObject() == null) {

     protected synchronized void _add(OMGeometry g) {
         Object appObject = getAppObject();
         if (g.getAppObject() == null) {


[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 27 2007 - 08:52:17 EST

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