changeset 2091:5d158f8ad080

#298 Fixed broken auto-zoom-to-wsplgen in floodmaps. flys-artifacts/trunk@3616 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 06 Jan 2012 14:19:35 +0000
parents 17e7a0d063bd
children 0ccabd82ec76
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java flys-artifacts/src/main/java/de/intevation/flys/wsplgen/FacetCreator.java
diffstat 3 files changed, 27 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Jan 06 12:55:01 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Jan 06 14:19:35 2012 +0000
@@ -1,3 +1,14 @@
+2012-01-06  Ingo Weinzierl <ingo@intevation.de>
+
+	flys/issue298 (Karte: Automatischer Zoom auf Berechnungsergebnisse)
+
+	* src/main/java/de/intevation/flys/wsplgen/FacetCreator.java: Added a
+	  debug statement that prints out the WSPLGEN extent.
+
+	* src/main/java/de/intevation/flys/exports/MapGenerator.java: Create new
+	  Envelope instances for initial and max extent if they are not existing.
+	  Some debug statements have now been removed.
+
 2011-01-06	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Add cache for 'static' wqkms (e.g. BaseData) to default cache conf.
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java	Fri Jan 06 12:55:01 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java	Fri Jan 06 14:19:35 2012 +0000
@@ -103,10 +103,7 @@
             setSrid(wms.getSrid());
 
             if (FLOODMAP_WSPLGEN.equals(name)) {
-                if (initialExtent == null) {
-                    setInitialExtent(extent);
-                }
-
+                setInitialExtent(extent);
                 createWSPLGENLayer(flys, wms);
             }
             else if (FLOODMAP_BARRIERS.equals(name)) {
@@ -226,30 +223,19 @@
 
         if (this.maxExtent == null) {
             logger.debug("Set max extent to: " + maxExtent);
-            this.maxExtent = maxExtent;
+            this.maxExtent = new Envelope(maxExtent);
             return;
         }
 
-        logger.debug("Expand max extent by: " + maxExtent);
-        logger.debug("Max extent before expanding: " + this.maxExtent);
         this.maxExtent.expandToInclude(maxExtent);
-        logger.debug("Max extent after expanding: " + this.maxExtent);
     }
 
 
     protected void setInitialExtent(Envelope initialExtent) {
-        if (initialExtent == null) {
-            return;
-        }
-
-        if (this.initialExtent == null) {
+        if (this.initialExtent == null && initialExtent != null) {
             logger.debug("Set initial extent to: " + initialExtent);
-            this.initialExtent = initialExtent;
-            return;
+            this.initialExtent = new Envelope(initialExtent);
         }
-
-        logger.debug("Set initial extent to: " + initialExtent);
-        this.initialExtent = initialExtent;
     }
 
 
@@ -264,16 +250,12 @@
 
     protected void appendMapInformation(Element parent, ElementCreator c) {
         String mE = GeometryUtils.jtsBoundsToOLBounds(this.maxExtent);
-        logger.debug("BUILD MAX EXTENT OF:" + this.maxExtent);
-        logger.debug("BUILD MAX EXTENT:" + mE);
 
         Element maxExtent = c.create("maxExtent");
         maxExtent.setTextContent(mE);
 
         if(this.initialExtent != null) {
             String iE = GeometryUtils.jtsBoundsToOLBounds(this.initialExtent);
-            logger.debug("BUILD INITIAL EXTENT OF: " + this.initialExtent);
-            logger.debug("BUILD INITIAL EXTENT: " + iE);
             Element initExtent = c.create("initialExtent");
             initExtent.setTextContent(iE);
             parent.appendChild(initExtent);
--- a/flys-artifacts/src/main/java/de/intevation/flys/wsplgen/FacetCreator.java	Fri Jan 06 12:55:01 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/wsplgen/FacetCreator.java	Fri Jan 06 14:19:35 2012 +0000
@@ -3,6 +3,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.log4j.Logger;
+
 import com.vividsolutions.jts.geom.Envelope;
 
 import de.intevation.artifacts.CallContext;
@@ -39,6 +41,10 @@
     protected String hash;
     protected String stateId;
 
+
+    private static Logger logger = Logger.getLogger(FacetCreator.class);
+
+
     public FacetCreator(
         FLYSArtifact artifact,
         CallContext  cc,
@@ -70,6 +76,10 @@
         String river = getRiver();
         double kms[] = FLYSUtils.getKmRange(artifact);
 
+        logger.debug("### getWSPLGENBounds");
+        logger.debug("###    from km: " + kms[0]);
+        logger.debug("###    to   km: " + kms[1]);
+
         CrossSectionTrack a =
             CrossSectionTrack.getCrossSectionTrack(river, kms[0]);
 
@@ -85,6 +95,8 @@
 
         envA.expandToInclude(envB);
 
+        logger.debug("###    => " + envA);
+
         return envA;
     }
 

http://dive4elements.wald.intevation.org