[OpenMap Users] Possible bug in OMList.findAllTest(...)

From: Greg Jewell <greg17_at_jewell.net>
Date: Thu, 5 Jul 2012 11:02:33 -0400

Hello,

I have been porting a project of mine from using OpenMap 4.6.5 to OpenMap
5. For the most part, things have gone smoothly. I think I did find an
issue, however, in OMList.findAllTest(..).

Many of the graphics on my map are vague lists. When these graphics
overlap each other, and if the user clicks on them, the findAllTest would
only return a single item. In the following snippet of code, the OMList
addTo is used to store graphics that are found. However, addTo is being
re-used from previous operations. It's entirely possible that it's
populated with previous hits, but then is cleared out when a vague list is
encountered.

        if (geometry instanceof OMList<?>) {
            int oldSize = addTo.size();
            ((OMList<T>) geometry).findAll(x, y, limit, resetSelect, addTo);
            int newSize = addTo.size();

            if (isVague() && oldSize != newSize) {
                addTo.clear();
                addTo.add((T) this);
                return false;
            }
        }

I changed this block of code to the following, and things are now working
as I expect:

        if (geometry instanceof OMList<?>) {
            OMList<OMGraphic> tempList = create();
            ((OMList) geometry).findAll(x, y, limit, resetSelect, tempList);

            if (isVague() && tempList.size() > 0) {
                addTo.add(this);
                return false;
            }
        }

If somebody (Don?) could take a look at this and let me know whether I am
taking the proper action, I would appreciate it.


Thanks,
Greg Jewell


--
[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 Thu Jul 05 2012 - 11:04:16 EDT

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