Ticket #2072 (closed bug: fixed)

Opened 4 years ago

Last modified 4 years ago

when allOverlays is true a hidden layer can cause a WFS request

Reported by: bartvde Owned by: elemoine
Priority: minor Milestone: 2.8 Release
Component: Map Version: 2.8 RC1
Keywords: pullup Cc:
State: Complete

Description

If a vector layer (with a WFS protocol) is the lowest layer in the layer stack, and allOverlays is set to true, a moveTo will be sent to the vector layer even if this layer is not visible. Which will cause a new WFS request to go out unnecessary.

The solution I could think of is when allOverlays is true only call baseLayer.moveTo if it is in range.

this.baseLayer.moveTo(bounds, zoomChanged, dragging);

What do others think?

Attachments

ticket2072.patch Download (0.6 KB) - added by bartvde 4 years ago.
test-fails-with-ticket2072.patch Download (2.0 KB) - added by elemoine 4 years ago.
ticket2072.2.2.patch Download (3.1 KB) - added by elemoine 4 years ago.
ticket2072.html Download (2.0 KB) - added by bartvde 4 years ago.
example HTML to reproduce

Change History

Changed 4 years ago by bartvde

  Changed 4 years ago by bartvde

Two questions related to my solution:

-normally the baseLayer would always be visible, except for the case where allOverlays is true. So I don't think this extra test for visibility would harm the other cases, so I did not test specifically when allOverlays is true

-is there a need to also check the inRange stuff here as well? I guess it would also make sense to do that check but my patch does not incorporate it as yet.

I will need to make a new testcase for this as well.

  Changed 4 years ago by bartvde

I've got some issues with running svn diff on a Windows system, so I'll post my testcase inline (Map.html):

        map.zoomToMaxExtent();
        t.eq(moveCount, 1, "map.moveTo moves the base layer only once");
        // new testcase
        moveCount = 0;
        a.setVisibility(false);
        map.zoomToMaxExtent();
        t.eq(moveCount, 0, "map.moveTo moves the base layer only if it is visible");
        a.setVisibility(true);
        // end of new testcase
        t.eq(map.getCenter().toString(), "lon=0,lat=0", "a map with all overlays can have a center");

  Changed 4 years ago by crschmidt

I'm against doing another RC for this issue (though obviously I can be outvoted).

  Changed 4 years ago by elemoine

Bart, with your patch, a "move" or "zoomChanged" event is triggered even if the base layer isn't visible. So a BBOX strategy will still get an event and fetch features.

follow-up: ↓ 8   Changed 4 years ago by bartvde

Hi Eric, that's not what I was seeing in my test app, since I had a vector layer with WFS protocol and BBOX strategy, and the WFS request did not go off anymore.

  Changed 4 years ago by crschmidt

I'd like to do another RC as soon as possible. Can we come to some resolution on this -- either the patch works or doesn't work? Elemoine, did you test this, or just read the code?

Changed 4 years ago by elemoine

Changed 4 years ago by elemoine

  Changed 4 years ago by elemoine

test-fails-with-ticket2072.patch Download demonstrates the issue I mentioned above.

ticket2072.2.2.patch Download is a new patch that looks more valid to me.

in reply to: ↑ 5   Changed 4 years ago by elemoine

Replying to bartvde:

Hi Eric, that's not what I was seeing in my test app, since I had a vector layer with WFS protocol and BBOX strategy, and the WFS request did not go off anymore.

I don't understand why (but have no time to test that right now)

  Changed 4 years ago by bartvde

Eric is right, my patch does not work whereas his patch works fine. I'll attach an HTML example to reproduce. Just change the visiblity of the WFS layer to false using the LayerSwitcher and then zoom to max extent.

Changed 4 years ago by bartvde

example HTML to reproduce

  Changed 4 years ago by tschaub

  • owner set to elemoine
  • state set to Commit

Latest patch looks good to me. Confirmed that the example works and tests pass. Thanks for fixing this up.

  Changed 4 years ago by elemoine

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

(In [9370]) when allOverlays is true a hidden layer can cause a WFS request, testsed by bartvde, r=tschaub (closes #2072)

  Changed 4 years ago by elemoine

  • keywords pullup added
  • state changed from Complete to Pullup

  Changed 4 years ago by ahocevar

  • state changed from Pullup to Complete
Note: See TracTickets for help on using tickets.