diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeLongitudinalSection.java @ 5138:fc0cdcae8f07

New facet types and renaming for infoldings.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 28 Feb 2013 13:09:26 +0100
parents 8e72777c961c
children 14db045d6368
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeLongitudinalSection.java	Thu Feb 28 12:58:25 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeLongitudinalSection.java	Thu Feb 28 13:09:26 2013 +0100
@@ -1,7 +1,9 @@
 package de.intevation.flys.artifacts.states;
 
 import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifactdatabase.state.FacetActivity;
 
+import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.CallContext;
 
 import de.intevation.flys.artifacts.ChartArtifact;
@@ -32,6 +34,26 @@
     private static Logger log =
         Logger.getLogger(DischargeLongitudinalSection.class);
 
+    static {
+        // Active/deactivate facets.
+        FacetActivity.Registry.getInstance().register(
+            "winfo",
+            new FacetActivity() {
+                @Override
+                public Boolean isInitialActive(
+                    Artifact artifact,
+                    Facet    facet,
+                    String   output
+                ) {
+                    String name = facet.getName();
+                    if (name.equals(DISCHARGE_LONGITUDINAL_Q_INFOLD_CUT)) {
+                        return Boolean.FALSE;
+                    }
+                    return Boolean.TRUE;
+                }
+            });
+    }
+
     @Override
     public Object computeAdvance(
         FLYSArtifact artifact,
@@ -80,14 +102,24 @@
 
                 Facet s = new CrossSectionWaterLineFacet(i, nameW);
 
+                Facet q = new WaterlevelFacet(
+                    i, DISCHARGE_LONGITUDINAL_Q, nameQ);
                 facets.add(s);
                 facets.add(w);
+                facets.add(q);
             }
-
-            Facet q = new WaterlevelFacet(
-                i, DISCHARGE_LONGITUDINAL_Q, nameQ);
-
-            facets.add(q);
+            else {
+                Facet q;
+                if (nameQ.contains("geschnitten")) {
+                    q = new WaterlevelFacet(
+                        i, DISCHARGE_LONGITUDINAL_Q_INFOLD_CUT, nameQ);
+                }
+                else {
+                    q = new WaterlevelFacet(
+                        i, DISCHARGE_LONGITUDINAL_Q_INFOLD, nameQ);
+                }
+                facets.add(q);
+            }
 
             if (wqkms[i] instanceof WQCKms) {
                 // TODO DO i18n

http://dive4elements.wald.intevation.org