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.fixation; raimund@2651: raimund@2651: import org.apache.log4j.Logger; raimund@2651: teichmann@5831: import org.dive4elements.artifacts.Artifact; raimund@2651: teichmann@5867: import org.dive4elements.river.artifacts.D4EArtifact; teichmann@5831: import org.dive4elements.river.artifacts.states.RangeState; aheinecke@6059: import org.dive4elements.river.artifacts.model.FixingsOverviewFactory; aheinecke@6059: import org.dive4elements.river.artifacts.model.FixingsOverview; raimund@2651: raimund@2651: raimund@2651: /** raimund@2651: * @author Raimund Renkert raimund@2651: */ raimund@2651: public class LocationSelect extends RangeState { raimund@2651: teichmann@8202: /** The log used in this class. */ teichmann@8202: private static Logger log = Logger.getLogger(LocationSelect.class); raimund@2651: raimund@2651: /** raimund@2651: * The default constructor that initializes an empty State object. raimund@2651: */ raimund@2651: public LocationSelect() { raimund@2651: } raimund@2651: raimund@2651: @Override raimund@2651: protected String getUIProvider() { raimund@2651: return "fix.location_panel"; raimund@2651: } raimund@2651: raimund@2651: @Override raimund@2651: protected double[] getMinMax(Artifact artifact) { teichmann@5867: D4EArtifact flysArtifact = (D4EArtifact) artifact; aheinecke@6059: String riverName = flysArtifact.getDataAsString("river"); aheinecke@6059: FixingsOverview overview = FixingsOverviewFactory.getOverview(riverName); aheinecke@6059: aheinecke@6059: return new double[]{overview.getExtent().getStart(), overview.getExtent().getEnd()}; raimund@2651: } raimund@2651: felix@3447: felix@3447: /** Misuse to set location mode. */ felix@3447: @Override felix@3447: public boolean validate(Artifact artifact) felix@3447: throws IllegalArgumentException felix@3447: { teichmann@5867: ((D4EArtifact) artifact).addStringData("ld_mode", "distance"); felix@3447: return super.validate(artifact); felix@3447: } raimund@2651: } raimund@2651: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :