Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java @ 2423:ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
flys-artifacts/tags/2.6.1@4083 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 17 Feb 2012 12:59:56 +0000 |
parents | 44dc117aa2b7 |
children | 8490faba00e7 |
comparison
equal
deleted
inserted
replaced
2422:44dc117aa2b7 | 2423:ac528b883b47 |
---|---|
161 } | 161 } |
162 | 162 |
163 | 163 |
164 /** | 164 /** |
165 * This method returns an WQ_MODE enum which is based on the parameters | 165 * This method returns an WQ_MODE enum which is based on the parameters |
166 * stored in <i>flys</i> Artifact. If there is no <i>wq_mode</i> parameter | 166 * stored in <i>flys</i> Artifact. If there is no <i>wq_isq</i> parameter |
167 * existing, WQ_MODE.NONE is returned. | 167 * existing, WQ_MODE.NONE is returned. |
168 * | 168 * |
169 * @param flys The FLYSArtifact that stores wq mode relevant parameters. | 169 * @param flys The FLYSArtifact that stores wq mode relevant parameters. |
170 * | 170 * |
171 * @return an enum WQ_MODE. | 171 * @return an enum WQ_MODE. |
174 if (flys == null) { | 174 if (flys == null) { |
175 return WQ_MODE.NONE; | 175 return WQ_MODE.NONE; |
176 } | 176 } |
177 | 177 |
178 String values = flys.getDataAsString("wq_values"); | 178 String values = flys.getDataAsString("wq_values"); |
179 Boolean isQ = flys.getDataAsBoolean("wq_mode"); | 179 Boolean isQ = flys.getDataAsBoolean("wq_isq"); |
180 | 180 |
181 if (values != null) { | 181 if (values != null) { |
182 return isQ ? WQ_MODE.QGAUGE : WQ_MODE.WGAUGE; | 182 return isQ ? WQ_MODE.QGAUGE : WQ_MODE.WGAUGE; |
183 } | 183 } |
184 | 184 |
185 Boolean isFree = flys.getDataAsBoolean("wq_free"); | 185 Boolean isFree = flys.getDataAsBoolean("wq_isfree"); |
186 | 186 |
187 if (isQ) { | 187 if (isQ) { |
188 return isFree ? WQ_MODE.QFREE : WQ_MODE.QGAUGE; | 188 return isFree ? WQ_MODE.QFREE : WQ_MODE.QGAUGE; |
189 } | 189 } |
190 else if (!isQ) { | 190 else if (!isQ) { |
199 public static WQ_INPUT getWQInputMode(FLYSArtifact flys) { | 199 public static WQ_INPUT getWQInputMode(FLYSArtifact flys) { |
200 if (flys == null) { | 200 if (flys == null) { |
201 return WQ_INPUT.NONE; | 201 return WQ_INPUT.NONE; |
202 } | 202 } |
203 | 203 |
204 Boolean selection = flys.getDataAsBoolean("wq_selection"); | 204 Boolean selection = flys.getDataAsBoolean("wq_isrange"); |
205 String adapted = flys.getDataAsString("wq_values"); | 205 String adapted = flys.getDataAsString("wq_values"); |
206 | 206 |
207 if(adapted != null && adapted.length() > 0) { | 207 if(adapted != null && adapted.length() > 0) { |
208 return WQ_INPUT.ADAPTED; | 208 return WQ_INPUT.ADAPTED; |
209 } | 209 } |
343 * @param flys A FLYSArtifact. | 343 * @param flys A FLYSArtifact. |
344 * | 344 * |
345 * @return the Qs. | 345 * @return the Qs. |
346 */ | 346 */ |
347 public static double[] getQs(FLYSArtifact flys) { | 347 public static double[] getQs(FLYSArtifact flys) { |
348 double[] kmRange = getKmRange(flys); | |
349 | |
350 // XXX this is not nice! | 348 // XXX this is not nice! |
351 if (flys instanceof WINFOArtifact) { | 349 if (flys instanceof WINFOArtifact) { |
352 return ((WINFOArtifact) flys).getQs(kmRange); | 350 return ((WINFOArtifact) flys).getQs(); |
353 } | 351 } |
354 | 352 |
355 logger.warn("This method currently supports WINFOArtifact only!"); | 353 logger.warn("This method currently supports WINFOArtifact only!"); |
356 | 354 |
357 return null; | 355 return null; |