changeset 1836:729ba79e94a0

Added datacage configuration, loader (Artifact and State) and a theme for cross section tracks. flys-artifacts/trunk@3172 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 04 Nov 2011 14:09:05 +0000
parents 35e38e2afb22
children 0585bf8af41b
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/winfo.xml flys-artifacts/doc/conf/conf.xml flys-artifacts/doc/conf/meta-data.xml flys-artifacts/doc/conf/themes.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties
diffstat 11 files changed, 224 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Nov 04 13:29:15 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Nov 04 14:09:05 2011 +0000
@@ -1,3 +1,29 @@
+2011-11-04  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/meta-data.xml: Added the CrossSectionTracks to the "floodmap"
+	  datacage configuration.
+
+	* src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java: Added a
+	  FacetType "floodmap.qps".
+
+	* doc/conf/conf.xml: Defined an ArtifactFactory for the "wmspqsartifact"
+	  string. The factory will create new instances of WMSQPSArtifact.
+
+	* src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java: New. This
+	  Artifact is used to create "floodmap.qps" facets. It has an internal fixed
+	  State WMSQPSState.
+
+	* doc/conf/artifacts/winfo.xml: Added the "floodmap.qps" layer to the
+	  "floodmap" output.
+
+	* doc/conf/themes.xml: Added a theme for "floodmap.qps" facets.
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties: Added strings for the QPS WMS
+	  layer used in floodmaps.
+
 2011-11-04  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	Re-enable mainvalue-recommendations for computed discharge curves,
--- a/flys-artifacts/doc/conf/artifacts/winfo.xml	Fri Nov 04 13:29:15 2011 +0000
+++ b/flys-artifacts/doc/conf/artifacts/winfo.xml	Fri Nov 04 14:09:05 2011 +0000
@@ -366,6 +366,7 @@
                         <facet name="floodmap.riveraxis"/>
                         <facet name="floodmap.wmsbackground"/>
                         <facet name="floodmap.kms"/>
+                        <facet name="floodmap.qps"/>
                     </facets>
                 </outputmode>
                 <outputmode name="wsplgen_report" description="output.wsplgen_report" mime-type="text/xml" type="report">
--- a/flys-artifacts/doc/conf/conf.xml	Fri Nov 04 13:29:15 2011 +0000
+++ b/flys-artifacts/doc/conf/conf.xml	Fri Nov 04 14:09:05 2011 +0000
@@ -20,6 +20,9 @@
             <artifact-factory name="wmskmfactory" description="Factory to create an artifact that generates WMS facets for KMs."
                 ttl="3600000"
                 artifact="de.intevation.flys.artifacts.WMSKmArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+            <artifact-factory name="wmsqpsfactory" description="Factory to create an artifact that generates WMS facets for CrossSectionTracks."
+                ttl="3600000"
+                artifact="de.intevation.flys.artifacts.WMSQPSArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
             <artifact-factory name="wmsbackground" description="Factory to create an artifact to be used in WINFO"
                 ttl="3600000"
                 artifact="de.intevation.flys.artifacts.WMSBackgroundArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
--- a/flys-artifacts/doc/conf/meta-data.xml	Fri Nov 04 13:29:15 2011 +0000
+++ b/flys-artifacts/doc/conf/meta-data.xml	Fri Nov 04 14:09:05 2011 +0000
@@ -526,6 +526,22 @@
                   </dc:elements>
                 </dc:context>
               </dc:macro>
+              <dc:macro name="flood-map-qps">
+                <dc:context>
+                  <dc:statement>
+                    SELECT count(*) as km_exists
+                    FROM cross_section_tracks WHERE river_id = ${river_id}
+                  </dc:statement>
+                   <dc:elements>
+                    <dc:if test="$km_exists>0">
+                      <qps>
+                        <dc:attribute name="factory" value="wmsqpsfactory"/>
+                        <dc:attribute name="ids" value="${river_id}"/>
+                      </qps>
+                    </dc:if>
+                  </dc:elements>
+                </dc:context>
+              </dc:macro>
               <dc:macro name="flood-map-complete">
                   <kilometrage>
                       <riveraxis>
