view gwt-client/src/main/java/org/dive4elements/river/client/shared/model/FixingsOverviewInfo.java @ 9416:05405292a7ca

Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
author gernotbelger
date Thu, 16 Aug 2018 16:28:03 +0200
parents 2a1dcee5e54a
children
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */

package org.dive4elements.river.client.shared.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class FixingsOverviewInfo implements Serializable {

    protected List<FixEvent> events;
    protected String river;
    protected double from;
    protected double to;
    protected int rid;
    protected String html;

    private FixingsOverviewInfo() {
    }

    public FixingsOverviewInfo(final int rid, final String river, final double from, final double to, final List<FixEvent> events, final String html) {
        this.rid = rid;
        this.river = river;
        this.from = from;
        this.to = to;
        this.events = new ArrayList<FixEvent>(events);
        System.out.println(html);
        this.html = html;

    }

    public int getRId() {
        return this.rid;
    }

    public String getRiver() {
        return this.river;
    }

    public double getLowerKm() {
        return Math.min(this.from, this.to);
    }

    public double getUpperKm() {
        return Math.max(this.from, this.to);
    }

    // public double getFrom() {
    // return this.from < this.to ? this.from : this.to; // TODO: prüfung wieder rausnehmen, hat glaube ich keinen
    // sinnvollen effekt.
    // }
    //
    // public double getTo() {
    // return this.to > this.from ? this.to : this.from;
    // }

    public List<FixEvent> getEvents() {
        return this.events;
    }

    public FixEvent getEventByCId(final String cid) {
        for (final FixEvent event : this.events) {
            if (event.getCId().equals(cid)) {
                return event;
            }
        }
        return null;
    }

    public String getHTML() {
        return this.html;
    }

    public static class FixEvent implements Serializable {
        protected String cid;
        protected String date;
        protected String description;
        protected List<Sector> sectors;

        protected FixEvent() {
        }

        public FixEvent(final String cid, final String date, final String description, final List<Sector> sectors) {
            this.cid = cid;
            this.date = date;
            this.description = description;
            this.sectors = new ArrayList<Sector>(sectors);
        }

        public String getCId() {
            return this.cid;
        }

        public String getDate() {
            return this.date;
        }

        public String getDescription() {
            return this.description;
        }

        public List<Sector> getSectors() {
            return this.sectors;
        }
    }

    public static class Sector implements Serializable {
        protected int cls;
        protected double from;
        protected double to;

        protected Sector() {
        }

        public Sector(final int cls, final double from, final double to) {
            this.cls = cls;
            this.from = from;
            this.to = to;
        }

        public int getCls() {
            return this.cls;
        }

        public double getFrom() {
            return this.from;
        }

        public double getTo() {
            return this.to;
        }
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org