Skip to content

Commit

Permalink
Printing extra (overlay) layers same logic as with baselayers (same l…
Browse files Browse the repository at this point in the history
…ayer must exist in QGIS project)
  • Loading branch information
uprel committed Jun 15, 2018
1 parent 3e3b014 commit 659cb69
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/site/js/QGISExtensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ Ext.extend(QGIS.PrintProvider, GeoExt.data.PrintProvider, {
}

var layers = thematicLayer.params.LAYERS;
var extra = getVisibleExtraLayersForPrint().join(',');

//add currently visible base layer for printing if exists in projects
var printBaseLayer = wmsLoader.layerTitleNameMapping[currentlyVisibleBaseLayer];
Expand All @@ -424,6 +425,9 @@ Ext.extend(QGIS.PrintProvider, GeoExt.data.PrintProvider, {
layers = printBaseLayer + ',' + layers;
}

if(extra>'') {
layers += ',' + extra;
}
var printUrl = this.url + '&' + Ext.urlEncode({
'SRS': authid,
'DPI': printResolution,
Expand Down
26 changes: 26 additions & 0 deletions client/site/js/WebgisInit_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ function loadWMSConfig(topicName) {
}, attr);
}

//hide layer if we have same extralayer name
var extraArr = projectData.extraLayers();
if (extraArr !== null) {
Ext.each(extraArr, function (currentValue, index, array) {
var attr = this;
if (currentValue.title == attr.text) {
attr.hidden = true;
attr.layer.metadata.visible = false;
return false; //exit from looping array
}
}, attr);
}

if (!attr.layer.metadata.showCheckbox) {
// hide checkbox
attr.cls = 'layer-checkbox-hidden';
Expand Down Expand Up @@ -2614,3 +2627,16 @@ function exceptionLoading(res) {
function logout() {
window.location.href = "./admin/login.php?action=logout";
}

function getVisibleExtraLayersForPrint() {
var ret = [];
var extraLayers = projectData.extraLayers();
for (var i=0; i<extraLayers.length; i++) {
var extra = extraLayers[i].title;
var lay = geoExtMap.map.getLayersByName(extra)[0];
if (lay && lay.visibility && wmsLoader.layerTitleNameMapping[extra]) {
ret.push(wmsLoader.layerTitleNameMapping[extra]);
}
}
return ret;
}
11 changes: 11 additions & 0 deletions client_mobile/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ Config.baseLayerExists = function (name) {
return false;
};

Config.extraLayerExists = function (name) {
var bl = projectData.extraLayers();
for (var i in bl) {
if (bl[i].title == name) {
return true;
}
}
return false;
};


// flag to activate debug code
Config.debug = false;

Expand Down
4 changes: 4 additions & 0 deletions client_mobile/src/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ Gui.loadLayers = function (data) {
if (Config.baseLayerExists(layer.layername)) {
return;
}
if (Config.extraLayerExists(layer.layername)) {
return;
}


// add layer
html += '<label>';
Expand Down

0 comments on commit 659cb69

Please sign in to comment.