diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AreaFacet.java @ 2018:3f1a63da2cf4

Prepare ability to paint areas in longitudinal section diagrams, too (next to CrossSection diagrams). flys-artifacts/trunk@3473 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 20 Dec 2011 06:37:41 +0000
parents 7f99845e9499
children 3c3693e9c538
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AreaFacet.java	Tue Dec 20 06:26:25 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AreaFacet.java	Tue Dec 20 06:37:41 2011 +0000
@@ -21,6 +21,13 @@
 
 /**
  * Trival Facet for areas.
+ * Note that this Facet comes in two "types" (names):
+ *  <ul>
+ *    <li>CROSS_SECTION_AREA (cross_section.area) and</li>
+ *    <li>LONGITUDINAL_SECTION_AREA (longitudinal.area</li>
+ *  </ul>
+ * This is to support different diagram types without being painted in both
+ * at the same time. The name has to be given when constructing.
  */
 public class AreaFacet
 extends      DefaultFacet
@@ -28,9 +35,13 @@
 
     private static Logger logger = Logger.getLogger(AreaFacet.class);
 
-    /** Trivial constructor, set (maybe localized) description. */
-    public AreaFacet(int idx, String description) {
-        super(idx, AREA, description);
+    /**
+     * Constructor, set (maybe localized) description and name.
+     * @param idx Index given when querying artifact for data.
+     * @param name important to discern areas in different diagram types.
+     */
+    public AreaFacet(int idx, String name, String description) {
+        super(idx, name, description);
     }
 
 
@@ -54,7 +65,8 @@
         List<DataProvider> providers = context.
             getDataProvider(artifact.getLowerDPKey());
         if (providers.size() < 1) {
-            logger.warn("No 'lower' given for area");
+            logger.warn("No 'lower' provider given for area [" + 
+                artifact.getLowerDPKey() + "]");
         }
         else {
             lowerData = providers.get(0).provideData(
@@ -63,7 +75,8 @@
 
         providers = context.getDataProvider(artifact.getUpperDPKey());
         if (providers.size() < 1) {
-            logger.warn("No 'upper' given for area");
+            logger.warn("No 'upper' provider given for area [" +
+                artifact.getUpperDPKey() + "]");
         }
         else {
             upperData = providers.get(0).provideData(
@@ -81,7 +94,7 @@
     /** Do a deep copy. */
     @Override 
     public Facet deepCopy() {
-        AreaFacet copy = new AreaFacet(this.index, this.description);
+        AreaFacet copy = new AreaFacet(this.index, this.name, this.description);
         copy.set(this);
         return copy;
     }

http://dive4elements.wald.intevation.org