Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixRealizingCalculationExtended.java @ 9363:0274c7444b2d
Fixed: missing commit
Outliers in fixation calculation are now shown within the other 'B' event themes and get a separate symbol (triangle).
Removed old outliers theme.
Also consider showpoints property.
Also consider pointsize property.
author | gernotbelger |
---|---|
date | Thu, 02 Aug 2018 09:59:48 +0200 |
parents | 7565d7dce850 |
children | 9744ce3c3853 |
line wrap: on
line source
/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by * Björnsen Beratende Ingenieure GmbH * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * 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.artifacts.model.fixings; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; import org.dive4elements.river.artifacts.access.FixRealizingAccess; import org.dive4elements.river.artifacts.model.FixingsOverview; import org.dive4elements.river.artifacts.model.FixingsOverviewFactory; /** * REMARK: this inheritance is only needed, beause changing the orignal calculation will probably break the * serialization of the artifact.... * * @author Gernot Belger */ public class FixRealizingCalculationExtended extends FixRealizingCalculation { private static final long serialVersionUID = 1L; public FixRealizingCalculationExtended(final FixRealizingAccess fixAccess) { super(fixAccess); } public int determineMeanYear() { final FixingsOverview overview = FixingsOverviewFactory.getOverview(this.river); final ColumnCache cc = new ColumnCache(); final SortedSet<Integer> years = new TreeSet<>(); final Calendar cal = Calendar.getInstance(); final List<Column> columns = getEventColumns(overview, cc); for (final Column column : columns) { final Date date = column.getDate(); cal.setTime(date); final int year = cal.get(Calendar.YEAR); years.add(year); } final Integer first = years.first(); final Integer last = years.last(); if (first == null || last == null) return -1; return (first + last) / 2; } }