teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5994: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5994: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.artifacts.states; felix@2251: teichmann@5867: import org.dive4elements.river.artifacts.D4EArtifact; sascha@2254: tom@8765: import org.dive4elements.river.artifacts.access.RiverAccess; 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 teichmann@5867: protected Object getLower(D4EArtifact flys) { tom@8765: double[] lowerUpper = new RiverAccess(flys).getRiver() tom@8765: .determineMinMaxDistance(); 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 teichmann@5867: protected Object getUpper(D4EArtifact flys) { tom@8765: double[] lowerUpper = new RiverAccess(flys).getRiver() tom@8765: .determineMinMaxDistance(); 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 :