Ticket #2251 (closed feature: fixed)

Opened 4 years ago

Last modified 4 years ago

Update WMC format to support params that are not OL Layer properties

Reported by: bbinet Owned by: tschaub
Priority: minor Milestone: 2.9 Release
Component: Format.WMC Version: 2.8
Keywords: Cc:
State: Complete

Description

The WMC specification is supporting some params that are not stored in an OpenLayers.Layer object. For example I had to build a WMC to save also the list of styles and formats supported by a WMS layer, but the OpenLayers WMC format does not currently handle these informations.

The attached patch is trying to address this missing feature. (still needs more work, tests)

Here is a small explanation of the patch :

WMC format is now working with a "context": it can generate a WMC given a context, or generate a context given a WMC. A context is javascript object designed to store all params that the WMC specs describes, not only those supported by an OpenLayers layer. So if we fill the context object with styles and formats informations, then they will be stored in the wmc.

The patch is preserving the api compatibility by being able to generate a WMC given a OpenLayers.Map and to generate a OpenLayers.Map given an WMC (in WMS.js, functions are now dedicated to translate OpenLayers map/layers into a context object and vice versa).

Attachments

patch_2251-r9634-A0.diff Download (33.2 KB) - added by bbinet 4 years ago.
patch_2251-r9638-A1.diff Download (33.2 KB) - added by bbinet 4 years ago.
patch_2251-r9654-A2.diff Download (45.7 KB) - added by bbinet 4 years ago.
patch_2251-r9735-cleaning.diff Download (2.1 KB) - added by bbinet 4 years ago.

Change History

Changed 4 years ago by bbinet

Changed 4 years ago by bbinet

Here is a short description of the context object, with corresponding WMC nodes.

context = {
  projection: "General/BoundingBox/SRS"
  bounds: "General/BoundingBox/minx" [OL.Bounds]
                "General/BoundingBox/miny"
                "General/BoundingBox/maxx"
                "General/BoundingBox/maxy"
  size: "General/Window/width" [OL.Size] --> write only
          "General/Window/height"
  title: "General/Title"
  maxExtent: "General/Extension/ol:maxExtent(attrs#minx,miny,maxx,maxy)" [OL.Bounds]
  abstract: "General/Abstract" --> read only

  layersInfo: "LayerList" [{
    name: "Layer/Name"
    title: "Layer/Title"
    metadataURL: "Layer/MetadataURL/OnlineResource(attrs#xlink:href)"
    version: "Layer/Server(attrs#version)"
    url: "Layer/Server/OnlineResource(attrs#xlink:href)"
    queryable: "Layer(attrs#queryable)"
    visibility: "Layer(attrs#hidden)"
    minScale: "Layer/sld:MaxScaleDenominator"
    maxScale: "Layer/sld:MinScaleDenominator"
    styles: "Layer/StyleList" [{
      current: "Style(attrs#current)"
      name: "Style/Name" or "Style/SLD/Name" if SLD
      title: "Style/Title" or "Style/SLD/Title" if SLD
      abstract: "Style/Abstract" if not SLD
      legend: { --> read only
        width: "Style/LegendURL(attrs#width)"
        height: "Style/LegendURL(attrs#height)"
        href: "Style/LegendURL/OnlineResource(attrs#xlink:href)"
      }
      href: "Style/SLD/OnlineResource(attrs#xlink:href)"
      body: "Style/SLD/StyledLayerDescriptor" [xml document]
    }]
    formats: "Layer/FormatList" [{
      current: "Format(attrs#current)"
      value: "Format"
    }]
    maxExtent: "Layer/Extension/ol:maxExtent(attrs#minx,miny,maxx,maxy)" [OL.Bounds]
    transparent: "Layer/Extension/ol:transparent"
    numZoomLevels: "Layer/Extension/ol:numZoomLevels"
    units: "Layer/Extension/ol:units"
    isBaseLayer: "Layer/Extension/ol:isBaseLayer"
    opacity: "Layer/Extension/ol:opacity"
    displayInLayerSwitcher: "Layer/Extension/ol:displayInLayerSwitcher"
    singleTile: "Layer/Extension/ol:singleTile"
  }]
}

Changed 4 years ago by bbinet

Note that patch_2251-r9634-A0.diff Download depends on latest patch from #2242 which have to be applied first.

Changed 4 years ago by bbinet

Changed 4 years ago by bbinet

patch_2251-r9638-A1.diff Download is fixing few things from previous patch.

Format/WMC.html tests now pass in FF3. Still needs more work for other WMC tests to pass.

Changed 4 years ago by bbinet

  • state changed from Needs More Work to Review

patch_2251-r9654-A2.diff Download is fixing tests for v1.html and v1_1_0.html.

Relevant tests now pass on FF3.

Changed 4 years ago by bbinet

Note that patch_2251-r9654-A2.diff Download still depends on latest patch from #2242 which have to be applied first.

Changed 4 years ago by bbinet

Changed 4 years ago by tschaub

  • status changed from new to assigned

Reviewing now.

Changed 4 years ago by tschaub

  • state changed from Review to Commit

This is big. Looks good to me. At some point, it would be good to hear Bart's opinion on it (if he isn't already in on the work). Since the patch applies, tests pass, and the example continues to work, I think it is good to go.

Please commit.

Changed 4 years ago by tschaub

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

(In [9733]) Adding some serious enhancements to the WMC format. With this, OL map and layer objects can be created from WMC context objects and vice versa. Thanks for the great patch bbinet. r=me (closes #2251)

Changed 4 years ago by bartvde

Indeed a huge patch :-)

One comment: why is read_wmc_LatLonBoundingBox still commented and not taken out completely? There is comment which says: //FIXME: LatLonBoundingBox is not in spec.

Minor spelling mistake: optionnal --> optional (a few occurrences).

Looks good!

Changed 4 years ago by bbinet

Changed 4 years ago by bbinet

Thanks to tschaub and bartvde for the review.

Please commit also patch_2251-r9735-cleaning.diff Download which is cleaning comments as bartvde pointed out in his last comment.

I leave this ticket closed since the new patch does not bring any functional change, but only removes commented code and fixes typo in comments.

Changed 4 years ago by bartvde

Hi bbinet, done in r9736, thanks for creating the patch.

Note: See TracTickets for help on using tickets.