Skip to content
Permalink
Browse files

Fix for external_wms

  • Loading branch information...
uprel committed Jul 9, 2019
1 parent f057291 commit b8f67da0654417afe4685e57923c7202a10a7093
Showing with 24 additions and 11 deletions.
  1. +18 −4 client/site/js/QGISExtensions.js
  2. +6 −7 client/site/js/WebgisInit_functions.js
@@ -429,17 +429,27 @@ Ext.extend(QGIS.PrintProvider, GeoExt.data.PrintProvider, {
}
var extra = getVisibleExtraLayersForPrint();
var extraDefinition = '';
var baseDefinition = '';
if(extra.length>0) {
var extraNames = extra.map(function(item){return item.name;});
extraDefinition = extra.map(function(item){return item.definition;})[0]; //get only first one, ok?
layers.unshift(extraNames.join(','));
}

//add currently visible base layer for printing if exists in projects
var printBaseLayer = wmsLoader.layerTitleNameMapping[currentlyVisibleBaseLayer];

if (printBaseLayer != undefined) {
layers.unshift(printBaseLayer);
if(currentlyVisibleBaseLayer) {
var printBaseLayer = wmsLoader.layerTitleNameMapping[currentlyVisibleBaseLayer];

if (printBaseLayer != undefined) {
layers.unshift(printBaseLayer);
} else {
var printBaseLayerOl2 = geoExtMap.map.getLayersByName(currentlyVisibleBaseLayer)[0];
var baseWms = getExternalWMSDefinition(printBaseLayerOl2);
if(baseWms) {
layers.unshift(baseWms.name);
baseDefinition = baseWms.definition;
}
}
}

if(this.additionalLayers.length>0) {
@@ -470,6 +480,10 @@ Ext.extend(QGIS.PrintProvider, GeoExt.data.PrintProvider, {
printUrl += '&' + extraDefinition;
}

if (baseDefinition>'') {
printUrl += '&' + baseDefinition;
}

// add highlight
//var highlightParams = highlighter.printParams("map0");
//if (highlightParams != null) {
@@ -2771,16 +2771,15 @@ function home() {
function getExternalWMSDefinition(layer) {

var layerName = layer.name;
var type = layer.type;
var def = JSON.parse(layer.definition);
var type = layer.params.SERVICE ? layer.params.SERVICE : 'unknown';

if(type=='WMS' && (Eqwc.settings.qgisVersion && parseInt(Eqwc.settings.qgisVersion)>2)) {
var definition = {
[layerName+':url']: def.url,
[layerName+':format']: def.params.FORMAT,
[layerName+':url']: layer.url.toLowerCase().replace('https','http'), //QGIS issue with https, assume URL is working also on http
[layerName+':format']: layer.params.FORMAT,
[layerName+':crs']: projectData.crs,
[layerName+':layers']: def.params.LAYERS,
[layerName+':styles']: def.params.STYLES
[layerName+':layers']: layer.params.LAYERS,
[layerName+':styles']: layer.params.STYLES
};

return {name: 'EXTERNAL_WMS:'+layerName, definition: Ext.urlEncode(definition)};
@@ -2802,7 +2801,7 @@ function getVisibleExtraLayersForPrint() {
if(wmsLoader.layerTitleNameMapping[extra.title]) {
ret.push({name: wmsLoader.layerTitleNameMapping[extra.title], definition: ''});
} else {
var externalWms = getExternalWMSDefinition(extra);
var externalWms = getExternalWMSDefinition(lay);
if(externalWms) {
ret.push({name: externalWms.name, definition: externalWms.definition});
}

0 comments on commit b8f67da

Please sign in to comment.
You can’t perform that action at this time.