Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DistanceInfoService.java @ 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 | 02c0cce0e469 |
children | 8a9456d5a081 |
comparison
equal
deleted
inserted
replaced
679:9a035ef7b595 | 680:bcd62609c936 |
---|---|
19 import de.intevation.flys.backend.SessionHolder; | 19 import de.intevation.flys.backend.SessionHolder; |
20 import de.intevation.flys.model.Annotation; | 20 import de.intevation.flys.model.Annotation; |
21 import de.intevation.flys.model.Attribute; | 21 import de.intevation.flys.model.Attribute; |
22 import de.intevation.flys.model.Position; | 22 import de.intevation.flys.model.Position; |
23 import de.intevation.flys.model.Range; | 23 import de.intevation.flys.model.Range; |
24 import de.intevation.flys.model.Edge; | |
24 | 25 |
25 import de.intevation.flys.artifacts.model.AnnotationsFactory; | 26 import de.intevation.flys.artifacts.model.AnnotationsFactory; |
26 | 27 |
27 import org.hibernate.Session; | 28 import org.hibernate.Session; |
28 | 29 |
138 */ | 139 */ |
139 protected static Element buildDistanceNode(ElementCreator ec, Annotation anno) { | 140 protected static Element buildDistanceNode(ElementCreator ec, Annotation anno) { |
140 Position pos = anno.getPosition(); | 141 Position pos = anno.getPosition(); |
141 Range range = anno.getRange(); | 142 Range range = anno.getRange(); |
142 Attribute attr = anno.getAttribute(); | 143 Attribute attr = anno.getAttribute(); |
144 Edge edge = anno.getEdge(); | |
143 | 145 |
144 BigDecimal a = range.getA(); | 146 BigDecimal a = range.getA(); |
145 BigDecimal b = range.getB(); | 147 BigDecimal b = range.getB(); |
146 | 148 |
147 Element distance = ec.create("distance"); | 149 Element distance = ec.create("distance"); |
148 ec.addAttr(distance, "description", pos.getValue(), true); | 150 ec.addAttr(distance, "description", pos.getValue(), true); |
149 ec.addAttr(distance, "from", a != null ? a.toString() : "", true); | |
150 ec.addAttr(distance, "to", b != null ? b.toString() : "", true); | |
151 ec.addAttr(distance, "riverside", attr.getValue(), true); | 151 ec.addAttr(distance, "riverside", attr.getValue(), true); |
152 | |
153 if (a != null) { | |
154 ec.addAttr(distance, "from", a.toString(), true); | |
155 } | |
156 if (b != null) { | |
157 ec.addAttr(distance, "to", b.toString(), true); | |
158 } | |
159 if (edge != null) { | |
160 BigDecimal bottom = edge.getBottom(); | |
161 BigDecimal top = edge.getTop(); | |
162 if (bottom != null) { | |
163 ec.addAttr(distance, "bottom", bottom.toString(), true); | |
164 } | |
165 if (top != null) { | |
166 ec.addAttr(distance, "top", top.toString(), true); | |
167 } | |
168 } | |
152 | 169 |
153 return distance; | 170 return distance; |
154 } | 171 } |
155 } | 172 } |
156 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 173 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |