aodn / aodn-portal

AODN Open Geospatial Portal
https://portal.aodn.org.au/
GNU General Public License v3.0
21 stars 13 forks source link

Refactor of StylePanel #288

Closed jkburges closed 8 years ago

jkburges commented 11 years ago

I think #242 has to be fixed before this can be done, as StylePanel is also a shared instance.

Currently, Portal.details.StylePanel has some special handling in it for NcWMS layers, e.g.:

if (layer.isNcwms()) {
    this.ncwmsColourScalePanel.makeNcWMSColourScale(layer);
}
else {
    this.ncwmsColourScalePanel.hide();
}

I think we really should be trying to avoid this kind of if/else logic wherever possible. Keeping StylePanel, I suggest introducing a subclass say NcWmsStylePanel, which has an extra component (the ColourScalePanel).

We could then have layer.getStylePanel() which returns the appropriate implementation depending on what kind of layer it is.

dnahodil commented 9 years ago

Closing this as is has had recent attention and should be in a much better state than it was

jkburges commented 9 years ago

Still there: https://github.com/aodn/aodn-portal/blob/master/web-app/js/portal/details/StylePanel.js#L76

dnahodil commented 9 years ago

Aww man. I thought we'd tidied all that up :(