Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 1100:29c67a76ad5d
Use new helper class FLYSUtils, minor refactorization.
flys-artifacts/trunk@2603 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 29 Aug 2011 09:04:48 +0000 |
parents | f465785ed1ae |
children | 82798c992975 |
comparison
equal
deleted
inserted
replaced
1099:af73f196eccc | 1100:29c67a76ad5d |
---|---|
152 return state; | 152 return state; |
153 } | 153 } |
154 | 154 |
155 | 155 |
156 /** | 156 /** |
157 * Get the river. | |
158 * @todo resolve, this is a duplicate of WINFOArtifact. | |
159 */ | |
160 public River getRiver() { | |
161 StateData dRiver = getData("river"); | |
162 | |
163 return dRiver != null | |
164 ? RiverFactory.getRiver((String) dRiver.getValue()) | |
165 : null; | |
166 } | |
167 | |
168 | |
169 /** | |
170 * Access the Gauge that the mainvalues are taken from. | 157 * Access the Gauge that the mainvalues are taken from. |
171 * @return Gauge that main values are taken from or null in case of | 158 * @return Gauge that main values are taken from or null in case of |
172 * invalid parameterization. | 159 * invalid parameterization. |
173 */ | 160 */ |
174 protected Gauge getGauge() { | 161 protected Gauge getGauge() { |
175 River river = getRiver(); | 162 River river = FLYSUtils.getRiver(this); |
176 | 163 |
177 if (river == null) { | 164 if (river == null) { |
178 return null; | 165 return null; |
179 } | 166 } |
180 | 167 |
181 double location = Double.parseDouble( | 168 double location = Double.parseDouble( |
182 (String)getData("location").getValue()); | 169 getDataAsString("location")); |
183 | 170 |
184 return river.determineGaugeByPosition(location); | 171 return river.determineGaugeByPosition(location); |
185 } | 172 } |
186 | 173 |
187 | 174 |