diff gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/LegendWindow.java @ 9700:b2768f367dff

handler for wms theme legend
author dnt_bjoernsen <d.tironi@bjoernsen.de>
date Wed, 20 Jan 2021 19:06:57 +0100
parents 94362af5928e
children 0caaca0df028
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/LegendWindow.java	Wed Jan 20 18:30:26 2021 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/LegendWindow.java	Wed Jan 20 19:06:57 2021 +0100
@@ -75,9 +75,9 @@
 
 	private Canvas createLegendGraphicsRow(final AttributedTheme at) {
 		final Label label = new Label(at.getDescription());
-		final Widget img = createLegendGraphics(at);
+		final HLayout row = new HLayout();
+		final Widget img = createLegendGraphics(row ,at);
 
-		final HLayout row = new HLayout();
 		row.addMember(label);
 		row.addMember(img);
 
@@ -105,7 +105,7 @@
 		row.setWidth(width);
 	}
 
-	private Widget createLegendGraphics(final AttributedTheme at) {
+	private Widget createLegendGraphics(HLayout row, final AttributedTheme at) {
 
 		final String legend = at.getAttr("legend");
 		// TEST: final Image img = new Image("/images/FLYS_Donau.png"); (funktioniert!),
@@ -115,17 +115,7 @@
 			final String imgUrl = URL.encode(GWT.getHostPageBaseURL() + "images/wms_legend/" + legend);
 
 			final Image image = new Image(imgUrl);
-			final int imageWidth = image.getWidth();
-			final int imageHeight = image.getHeight();
-			final double widthPercent = imageWidth / 400.;
-
-			// removing the limit of 150px height (legend can have an infinite height now,
-			// as long as the width is less/eq 400px; if the width is >400,
-			// the legend will be scaled to 400px width; the ratio will be kept)
-
-			// final double heightPercent = imageHeight / 150.;
-			if (widthPercent > 1)// || heightPercent > 1) {
-				image.setSize((int) (imageWidth / widthPercent) + "px", (int) (imageHeight / widthPercent) + "px");
+			new MyWMSLoadHandler(row, image);
 
 			return image;
 		}

http://dive4elements.wald.intevation.org