teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5863: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5863: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.artifacts.states; felix@2251: teichmann@5831: import org.dive4elements.river.artifacts.FLYSArtifact; sascha@2254: teichmann@5865: import org.dive4elements.river.utils.RiverUtils; felix@2251: felix@2251: felix@2251: /** felix@2306: * Get me a double (km). felix@2251: */ felix@2251: public class EnterLocationState extends InputDoubleState { felix@2251: felix@2306: /** Provoke this kind of provider in the UI. */ felix@2251: @Override felix@2251: protected String getUIProvider() { felix@2251: return "location_panel"; felix@2251: } felix@2251: felix@2251: felix@2306: /** Allow from min km of river. */ felix@2251: @Override felix@2251: protected Object getLower(FLYSArtifact flys) { teichmann@5865: double[] lowerUpper = RiverUtils.getRiverMinMax(flys); felix@2251: felix@2251: return lowerUpper != null felix@2251: ? lowerUpper[0] felix@2251: : 0; felix@2251: } felix@2251: felix@2251: felix@2306: /** Allow to max km of river. */ felix@2251: @Override felix@2251: protected Object getUpper(FLYSArtifact flys) { teichmann@5865: double[] lowerUpper = RiverUtils.getRiverMinMax(flys); felix@2251: felix@2251: return lowerUpper != null felix@2251: ? lowerUpper[1] felix@2251: : 0; felix@2251: } felix@2251: } felix@2251: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :