Skip to content

Commit

Permalink
Merge pull request #2158 from TerriaJS/selectWmsElevation
Browse files Browse the repository at this point in the history
Add the ability in the UI to select WMS dimensions like Elevation
  • Loading branch information
RacingTadpole committed Oct 12, 2016
2 parents c58bfa3 + 50400ac commit a86f74f
Show file tree
Hide file tree
Showing 14 changed files with 2,138 additions and 97 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Change Log
* Fixed calculation of end dates for moving-point csv files, which could lead to points disappearing periodically.
* Fixed a bug that prevented fractional seconds in time-varying WMS periodicity.
* Added the ability to the workbench UI to select the `style` to use to display a Web Map Service (WMS) layer when multiple styles are available.
* Added the ability to the workbench UI to select from among the available dimensions of a Web Map Service (WMS) layer.
* Improved the error reporting and handling when specifying invalid values for the WMS COLORSCALERANGE parameter in the UI.
* Added the ability to drag existing points when creating a `UserDrawing`.
* Fixed a bug that could cause nonsensical legends for CSV columns with all null values.
Expand All @@ -19,6 +20,7 @@ Change Log
* Fixed support for time-varying feature info for vector tile based region mapping.
* `updateApplicationOnMessageFromParentWindow` now also allows messages from the `opener` window, i.e. the window that opened the page by calling `window.open`. The parent or opener may now also send a message with an `allowOrigin` property to specify an origin that should be allowed to post messages.
* Fixed a bug that prevented charts from loading http urls from https.
* The `isNcWMS` property of `WebMapServiceCatalogItem` is now set to true, and the COLORSCALERANGE controls are available in the UI, for ncWMS2 servers.
* Added the ability to prevent csvs with time and `id` columns from appearing as moving points, by setting `idColumns` to either `null` or `[]`.
* Fixed a bug that prevented default parameters to `CatalogFunction`s from being shown in the user interface.
* Fixed a problem that made `BooleanParameter`s show up incorrectly in the user interface.
Expand Down
17 changes: 11 additions & 6 deletions lib/Models/WebMapServiceCatalogGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ sending an email to <a href="mailto:'+that.terria.supportEmail+'">'+that.terria.
rootLayers = singleRoot.Layer;
}

addLayersRecursively(that, that, json, rootLayers, parentLayer);
var infoDerivedFromCapabilities = {
availableStyles: WebMapServiceCatalogItem.getAllAvailableStylesFromCapabilities(json),
availableDimensions: WebMapServiceCatalogItem.getAllAvailableDimensionsFromCapabilities(json)
};

addLayersRecursively(that, that, json, rootLayers, parentLayer, infoDerivedFromCapabilities);
}
}).otherwise(function(e) {
throw new TerriaError({
Expand Down Expand Up @@ -220,7 +225,7 @@ function getNameFromLayer(wmsGroup, layer) {
}
}

function addLayersRecursively(wmsGroup, parentGroup, capabilities, layers, parent) {
function addLayersRecursively(wmsGroup, parentGroup, capabilities, layers, parent, infoDerivedFromCapabilities) {
if (!(layers instanceof Array)) {
layers = [layers];
}
Expand Down Expand Up @@ -248,7 +253,7 @@ function addLayersRecursively(wmsGroup, parentGroup, capabilities, layers, paren
var allName = '(All)';
var originalNameForAll;
if (defined(layer.Name) && layer.Name.length > 0) {
var all = createWmsDataSource(wmsGroup, capabilities, layer);
var all = createWmsDataSource(wmsGroup, capabilities, layer, infoDerivedFromCapabilities);

if (!wmsGroup.flatten) {
originalNameForAll = all.name;
Expand All @@ -258,7 +263,7 @@ function addLayersRecursively(wmsGroup, parentGroup, capabilities, layers, paren
group.add(all);
}

addLayersRecursively(wmsGroup, group, capabilities, layer.Layer, layer);
addLayersRecursively(wmsGroup, group, capabilities, layer.Layer, layer, infoDerivedFromCapabilities);

if (!wmsGroup.flatten) {
if (group.items.length === 1 && group.items[0].name.indexOf(allName) === 0) {
Expand All @@ -275,14 +280,14 @@ function addLayersRecursively(wmsGroup, parentGroup, capabilities, layers, paren
}
}

function createWmsDataSource(wmsGroup, capabilities, layer) {
function createWmsDataSource(wmsGroup, capabilities, layer, infoDerivedFromCapabilities) {
var result = new WebMapServiceCatalogItem(wmsGroup.terria);

result.name = getNameFromLayer(wmsGroup, layer);
result.layers = layer.Name;
result.url = wmsGroup.url;

result.updateFromCapabilities(capabilities, true, layer);
result.updateFromCapabilities(capabilities, true, layer, infoDerivedFromCapabilities);

if (typeof(wmsGroup.itemProperties) === 'object') {
result.updateFromJson(wmsGroup.itemProperties);
Expand Down
Loading

0 comments on commit a86f74f

Please sign in to comment.