Skip to content
Permalink
Browse files

Fixing layers without geometry in legend (no checkbox, no style, no l…

…egend)
  • Loading branch information...
uprel committed Oct 26, 2019
1 parent 60fbea3 commit b4192c00bb5ba49b22aae775a7da8dff1c62713b
@@ -1,3 +1,9 @@
.layer-checkbox-hidden {
padding-left: 13px;
padding-top: 2px;
padding-bottom: 2px;
}

.x-tree-checkbox {
background:url('../libs/ext/resources/images/default/form/checkbox.gif') no-repeat 0 0;
height:13px;
@@ -68,26 +68,28 @@ function buildLayerContextMenu(node) {

//style
var styleItems = [];
for (var s = 0; s < layer.styles.length; s++) {
var style = layer.styles[s];
//don't rename default style
var checked = style.name == 'default'; //layer.currentStyle == style.name;
styleItems.push({
xtype: 'radio',
name: layer.name+'_style',
itemId: style.name,
boxLabel: style.title,
checked: checked,
handler: styleHandler
if(hasGeom) {
for (var s = 0; s < layer.styles.length; s++) {
var style = layer.styles[s];
//don't rename default style
var checked = style.name == 'default'; //layer.currentStyle == style.name;
styleItems.push({
xtype: 'radio',
name: layer.name + '_style',
itemId: style.name,
boxLabel: style.title,
checked: checked,
handler: styleHandler
});
}

menuItems.push({
itemId: 'contextStyle',
text: TR.style,
menu: styleItems
});
}

menuItems.push({
itemId: 'contextStyle',
text: TR.style,
menu: styleItems
});


//Export
if (projDataLayer != undefined && projDataLayer.provider !== 'gdal' && projDataLayer.provider !== 'wms') {
if(hasGeom && Eqwc.settings.vectorExportFormats && Eqwc.settings.vectorExportFormats.length>0) {
@@ -141,9 +141,11 @@ function showLegendAndMetadata(layertitle) {
});
legendMetaTabPanel = Ext.getCmp('legendMetaTabPanel');
//create legend image
legendMetaTabPanel.activate(legendTab);
var legendImage = '<img src="' + legendUrl + '" />';
legendTab.update(legendImage);
if (wmsLoader.layerProperties[layername].showLegend) {
legendMetaTabPanel.activate(legendTab);
var legendImage = '<img src="' + legendUrl + '" />';
legendTab.update(legendImage);
}

if (projDataLayer) {

@@ -207,10 +209,12 @@ function showLegendAndMetadata(layertitle) {
//}
//metadataText += '</ul>';
//geographic extent
metadataText += '<p style="margin-top:1em;margin-bottom:0.4em;font-weight:bold;">'+geographicExtentString[lang]+"</p><ul>";
metadataText += '<table style="margin-top:0.5em;border:none;border-collapse:collapse;"><tr class="even"><th class="mdHeader">'+westString[lang]+'</th><th class="mdHeader">'+southString[lang]+'</th><th class="mdHeader">'+eastString[lang]+'</th><th class="mdHeader">'+northString[lang]+'</th></tr>';
metadataText += '<tr><td class="mdCell">'+wmsLoader.layerProperties[layername].bbox[0]+'</td><td class="mdCell">'+wmsLoader.layerProperties[layername].bbox[1]+'</td><td class="mdCell">'+wmsLoader.layerProperties[layername].bbox[2]+'</td><td class="mdCell">'+wmsLoader.layerProperties[layername].bbox[3]+'</td></tr>';
metadataText += '</table>'
if(projDataLayer && projDataLayer.geom_type != 'No geometry') {
metadataText += '<p style="margin-top:1em;margin-bottom:0.4em;font-weight:bold;">' + geographicExtentString[lang] + "</p><ul>";
metadataText += '<table style="margin-top:0.5em;border:none;border-collapse:collapse;"><tr class="even"><th class="mdHeader">' + westString[lang] + '</th><th class="mdHeader">' + southString[lang] + '</th><th class="mdHeader">' + eastString[lang] + '</th><th class="mdHeader">' + northString[lang] + '</th></tr>';
metadataText += '<tr><td class="mdCell">' + wmsLoader.layerProperties[layername].bbox[0] + '</td><td class="mdCell">' + wmsLoader.layerProperties[layername].bbox[1] + '</td><td class="mdCell">' + wmsLoader.layerProperties[layername].bbox[2] + '</td><td class="mdCell">' + wmsLoader.layerProperties[layername].bbox[3] + '</td></tr>';
metadataText += '</table>';
}

//attributes/fields
if (wmsLoader.layerProperties[layername].attributes) {
@@ -137,6 +137,11 @@ projectData.setBaseLayers = function (isBase) {
};

projectData.setLayerLegend = function (layer,node) {

if(layer.geom_type == 'No geometry') {
return;
}

var legend = '';
var layername = wmsLoader.layerTitleNameMapping[layer.layername];
var style = typeof(wmsLoader.layerProperties[layer.id].currentStyle) == 'undefined' ? 'default' : wmsLoader.layerProperties[layer.id].currentStyle;
@@ -189,6 +189,16 @@ Ext.extend(QGIS.WMSCapabilitiesLoader, GeoExt.tree.WMSCapabilitiesLoader, {
attribution: parent.attribution
};

//tables without geometry
var geom = node.getAttribute('geometryType');
if(geom && geom.indexOf('NoGeometry')>-1) {
layer.showLegend = false;
layer.queryable = false;
layer.visible = false;
layer.showCheckbox = false;
layer.styles = [];
}

layer.capability = capability;
this.readChildNodes(node, layer);
delete layer.capability;
@@ -263,6 +273,7 @@ Ext.extend(QGIS.WMSCapabilitiesLoader, GeoExt.tree.WMSCapabilitiesLoader, {
maxScale: (layer.maxScale != null) ? parseFloat(layer.maxScale) : null,
showLegend: layer.showLegend,
showMetadata: layer.showMetadata,
showCheckbox: layer.showCheckbox,
styles: layer.styles
};
this.layerTitleNameMapping[layer.title] = layer.name;
@@ -63,6 +63,7 @@ function loadWMSConfig(topicName) {
if (!attr.layer.metadata.showCheckbox) {
// hide checkbox
attr.cls = 'layer-checkbox-hidden';
attr.checked = undefined;
}

//dont' create node for hidden elements
@@ -243,7 +243,7 @@ function goMobile($lang, $scanner) {
<link rel="stylesheet" type="text/css" href="client/site/libs/ext/resources/css/ext-all-notheme.css"/>
<link rel="stylesheet" type="text/css" href="client/site/libs/ext/resources/css/xtheme-blue.css"/>
<link rel="stylesheet" type="text/css" href="client/site/libs/ext/ux/css/ux-all.css?v=20180219"/>
<link rel="stylesheet" type="text/css" href="client/site/css/TriStateTreeAndCheckbox.css"/>
<link rel="stylesheet" type="text/css" href="client/site/css/TriStateTreeAndCheckbox.css?v=20191026"/>
<link rel="stylesheet" type="text/css" href="client/site/css/ThemeSwitcherDataView.css"/>
<link rel="stylesheet" type="text/css" href="client/site/css/popup.css?v=20171108"/>
<link rel="stylesheet" type="text/css" href="client/site/css/layerOrderTab.css"/>

0 comments on commit b4192c0

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