diff --git a/src/script/plugins/AddLayers.js b/src/script/plugins/AddLayers.js index b94b8603..a9779be0 100644 --- a/src/script/plugins/AddLayers.js +++ b/src/script/plugins/AddLayers.js @@ -132,6 +132,24 @@ gxp.plugins.AddLayers = Ext.extend(gxp.plugins.Tool, { */ doneText: "Done", + /** api: config[layerNameText] + * ``String`` + * Text for Layer Name in the Layer Card (i18n). + */ + layerNameText: "Name", + + /** api: config[layerAbstractText] + * ``String`` + * Text for Layer Abstract in the Layer Card (i18n). + */ + layerAbstractText: "Abstract", + + /** api: config[layerQueryableText] + * ``String`` + * Text for Layer "isQuerable" in the Layer Card (i18n). + */ + layerQueryableText: "Queryable", + /** api: config[search] * ``Object | Boolean`` * If provided, a :class:`gxp.CatalogueSearchPanel` will be added as a @@ -466,14 +484,7 @@ gxp.plugins.AddLayers = Ext.extend(gxp.plugins.Tool, { }, createColumnModel: function() { - // http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=topp:states - // '' + - // {layer.url.params.LAYERS} - var tplLayerURL ='{url}'; - var tplLayerName ='{LAYERS}'; - var tplReqURL = tplLayerURL +'REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH='+ this.layerPreviewWidth +'&HEIGHT='+ this.layerPreviewHeight +'&LAYER=' + tplLayerName; -// var previewImage = ''; - var previewImage = ''; + // For use in previewImage. var layerPreviewWidth = this.layerPreviewWidth, layerPreviewHeight = this.layerPreviewHeight; var self = this; @@ -508,7 +519,7 @@ gxp.plugins.AddLayers = Ext.extend(gxp.plugins.Tool, { '' + '{previewImage}' + '' + - '

Name: {name}
Abstract: {abstract}

' + + '

' + this.layerNameText + ': {name}
' + this.layerAbstractText + ': {abstract}
' + this.layerQueryableText + ': {queryable}

' + '' + '' + @@ -548,9 +559,12 @@ gxp.plugins.AddLayers = Ext.extend(gxp.plugins.Tool, { var data = record.data; data.id = record.id; var source = self.target.layerSources[record.store.sourceId]; + + // Let LayerSource provide a URL to a preview image, if none use 'preview-notavailable' CSS. var previewImageURL = source.getPreviewImageURL(record, layerPreviewWidth, layerPreviewHeight); if (previewImageURL) { - data.previewImage = ''; + data.previewImage = '
 
'; + // data.previewImage = ''; } else { data.previewImage = '
 
'; } @@ -745,6 +759,9 @@ gxp.plugins.AddLayers = Ext.extend(gxp.plugins.Tool, { case 'REST': ptype = 'gxp_arcrestsource'; break; + case 'WMS': + ptype = 'gxp_wmssource'; + break; default: ptype = 'gxp_wmscsource'; } diff --git a/src/script/plugins/TMSSource.js b/src/script/plugins/TMSSource.js index 0f907b3e..c9ae579e 100644 --- a/src/script/plugins/TMSSource.js +++ b/src/script/plugins/TMSSource.js @@ -25,6 +25,8 @@ gxp.data.TMSCapabilitiesReader = Ext.extend(Ext.data.DataReader, { recordType || meta.fields || [ {name: "name", type: "string"}, {name: "title", type: "string"}, + // JvdB: Added abstract, was returned but not in record def+data. + {name: "abstract", type: "string"}, {name: "tileMapUrl", type: "string"} ]); } @@ -67,6 +69,8 @@ gxp.data.TMSCapabilitiesReader = Ext.extend(Ext.data.DataReader, { ), title: data.title, name: data.title, + // JvdB: Added abstract, was returned but not in record def+data. + abstract: data.abstract, tileMapUrl: this.meta.baseUrl })); } @@ -87,6 +91,8 @@ gxp.data.TMSCapabilitiesReader = Ext.extend(Ext.data.DataReader, { ), title: tileMap.title, name: tileMap.title, + // JvdB: Added abstract, was returned but not in record def+data. + abstract: data.abstract, tileMapUrl: url })); } diff --git a/src/script/plugins/WMSSource.js b/src/script/plugins/WMSSource.js index 8050cedc..ddd55904 100644 --- a/src/script/plugins/WMSSource.js +++ b/src/script/plugins/WMSSource.js @@ -166,8 +166,9 @@ gxp.plugins.WMSSource = Ext.extend(gxp.plugins.LayerSource, { /** api: config[version] * ``String`` * If specified, the version string will be included in WMS GetCapabilities - * requests. By default, no version is set. + * requests. By default, no version 1.1.1 (JvdB, to ensure some MD works and no axis ordering issues) is set. */ + version: "1.1.1", /** api: config[requiredProperties] * ``Array(String)`` List of config properties that are required for each @@ -223,8 +224,18 @@ gxp.plugins.WMSSource = Ext.extend(gxp.plugins.LayerSource, { getPreviewImageURL: function (record, width, height) { var layerURL = record.data.layer.url; var layerName = record.data.name; - + var layerFormat = record.data.formats && record.data.formats.length > 0 ? record.data.formats[0] : 'image/png'; + // the minimum scale value at which the layer should display, e.g. 50000000 + var layerMinScale = record.data.minScale; + // the maximum scale value at which the layer should display, e.g. 10000000 + var layerMaxScale = record.data.maxScale; + var mapProjection = this.target.map.projection; + var bounds = OpenLayers.Bounds.fromArray(record.data.llbbox); + var scaledBounds = bounds.scale(0.5); + var bbox = scaledBounds.toString(); + // var bounds = var url = layerURL + 'REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=' + width + '&HEIGHT=' + height + '&LAYER=' + layerName; +// var url = layerURL + 'REQUEST=GetMap&VERSION=1.1.1&SRS=EPSG:4326&BBOX=' + bbox + '&FORMAT=' + layerFormat + '&WIDTH=' + width + '&HEIGHT=' + height + '&LAYERS=' + layerName; return url; },