@@ -533,6 +549,7 @@
                           <dc:attribute name="ids" value="${river_id}"/>
                       </riveraxis>
                     <dc:call-macro name="flood-map-km"/>
+                    <dc:call-macro name="flood-map-qps"/>
                   </kilometrage>
                   <rastermap>
                       <background>
--- a/flys-artifacts/doc/conf/themes.xml	Fri Nov 04 13:29:15 2011 +0000
+++ b/flys-artifacts/doc/conf/themes.xml	Fri Nov 04 14:09:05 2011 +0000
@@ -731,6 +731,13 @@
         </fields>
     </theme>
 
+    <theme name="Qps">
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe" default="0, 0, 255"/>
+            <field name="linesize"  type="int"   display="Liniendicke" default="5" hints="h"/>
+        </fields>
+    </theme>
+
 
     <!--
       Mappings are following now. A mapping maps between a name of a facet
@@ -813,6 +820,7 @@
         <mapping from="w_differences" to="Differences"/>
         <mapping from="floodmap.riveraxis" to="RiverAxis"/>
         <mapping from="floodmap.kms" to="Kms"/>
+        <mapping from="floodmap.qps" to="Qps"/>
         <mapping from="other.wkms" to="WKms"/>
         <mapping from="other.wqkms" to="WQKms"/>
         <mapping from="heightmarks_points" to="heightmarks_points"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java	Fri Nov 04 14:09:05 2011 +0000
