Ticket #2498 (new feature)

Opened 3 years ago

add to GetFeature an ability to retrieve the Bounds object used in the last select

Reported by: komacke Owned by:
Priority: minor Milestone: 2.13 Release
Component: Control Version: 2.8
Keywords: GetFeature Cc:
State:

Description

I'm putting this under component Control as I don't see a Control.GetFeature.

I don't believe there's a way to do this without a source change - please correct me if I'm wrong. The attached patch adds a new property to GetFeature.js that holds a Bounds object. The object is updated with the last Bounds used in a select.

This is valuable to me so that I can programmatically execute a refresh. When a user has done a select, I'd like them to have the option to turn on an auto-refresh. But for it to work, we need to know the Bounds that was used last.

I tried to be general and apply to selectSingle and selectHover also. Those events return Pixel and the respective GetFeature callback converts to Bounds with pixelToBounds using ClickTolerance. So for consistency and hopefully to simplify a refresh capability, I store the resultant Bounds object rather than Pixel. This way refresh can always be control.selectBox(control.bounds) regardless of the original type of select. Otherwise we'd need to keep track of the last select type also.

I've also added unit tests to the box and hover test sets. There was not a unit test for single so I didn't add one there.

Attachments

patch.2498 Download (4.0 KB) - added by komacke 3 years ago.
Patch to add feature and unit tests

Change History

Changed 3 years ago by komacke

Patch to add feature and unit tests

Note: See TracTickets for help on using tickets.