Ticket #2360 (closed feature: fixed)

Opened 4 years ago

Last modified 3 years ago

make Layer.addOptions call initResolutions if necessary

Reported by: elemoine Owned by: euzuro
Priority: minor Milestone: 2.10 Release
Component: Layer Version: 2.8
Keywords: Cc:
State: Complete

Description

this tickets suggests modifying the Layer.addOptions method in such a way that initResolutions is called (again) if at least one of the new options is a "resolution option" (one of 'projection', 'units', 'scales', 'resolutions', 'maxScale', 'minScale', 'maxResolution', 'minResolution', 'minExtent', 'maxExtent', 'numZoomLevels', 'maxZoomLevel').

Attachments

patch-2360-r9840-A0.diff Download (6.0 KB) - added by elemoine 4 years ago.
patch-2360-r9978-A1.diff Download (4.1 KB) - added by elemoine 3 years ago.
apply patch from #2427 before this one
patch-2360-A2.diff Download (5.8 KB) - added by elemoine 3 years ago.
patch-2360-A3.diff Download (6.8 KB) - added by elemoine 3 years ago.
addresses Bart's comments

Change History

Changed 4 years ago by elemoine

Changed 3 years ago by elemoine

apply patch from #2427 before this one

follow-up: ↓ 2   Changed 3 years ago by bartvde

  • state set to Review

I assume this is ready for review elemoine?

in reply to: ↑ 1   Changed 3 years ago by elemoine

Replying to bartvde:

I assume this is ready for review elemoine?

Hi Bart. I'd like that #2427 gets reviewed and committed first. I'll mark #2427 as Review once 2.9 is out.

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

Hi Eric, since #2427 has been committed, is this ready for review?

in reply to: ↑ 3   Changed 3 years ago by elemoine

Replying to bartvde:

Hi Eric, since #2427 has been committed, is this ready for review?

Hi Bart, thanks for bringing this back up. I'd like to give it another look before changing the ticket state to review. I'll do it in the coming days.

Changed 3 years ago by elemoine

  Changed 3 years ago by elemoine

Bart, I made a few adjustments to the patch and added tests (patch-2360-A2.diff Download). Tests pass in FF3. This is now ready for review.

follow-up: ↓ 7   Changed 3 years ago by bartvde

Hi Eric, looks good, but I have a few questions:

  • shouldn't you check for the existence of this.projection:
if(typeof this.projection === "string") { 
if (this.projection && typeof this.projection == "string") {
  • shouldn't this.units be taken from projection in addOptions as well? Like is done in setMap?
            // Check the projection to see if we can get units -- if not, refer
            // to properties.
            this.units = this.projection.getUnits() ||
                         this.units || this.map.units;
  • I did not really get your last change in the test ({chicken: chicken}), can you elaborate?

in reply to: ↑ 6   Changed 3 years ago by elemoine

Replying to bartvde:

Hi Eric looks good,

Thanks for reviewing Bart.

but I have a few questions: * shouldn't you check for the existence of this.projection:

if(typeof this.projection === "string") { 

if (this.projection && typeof this.projection == "string") {

If this.projection is undefined then typeof this.projection == "string" will evaluate to false, so I think I'm ok.

* shouldn't this.units be taken from projection in addOptions as well? Like is done in setMap?

            // Check the projection to see if we can get units -- if not, refer
            // to properties.
            this.units = this.projection.getUnits() ||
                         this.units || this.map.units;

You're right.

* I did not really get your last change in the test ({chicken: chicken}), can you elaborate?

With the new code in addOptions, if the projection option is a string then an OpenLayers.Projection object is created, so the test

t.eq(layer.projection, projection, "projection set correctly");

fails without this change.

I'll work on a new patch to address you second point.

  Changed 3 years ago by bartvde

Eric, can you also remove the this.projection check then from setMap since it is unnecessary as you correctly point out?

if (this.projection && typeof this.projection == "string") {
if (typeof this.projection == "string") {

TIA.

Changed 3 years ago by elemoine

addresses Bart's comments

follow-up: ↓ 10   Changed 3 years ago by elemoine

Bart, see patch-2360-A3.diff Download. I'd appreciate another look from you before I commit. Thanks.

in reply to: ↑ 9   Changed 3 years ago by elemoine

Replying to elemoine:

Bart, see patch-2360-A3.diff Download. I'd appreciate another look from you before I commit. Thanks.

I forgot to mention that tests pass in FF3, IE7 and Chrome5.

  Changed 3 years ago by bartvde

  • state changed from Review to Commit

Looks good now Eric, please commit.

  Changed 3 years ago by elemoine

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

(In [10680]) make Layer.addOptions call initResolutions if necessary, r=bartvde (closes #2360)

  Changed 3 years ago by bartvde

  • status changed from closed to reopened
  • resolution fixed deleted

Layer/Image test is failing because of this change I presume:

fail default layer projection correctly set. eq: types differ: got Object, but expected String

  Changed 3 years ago by bartvde

  • status changed from reopened to closed
  • state changed from Complete to Pullup
  • resolution set to fixed

Test case fixed in r10704 just like the other test was fixed up by elemoine. The fix for the test case should go into 2.10., so changing state to pullup.

  Changed 3 years ago by bartvde

  • status changed from closed to reopened
  • resolution fixed deleted

  Changed 3 years ago by crschmidt

  • status changed from reopened to closed
  • state changed from Pullup to Complete
  • resolution set to fixed

(In [10715]) Commit fixes for:

  • (Closes #2360) make Layer.addOptions call initResolutions if necessary
  • (Closes #2656) no way to pass read options from protocol to format
  • (Closes #2751) Changes in languages: "es" and "ca".
  • (Closes #2814) SLDSelect control tests failing
  • (Closes #2815) Cluster Strategy should not destroy all features

Also:

  • Change examples to use OSGeo, rather than MetaCarta, servers.
  • Change copyright statements to correctly state joint copyright in the project, rather than MetaCarta copyright.
Note: See TracTickets for help on using tickets.