changeset 680:bcd62609c936

Write top 'Oberkante' and bottom 'Unterkante' to out going XML if they exist. flys-artifacts/trunk@2109 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 14 Jun 2011 13:53:25 +0000
parents 9a035ef7b595
children dda282dcc44f
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DistanceInfoService.java
diffstat 2 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Jun 14 10:38:00 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue Jun 14 13:53:25 2011 +0000
@@ -1,3 +1,9 @@
+2011-06-14  Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/DistanceInfoService.java:
+	  Write top 'Oberkante' and bottom 'Unterkante' to out going XML
+	  if they exist.
+
 2011-06-14  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/states/LocationSelect.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DistanceInfoService.java	Tue Jun 14 10:38:00 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DistanceInfoService.java	Tue Jun 14 13:53:25 2011 +0000
@@ -21,6 +21,7 @@
 import de.intevation.flys.model.Attribute;
 import de.intevation.flys.model.Position;
 import de.intevation.flys.model.Range;
+import de.intevation.flys.model.Edge;
 
 import de.intevation.flys.artifacts.model.AnnotationsFactory;
 
@@ -140,16 +141,32 @@
         Position  pos   = anno.getPosition();
         Range     range = anno.getRange();
         Attribute attr  = anno.getAttribute();
+        Edge      edge  = anno.getEdge();
 
         BigDecimal a = range.getA();
         BigDecimal b = range.getB();
 
         Element distance = ec.create("distance");
         ec.addAttr(distance, "description", pos.getValue(), true);
-        ec.addAttr(distance, "from", a != null ? a.toString() : "", true);
-        ec.addAttr(distance, "to", b != null ? b.toString() : "", true);
         ec.addAttr(distance, "riverside", attr.getValue(), true);
 
+        if (a != null) {
+            ec.addAttr(distance, "from", a.toString(), true);
+        }
+        if (b != null) {
+            ec.addAttr(distance, "to", b.toString(), true);
+        }
+        if (edge != null) {
+            BigDecimal bottom = edge.getBottom();
+            BigDecimal top    = edge.getTop();
+            if (bottom != null) {
+                ec.addAttr(distance, "bottom", bottom.toString(), true);
+            }
+            if (top != null) {
+                ec.addAttr(distance, "top", top.toString(), true);
+            }
+        }
+
         return distance;
     }
 }

http://dive4elements.wald.intevation.org