changeset 5469:948a106bc4cd

Handle kind filtering in QPS WMS artifact
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 27 Mar 2013 15:37:37 +0100
parents 84da5ed67e93
children 5b75dfc1b637
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java
diffstat 1 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java	Wed Mar 27 15:36:44 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java	Wed Mar 27 15:37:37 2013 +0100
@@ -100,9 +100,20 @@
         @Override
         protected Envelope getExtent(boolean reproject) {
             River river = RiverFactory.getRiver(getRiverId());
+            List<CrossSectionTrack> qps;
 
-            List<CrossSectionTrack> qps =
-                CrossSectionTrack.getCrossSectionTrack(river.getName());
+            String kind = getIdPart(2);
+
+            if (kind != null && kind.equals("1")) {
+                qps = CrossSectionTrack.getCrossSectionTrack(river.getName(),
+                        Integer.parseInt(kind));
+            } else if (kind != null) {
+                qps = CrossSectionTrack.getCrossSectionTrack(river.getName(),
+                        getName(), Integer.parseInt(kind));
+            } else {
+                qps = CrossSectionTrack.getCrossSectionTrack(river.getName(),
+                        getName());
+            }
 
             Envelope max = null;
 
@@ -124,7 +135,18 @@
 
         @Override
         protected String getFilter() {
-            return "river_id=" + String.valueOf(getRiverId());
+            String kind = getIdPart(2);
+            if (kind != null && kind.equals("1")) {
+                // There can be several layers named qps that differ in kind
+                return "river_id=" + String.valueOf(getRiverId()) +
+                    " AND kind_id=" + kind;
+            } else if (kind != null) {
+                return "river_id=" + String.valueOf(getRiverId()) +
+                    " AND kind_id=" + kind +
+                    " AND name='" + getName() + "'";
+            }
+            return "river_id=" + String.valueOf(getRiverId()) +
+                " AND name='" + getName() + "'";
         }
 
         @Override

http://dive4elements.wald.intevation.org