comparison artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java @ 6537:f2722602936c

issue1157: Store parents initial km at CrossSectionArtifact.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 04 Jul 2013 11:48:33 +0200
parents a0078e5e3b39
children 4c463ca9b36e
comparison
equal deleted inserted replaced
6536:c155f8f57b7e 6537:f2722602936c
50 /** Name of state. */ 50 /** Name of state. */
51 public static final String STATIC_STATE_NAME = "state.cross_section"; 51 public static final String STATIC_STATE_NAME = "state.cross_section";
52 52
53 /** Name of data item keeping the position. */ 53 /** Name of data item keeping the position. */
54 public static final String DATA_KM = "cross_section.km"; 54 public static final String DATA_KM = "cross_section.km";
55
56 /** Name of data item keeping the 'parents' km. */
57 public static final String PARENT_KM = "cross_section.parent.km";
55 58
56 /** Name of data item keeping the database id of this c.s.. */ 59 /** Name of data item keeping the database id of this c.s.. */
57 public static final String DATA_DBID = "cross_section.dbid"; 60 public static final String DATA_DBID = "cross_section.dbid";
58 61
59 /** Name of data item flagging whether we think that we are master. */ 62 /** Name of data item flagging whether we think that we are master. */
240 return getDataAsIntNull(DATA_DBID); 243 return getDataAsIntNull(DATA_DBID);
241 } 244 }
242 245
243 246
244 /** 247 /**
248 * Return position (km) from parent (initial km), 0 if not found.
249 */
250 private double getParentKm() {
251 String val = getDataAsString(PARENT_KM);
252 try {
253 return Double.valueOf(val);
254 }
255 catch (NumberFormatException e) {
256 logger.warn("Could not get data " + PARENT_KM + " as double", e);
257 return 0;
258 }
259 }
260
261 /**
245 * Return position (km) from data, 0 if not found. 262 * Return position (km) from data, 0 if not found.
246 */ 263 */
247 protected double getKm() { 264 protected double getKm() {
248 String val = getDataAsString(DATA_KM); 265 String val = getDataAsString(DATA_KM);
249 try { 266 try {

http://dive4elements.wald.intevation.org