Ticket #2340 (closed feature: fixed)

Opened 4 years ago

Last modified 3 years ago

add setLayer function to SelectFeature control

Reported by: bartvde Owned by: tschaub
Priority: minor Milestone: 2.9 Release
Component: Control.SelectFeature Version: 2.8
Keywords: Cc:
State: Complete

Description

To be able to tie a layer dynamically to the select feature control.

Attachments

ticket2340.patch Download (1.3 KB) - added by bartvde 4 years ago.
patch without tests
ticket2340.2.patch Download (3.9 KB) - added by bartvde 4 years ago.
new patch incorporating ahocevar's comments and includes tests now

Change History

Changed 4 years ago by bartvde

patch without tests

Changed 4 years ago by bartvde

  • state set to Review

I would appreciate it if someone more knowledgeable than me on the SelectFeature control could look at my approach, before I add tests. TIA.

Changed 4 years ago by ahocevar

Hey Bart, thanks for your efforts on this. The patch does the right thing, but IMO you could separate the code that is common with the initialize method out to a separate method:

        if(layers instanceof Array) {
            this.layers = layers;
            this.layer = new OpenLayers.Layer.Vector.RootContainer(
                this.id + "_container", {
                    layers: layers
                }
            );
        } else {
            this.layer = layers;
        }

Changed 4 years ago by bartvde

  • state changed from Review to Needs More Work

Thanks Andreas, I'll do that and I will add some tests as well.

Changed 4 years ago by bartvde

new patch incorporating ahocevar's comments and includes tests now

Changed 4 years ago by bartvde

  • state changed from Needs More Work to Review

Changed 4 years ago by ahocevar

  • state changed from Review to Commit

This looks good. Please commit if you can confirm that tests pass.

Changed 4 years ago by bartvde

  • status changed from new to closed
  • state changed from Commit to Complete
  • resolution set to fixed

(In [9789]) add setLayer function to SelectFeature control so that we can change the layer attached to the control on the fly, r=ahocevar (closes #2340)

Changed 3 years ago by crschmidt

Oh hey, I had no idea this existed. Nice job. :)

Changed 3 years ago by bjornharrtell

Me neither so got bartvde to mark it as API :)

Note: See TracTickets for help on using tickets.