@@ -0,0 +1,164 @@
+package de.intevation.flys.artifacts;
+
+import java.util.List;
+
+import org.w3c.dom.Document;
+
+import org.apache.log4j.Logger;
+
+import com.vividsolutions.jts.geom.Envelope;
+
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallMeta;
+
+import de.intevation.artifactdatabase.state.DefaultOutput;
+import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifactdatabase.state.State;
+
+import de.intevation.flys.model.River;
+import de.intevation.flys.model.CrossSectionTrack;
+
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.RiverFactory;
+import de.intevation.flys.artifacts.resources.Resources;
+import de.intevation.flys.utils.FLYSUtils;
+
+
+public class WMSQPSArtifact extends WMSDBArtifact {
+
+    public static final String NAME = "qps";
+
+
+    private static final Logger logger =
+        Logger.getLogger(WMSQPSArtifact.class);
+
+
+    @Override
+    public void setup(
+        String          identifier,
+        ArtifactFactory factory,
+        Object          context,
+        CallMeta        callMeta,
+        Document        data)
+    {
+        logger.debug("WMSQPSArtifact.setup");
+
+        super.setup(identifier, factory, context, callMeta, data);
+    }
+
+
+    @Override
+    public String getName() {
+        return NAME;
+    }
+
+
+    @Override
+    public State getCurrentState(Object cc) {
+        State s = new WMSQPSState(this);
+
+        List<Facet> fs = facets.get(getCurrentStateId());
+
+        DefaultOutput o = new DefaultOutput(
+            "floodmap",
+            "floodmap",
+            "image/png",
+            fs,
+            "map");
+
+        s.getOutputs().add(o);
+
+        return s;
+    }
+
+
+    public static class WMSQPSState extends WMSDBState implements FacetTypes {
+
+        private static final Logger logger =
+            Logger.getLogger(WMSQPSState.class);
+
+        protected int riverId;
+
+        public WMSQPSState(WMSDBArtifact artifact) {
+            super(artifact);
+            riverId = 0;
+        }
+
+        public int getRiverId() {
+            if (riverId == 0) {
+                String ids = artifact.getDataAsString("ids");
+
+                try {
+                    riverId = Integer.valueOf(ids);
+                }
+                catch (NumberFormatException nfe) {
+                    logger.error("Cannot parse river id from '" + ids + "'");
+                }
+            }
+
+            return riverId;
+        }
+
+        @Override
+        protected String getFacetType() {
+            return FLOODMAP_QPS;
+        }
+
+        @Override
+        protected String getTitle(CallMeta meta) {
+            return Resources.getMsg(meta, FLOODMAP_QPS, FLOODMAP_QPS);
+        }
+
+        @Override
+        protected String getUrl() {
+            return FLYSUtils.getUserWMSUrl(artifact.identifier());
+        }
+
+        @Override
+        protected String getSrid() {
+            River river = RiverFactory.getRiver(getRiverId());
+            return FLYSUtils.getRiverSrid(river.getName());
+        }
+
+        @Override
+        protected Envelope getExtent() {
+            River river = RiverFactory.getRiver(getRiverId());
+
+            List<CrossSectionTrack> qps =
+                CrossSectionTrack.getCrossSectionTrack(river.getName());
+
+            Envelope max = null;
+
+            for (CrossSectionTrack qp: qps) {
+                Envelope env = qp.getGeom().getEnvelopeInternal();
+
+                if (max == null) {
+                    max = env;
+                    continue;
+                }
+
+                max.expandToInclude(env);
+            }
+
+            return max;
+        }
+
+        @Override
+        protected String getFilter() {
+            return "river_id=" + String.valueOf(getRiverId());
+        }
+
+        @Override
+        protected String getDataString() {
+            // TODO SRID
+            return "geom FROM cross_section_tracks " +
+                   "USING UNIQUE id USING SRID 31466";
+        }
+
+        @Override
+        protected String getGeometryType() {
+            return "LINE";
+        }
+    } // end of WMSQPSState
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Fri Nov 04 13:29:15 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Fri Nov 04 14:09:05 2011 +0000
@@ -7,6 +7,7 @@
     String FLOODMAP_RIVERAXIS     = "floodmap.riveraxis";
     String FLOODMAP_WMSBACKGROUND = "floodmap.wmsbackground";
     String FLOODMAP_KMS           = "floodmap.kms";
+    String FLOODMAP_QPS           = "floodmap.qps";
 
     String DISCHARGE_LONGITUDINAL_W = "discharge_longitudinal_section.w";
     String DISCHARGE_LONGITUDINAL_Q = "discharge_longitudinal_section.q";
--- a/flys-artifacts/src/main/resources/messages.properties	Fri Nov 04 13:29:15 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages.properties	Fri Nov 04 14:09:05 2011 +0000
@@ -87,6 +87,7 @@
 floodmap.uesk = Floodmap
 floodmap.barriers = Digitized Objects
 floodmap.kms = Kilometrage
+floodmap.qps = Crosssection Tracks
 
 wsplgen.job.queued = WSPLGEN job in queue.
 wsplgen.job.error = An unexpected error while starting WSPLGEN occured.
--- a/flys-artifacts/src/main/resources/messages_de.properties	Fri Nov 04 13:29:15 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Fri Nov 04 14:09:05 2011 +0000
@@ -87,6 +87,7 @@
 floodmap.uesk = \u00dcberschwemmungsfl\u00e4che
 floodmap.barriers = Digitalisierte Objekte
 floodmap.kms = Kilometrierung
+floodmap.qps = Querprofilspuren
 
 wsplgen.job.queued = WSPLGEN Berechnung befindet sich in Warteschlange.
 wsplgen.job.error = Ein unerwarteter Fehler beim Starten von WSPLGEN ist aufgetreten.
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties	Fri Nov 04 13:29:15 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties	Fri Nov 04 14:09:05 2011 +0000
@@ -87,6 +87,7 @@
 floodmap.uesk = \u00dcberschwemmungsfl\u00e4che
 floodmap.barriers = Digitalisierte Objekte
 floodmap.kms = Kilometrierung
+floodmap.qps = Querprofilspuren
 
 wsplgen.job.queued = WSPLGEN Berechnung befindet sich in Warteschlange.
 wsplgen.job.error = Ein unerwarteter Fehler beim Starten von WSPLGEN ist aufgetreten.
--- a/flys-artifacts/src/main/resources/messages_en.properties	Fri Nov 04 13:29:15 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Fri Nov 04 14:09:05 2011 +0000
@@ -85,6 +85,7 @@
 floodmap.uesk = Floodmap
 floodmap.barriers = Digitized Objects
 floodmap.kms = Kilometrage
+floodmap.qps = Crosssection Tracks
 
 wsplgen.job.queued = WSPLGEN job in queue.
 wsplgen.job.error = An unexpected error while starting WSPLGEN occured.

http://dive4elements.wald.intevation.org