From 229b2e4852bd9ec1e6b1a1c45ddaef41e5824446 Mon Sep 17 00:00:00 2001 From: Just van den Broecke Date: Mon, 14 Apr 2014 16:24:11 +0200 Subject: [PATCH] issue #230 - WMS and TMS preview image enhancements (use scaled image for WMS-attribution and tile preview images) --- src/script/plugins/AddLayers.js | 5 ++++- src/script/plugins/TMSSource.js | 5 ++++- src/script/plugins/WMSSource.js | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/script/plugins/AddLayers.js b/src/script/plugins/AddLayers.js index 42099e3b..70a169c6 100644 --- a/src/script/plugins/AddLayers.js +++ b/src/script/plugins/AddLayers.js @@ -600,7 +600,10 @@ gxp.plugins.AddLayers = Ext.extend(gxp.plugins.Tool, { // TODO: background image loading, and loading only once var previewImageURL = source.getPreviewImageURL(record, layerPreviewWidth, layerPreviewHeight); if (previewImageURL) { - data.previewImage = '
 
'; + // Only resize TMS preview images. TODO: make smarter an request from Source + var backgroundSize = record.data.scalePreviewImage === true ? 'background-size:' + layerPreviewWidth + 'px ' + layerPreviewHeight + 'px;' : ' '; + + data.previewImage = '
 
'; // data.previewImage = ''; } else { data.previewImage = '
 
'; diff --git a/src/script/plugins/TMSSource.js b/src/script/plugins/TMSSource.js index 2c96b9d4..bb5bc527 100644 --- a/src/script/plugins/TMSSource.js +++ b/src/script/plugins/TMSSource.js @@ -76,6 +76,7 @@ gxp.data.TMSCapabilitiesReader = Ext.extend(Ext.data.DataReader, { name: data.title, "abstract": abstrct, tileMapUrl: this.meta.baseUrl, + scalePreviewImage: true, group: this.meta.group })); } @@ -99,6 +100,7 @@ gxp.data.TMSCapabilitiesReader = Ext.extend(Ext.data.DataReader, { name: tileMap.title, "abstract": abstrct, tileMapUrl: url, + scalePreviewImage: true, group: this.meta.group })); } @@ -233,7 +235,8 @@ gxp.plugins.TMSSource = Ext.extend(gxp.plugins.LayerSource, { }); this.target.createLayerRecord({ source: this.id, - name: config.name + name: config.name, + scalePreviewImage: true }, callback, scope); }, scope: this diff --git a/src/script/plugins/WMSSource.js b/src/script/plugins/WMSSource.js index d15199e6..fda63c02 100644 --- a/src/script/plugins/WMSSource.js +++ b/src/script/plugins/WMSSource.js @@ -264,9 +264,11 @@ gxp.plugins.WMSSource = Ext.extend(gxp.plugins.LayerSource, { // var url = layerURL + 'REQUEST=GetMap&VERSION=1.1.1&SRS=EPSG:4326&BBOX=' + bbox + '&FORMAT=' + layerFormat + '&WIDTH=' + width + '&HEIGHT=' + height + '&LAYERS=' + layerName+layerScaleStr; var url; + record.data.scalePreviewImage = false; if (this.owsPreviewStrategies.indexOf('attributionlogo') >= 0 && record.data.attribution && record.data.attribution.logo && record.data.attribution.logo.href) { // Use attribution logo a preview image url = record.data.attribution.logo.href; + record.data.scalePreviewImage = true; } if (!url && this.owsPreviewStrategies.indexOf('getlegendgraphic') >= 0 ) {