changeset 2671:055315495f8d

Modified floodmap specific datacage configuration and improved WMS catchment layer. flys-artifacts/trunk@4359 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 08 May 2012 12:14:55 +0000
parents 402695ee7c24
children 5afccab9aac1
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/meta-data.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java
diffstat 3 files changed, 35 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue May 08 11:29:13 2012 +0000
+++ b/flys-artifacts/ChangeLog	Tue May 08 12:14:55 2012 +0000
@@ -1,3 +1,11 @@
+2012-05-08  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/meta-data.xml: Moved the catchments out to an own node.
+
+	* src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java:
+	  Parse the name of required catchments fetch name specific catchments
+	  only.
+
 2012-05-08  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/conf/artifacts/map.xml: Added the 'floodmap.floodmaps' facet to the
--- a/flys-artifacts/doc/conf/meta-data.xml	Tue May 08 11:29:13 2012 +0000
+++ b/flys-artifacts/doc/conf/meta-data.xml	Tue May 08 12:14:55 2012 +0000
@@ -624,14 +624,15 @@
               <dc:macro name="flood-map-catchments">
                 <dc:context>
                   <dc:statement>
-                    SELECT count(*) as km_exists
-                    FROM catchment WHERE river_id = ${river_id}
+                    SELECT count(*) as km_exists, name as name
+                    FROM catchment WHERE river_id = ${river_id} GROUP BY name
                   </dc:statement>
                    <dc:elements>
                     <dc:if test="$km_exists>0">
                       <catchments>
                         <dc:attribute name="factory" value="wmscatchmentfactory"/>
-                        <dc:attribute name="ids" value="${river_id}"/>
+                        <dc:attribute name="ids" value="${river_id};${name}"/>
+                        <dc:attribute name="name" value="${name}"/>
                       </catchments>
                     </dc:if>
                   </dc:elements>
@@ -796,13 +797,15 @@
                     <dc:call-macro name="flood-map-km"/>
                     <dc:call-macro name="flood-map-qps"/>
                     <dc:call-macro name="flood-map-hws"/>
-                    <dc:call-macro name="flood-map-catchments"/>
                     <dc:call-macro name="flood-map-floodplain"/>
                     <dc:call-macro name="flood-map-lines"/>
                     <dc:call-macro name="flood-map-buildings"/>
                     <dc:call-macro name="flood-map-fixpoints"/>
                   </kilometrage>
                   <dc:call-macro name="flood-map-uesk"/>
+                  <catchments>
+                    <dc:call-macro name="flood-map-catchments"/>
+                  </catchments>
                   <rastermap>
                       <background>
                           <dc:attribute name="factory" value="wmsbackground"/>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java	Tue May 08 11:29:13 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java	Tue May 08 12:14:55 2012 +0000
@@ -78,18 +78,21 @@
             Logger.getLogger(CatchmentState.class);
 
         protected int riverId;
+        protected String name;
 
         public CatchmentState(WMSDBArtifact artifact) {
             super(artifact);
             riverId = 0;
+            name    = null;
         }
 
         public int getRiverId() {
             if (riverId == 0) {
-                String ids = artifact.getDataAsString("ids");
+                String   ids   = artifact.getDataAsString("ids");
+                String[] parts = ids.split(";");
 
                 try {
-                    riverId = Integer.valueOf(ids);
+                    riverId = Integer.valueOf(parts[0]);
                 }
                 catch (NumberFormatException nfe) {
                     logger.error("Cannot parse river id from '" + ids + "'");
@@ -99,6 +102,17 @@
             return riverId;
         }
 
+        public String getName() {
+            if (name == null) {
+                String ids = artifact.getDataAsString("ids");
+
+                String parts[] = ids.split(";");
+                name = parts[1];
+            }
+
+            return name;
+        }
+
         @Override
         protected String getFacetType() {
             return FLOODMAP_CATCHMENT;
@@ -125,7 +139,8 @@
 
         @Override
         protected Envelope getExtent() {
-            List<Catchment> catchments = Catchment.getCatchments(getRiverId());
+            List<Catchment> catchments =
+                Catchment.getCatchments(getRiverId(), getName());
 
             Envelope max = null;
 
@@ -145,7 +160,8 @@
 
         @Override
         protected String getFilter() {
-            return "river_id=" + String.valueOf(getRiverId());
+            return "river_id=" + String.valueOf(getRiverId())
+                + " AND name='" + getName() + "'";
         }
 
         @Override

http://dive4elements.wald.intevation.org