Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | 8d5ca5175038 |
children | 5e38e2924c07 |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
69 public static final String DATA_PREV_KM = "cross_section.km.previous"; | 69 public static final String DATA_PREV_KM = "cross_section.km.previous"; |
70 | 70 |
71 /** Name of data item storing the next possible km. */ | 71 /** Name of data item storing the next possible km. */ |
72 public static final String DATA_NEXT_KM = "cross_section.km.next"; | 72 public static final String DATA_NEXT_KM = "cross_section.km.next"; |
73 | 73 |
74 /** Own logger. */ | 74 /** Own log. */ |
75 private static final Logger logger = | 75 private static final Logger log = |
76 Logger.getLogger(CrossSectionArtifact.class); | 76 Logger.getLogger(CrossSectionArtifact.class); |
77 | 77 |
78 static { | 78 static { |
79 // TODO: Move to configuration. | 79 // TODO: Move to configuration. |
80 FacetActivity.Registry.getInstance().register( | 80 FacetActivity.Registry.getInstance().register( |
111 Object context, | 111 Object context, |
112 CallMeta callMeta, | 112 CallMeta callMeta, |
113 Document data, | 113 Document data, |
114 List<Class> loadFacets) | 114 List<Class> loadFacets) |
115 { | 115 { |
116 logger.info("CrossSectionArtifact.setup"); | 116 log.info("CrossSectionArtifact.setup"); |
117 | 117 |
118 super.setup(identifier, factory, context, callMeta, data, loadFacets); | 118 super.setup(identifier, factory, context, callMeta, data, loadFacets); |
119 | 119 |
120 String ids = getDatacageIDValue(data); | 120 String ids = getDatacageIDValue(data); |
121 | 121 |
122 if (ids != null && ids.length() > 0) { | 122 if (ids != null && ids.length() > 0) { |
123 addStringData(DATA_DBID, ids); | 123 addStringData(DATA_DBID, ids); |
124 logger.debug("CrossSectionArtifacts db-id: " + ids); | 124 log.debug("CrossSectionArtifacts db-id: " + ids); |
125 } | 125 } |
126 else { | 126 else { |
127 throw new IllegalArgumentException("No attribute 'ids' found!"); | 127 throw new IllegalArgumentException("No attribute 'ids' found!"); |
128 } | 128 } |
129 | 129 |
231 String val = getDataAsString(dataName); | 231 String val = getDataAsString(dataName); |
232 try { | 232 try { |
233 return Integer.parseInt(val); | 233 return Integer.parseInt(val); |
234 } | 234 } |
235 catch (NumberFormatException e) { | 235 catch (NumberFormatException e) { |
236 logger.warn("Could not get data " + dataName + " as int", e); | 236 log.warn("Could not get data " + dataName + " as int", e); |
237 return 0; | 237 return 0; |
238 } | 238 } |
239 } | 239 } |
240 | 240 |
241 | 241 |
249 * Return position (km) from parent (initial km), 0 if not found. | 249 * Return position (km) from parent (initial km), 0 if not found. |
250 */ | 250 */ |
251 private double getParentKm() { | 251 private double getParentKm() { |
252 String val = getDataAsString(PARENT_KM); | 252 String val = getDataAsString(PARENT_KM); |
253 if (val == null) { | 253 if (val == null) { |
254 logger.warn("Empty data: " + PARENT_KM); | 254 log.warn("Empty data: " + PARENT_KM); |
255 return 0; | 255 return 0; |
256 } | 256 } |
257 try { | 257 try { |
258 return Double.valueOf(val); | 258 return Double.valueOf(val); |
259 } | 259 } |
260 catch (NumberFormatException e) { | 260 catch (NumberFormatException e) { |
261 logger.warn("Could not get data " + PARENT_KM + " as double", e); | 261 log.warn("Could not get data " + PARENT_KM + " as double", e); |
262 return 0; | 262 return 0; |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 /** | 266 /** |
270 String val = getDataAsString(DATA_KM); | 270 String val = getDataAsString(DATA_KM); |
271 try { | 271 try { |
272 return Double.valueOf(val); | 272 return Double.valueOf(val); |
273 } | 273 } |
274 catch (NumberFormatException e) { | 274 catch (NumberFormatException e) { |
275 logger.warn("Could not get data " + DATA_KM + " as double", e); | 275 log.warn("Could not get data " + DATA_KM + " as double", e); |
276 return 0; | 276 return 0; |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 | 280 |
290 * | 290 * |
291 * @return an array holding coordinates of points of profile ( | 291 * @return an array holding coordinates of points of profile ( |
292 * in the form {{x1, x2} {y1, y2}} ). | 292 * in the form {{x1, x2} {y1, y2}} ). |
293 */ | 293 */ |
294 public double [][] getCrossSectionData() { | 294 public double [][] getCrossSectionData() { |
295 logger.info("getCrossSectionData() for cross_section.km " | 295 log.info("getCrossSectionData() for cross_section.km " |
296 + getDataAsString(DATA_KM)); | 296 + getDataAsString(DATA_KM)); |
297 FastCrossSectionLine line = searchCrossSectionLine(); | 297 FastCrossSectionLine line = searchCrossSectionLine(); |
298 | 298 |
299 return line != null | 299 return line != null |
300 ? line.fetchCrossSectionProfile() | 300 ? line.fetchCrossSectionProfile() |
315 public FastCrossSectionLine searchCrossSectionLine() { | 315 public FastCrossSectionLine searchCrossSectionLine() { |
316 double TOO_FAR = 1d; | 316 double TOO_FAR = 1d; |
317 CrossSection crossSection = CrossSectionFactory | 317 CrossSection crossSection = CrossSectionFactory |
318 .getCrossSection(getDBID()); | 318 .getCrossSection(getDBID()); |
319 | 319 |
320 if (logger.isDebugEnabled()) { | 320 if (log.isDebugEnabled()) { |
321 logger.debug("dbid " + getDBID() + " : " + crossSection); | 321 log.debug("dbid " + getDBID() + " : " + crossSection); |
322 } | 322 } |
323 | 323 |
324 NavigableMap<Double, Integer> kms = CrossSectionKMService | 324 NavigableMap<Double, Integer> kms = CrossSectionKMService |
325 .getKms(crossSection.getId()); | 325 .getKms(crossSection.getId()); |
326 | 326 |