Commit 90c90763 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Replantea manejo de leyendas de capas

Parsea el contenido de la definición de capas de atlas (es decir, de
servicios OGC como WMS y demás) desde una plantilla, para reutilizar su
resultado tanto en vistas de detalle como cuando se le pide a la
instancia de la capa su leyenda. Se devuelve el elemento completo, no
sólo la URL para que esto sea posible.

Queda pendiente mejorar la manera de mostrar la leyenda desde Atlas.
parent 1712167d
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ define([
	, "templates/ServiceOGCTitle"
	, "templates/ServiceOGCInfo"
	, "templates/ServiceOGCSourceInfo"
//	, "templates/ServiceOGCImage"
	, "templates/ServiceOGCImage"
	, "./_DetailsBase"
], function(
	_Main
@@ -26,7 +26,7 @@ define([
	, TemplateTitle
	, TemplateInfo
	, TemplateSourceInfo
//	, TemplateImage
	, TemplateImage
	, _DetailsBase
) {

@@ -101,10 +101,10 @@ define([
						scaleBar: false,
						measureTools: false
					}
				}/*,
				},
				legend: {
					width: 3,
					height: 6,
					height: 4,
					type: TemplateDisplayer,
					props: {
						title: this.i18n.legend,
@@ -113,7 +113,7 @@ define([
						target: this.atlasTarget,
						associatedIds: [this.ownChannel]
					}
				}*/
				}
			}]);
		},

+2 −3
Original line number Diff line number Diff line
@@ -119,8 +119,7 @@ define([
								icon: "fa-list-alt",
								btnId: "legend",
								title: "legend",
								returnItem: true,
								condition: "styleLayer"
								returnItem: true
							},{
								icon: "fa-map-marker",
								title: 'mapCentering',
@@ -499,7 +498,7 @@ define([
			put(legendContent, "div.layerLegendTitle", layerLabel);

			var legendContentImg = put(legendContent, "div.imageContainer");
			legendContentImg.innerHTML = "<img src='" + layerLegend + "' />";
			legendContentImg.innerHTML = layerLegend;
		},

		_subThemesBrowserDragAndDrop: function(response) {
+4 −14
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ define([
	, 'dojo/_base/lang'
	, 'leaflet/leaflet'
	, 'redmic/modules/map/StaticLayersDefinition'
	, 'templates/ServiceOGCImage'
	, './_LayerProtocols'
	, './MapLayer'
], function(
@@ -10,6 +11,7 @@ define([
	, lang
	, L
	, StaticLayersDefinition
	, ServiceOGCImage
	, _LayerProtocols
	, MapLayer
) {
@@ -99,20 +101,8 @@ define([

		_getLayerLegend: function(layer) {

			// TODO cuando se defina leyenda en el servicio de atlas, consultar la imagen correspondiente
			if (0 && this.styleLayer) {
				this._emitEvt('LAYER_LEGEND',
					this._getLayerLegendToPublish(this._obtainLegendUrl(this.styleLayer.url)));
			}
		},

		_obtainLegendUrl: function(url) {

			var params = {
				legend_options: 'fontAntiAliasing:true;dpi:100'
			};

			return this._chkUrlAndAddParams(url, L.Util.getParamString(params));
			var template = ServiceOGCImage(layer);
			this._emitEvt('LAYER_LEGEND', this._getLayerLegendToPublish(template));
		},

		_chkUrlAndAddParams: function(url, paramsStr) {
Compare e1cc4f03 to c9eb53d3
Original line number Diff line number Diff line
Subproject commit e1cc4f03ff3913cab3da5294ba5be70567313cab
Subproject commit c9eb53d33da5050f93ea0e6c80b295994fd27adf