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

From: Don Dietrick <dfdietrick_at_gmail.com>
Date: Fri, 6 Jul 2012 13:05:01 -0400

Hi Greg,

Yes, I think you are taking the proper action. Thanks for finding the bug and sending in the fix!

- Don

On Jul 5, 2012, at 11:02 AM, Greg Jewell wrote:

> 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 Fri Jul 06 2012 - 13:05:19 EDT

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