Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 4937:ce7d8e2a7e02
Fixed mainvalues artifact.
* Use winfo artifact to get location information.
* use ld_locations as data key.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 31 Jan 2013 13:20:05 +0100 |
parents | 88f5ab736448 |
children | 394841a66c14 |
comparison
equal
deleted
inserted
replaced
4929:1366277655b9 | 4937:ce7d8e2a7e02 |
---|---|
172 | 172 |
173 @Override | 173 @Override |
174 protected void initialize(Artifact artifact, Object context, CallMeta meta) { | 174 protected void initialize(Artifact artifact, Object context, CallMeta meta) { |
175 logger.debug("MainValuesArtifact.initialize"); | 175 logger.debug("MainValuesArtifact.initialize"); |
176 FLYSArtifact winfo = (FLYSArtifact) artifact; | 176 FLYSArtifact winfo = (FLYSArtifact) artifact; |
177 RangeAccess rangeAccess = new RangeAccess(this, null); | 177 RangeAccess rangeAccess = new RangeAccess(winfo, null); |
178 double [] locations = rangeAccess.getLocations(); | 178 double [] locations = rangeAccess.getLocations(); |
179 if (locations != null) { | 179 if (locations != null) { |
180 double location = locations[0]; | 180 double location = locations[0]; |
181 addData("location", new DefaultStateData("location", null, null, | 181 addData("ld_locations", new DefaultStateData("ld_locations", null, null, |
182 String.valueOf(location))); | 182 String.valueOf(location))); |
183 } | 183 } |
184 else { | 184 else { |
185 logger.warn("No location for mainvalues given."); | 185 logger.warn("No location for mainvalues given."); |
186 } | 186 } |
243 */ | 243 */ |
244 protected Gauge getGauge() { | 244 protected Gauge getGauge() { |
245 River river = FLYSUtils.getRiver(this); | 245 River river = FLYSUtils.getRiver(this); |
246 | 246 |
247 // TODO use helper to get location as double | 247 // TODO use helper to get location as double |
248 String locationStr = getDataAsString("location"); | 248 String locationStr = getDataAsString("ld_locations"); |
249 | 249 |
250 if (river == null || locationStr == null) { | 250 if (river == null || locationStr == null) { |
251 return null; | 251 return null; |
252 } | 252 } |
253 | 253 |
260 /** | 260 /** |
261 * Get current location. | 261 * Get current location. |
262 * @return the location. | 262 * @return the location. |
263 */ | 263 */ |
264 public double getLocation() { | 264 public double getLocation() { |
265 double location = Double.parseDouble(getDataAsString("location")); | 265 double location = Double.parseDouble(getDataAsString("ld_locations")); |
266 return location; | 266 return location; |
267 } | 267 } |
268 | 268 |
269 | 269 |
270 /** | 270 /** |