Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java @ 3138:9c147bbffc36
FixA: Move Range out of FixingsOverview
flys-artifacts/trunk@4746 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 21 Jun 2012 15:18:46 +0000 |
parents | 0b86b005bb9a |
children | 3582e87e9171 |
rev | line source |
---|---|
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import java.io.Serializable; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import java.text.SimpleDateFormat; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 import java.util.ArrayList; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 import java.util.Collections; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import java.util.Comparator; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 import java.util.Date; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import java.util.HashMap; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 import java.util.List; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import java.util.Map; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import org.apache.log4j.Logger; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 import org.hibernate.SQLQuery; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 import org.hibernate.Session; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 import org.hibernate.type.StandardBasicTypes; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 import org.w3c.dom.Document; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 import org.w3c.dom.Element; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 public class FixingsOverview |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 implements Serializable |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 private static Logger log = Logger.getLogger(FixingsOverview.class); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 public static final double EPSILON = 1e-5; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 public static final double EPSILON2 = 1e-1; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 |
2632
7d163c2c6e6d
Improve XSL transformation for fixings overview output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2613
diff
changeset
|
33 public static final String DATE_FORMAT = "dd.MM.yyyy"; |
2564
3f038d54bc87
FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
34 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 public static final String SQL_RIVER_ID = |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 "SELECT" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 " id AS river_id," + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 " km_up " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 "FROM rivers " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 "WHERE" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 " name = :name"; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 public static final String SQL_GAUGES = |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 "SELECT" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 " g.id AS gauge_id," + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 " r.a AS a," + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 " r.b AS b " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 "FROM gauges g" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 " JOIN ranges r ON g.range_id = r.id " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 "WHERE" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 " g.river_id = :river_id " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 "ORDER BY r.a"; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 public static final String SQL_DISCHARGE_SECTORS = |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 "SELECT" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 " g.id AS gauge_id," + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 " nmv.name AS name," + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 " CAST(mv.value AS NUMERIC(38,2)) AS value " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 "FROM gauges g" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 " JOIN main_values mv ON g.id = mv.gauge_id" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 " JOIN named_main_values nmv ON nmv.id = mv.named_value_id" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 " JOIN main_value_types mvt ON nmv.type_id = mvt.id " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 "WHERE" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 " mvt.name = 'Q' AND (" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 " nmv.name = 'MNQ' OR" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 " nmv.name LIKE 'MNQ(%' OR" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 " nmv.name = 'MQ' OR" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 " nmv.name LIKE 'MQ(%' OR" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 " nmv.name = 'MHQ' OR" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 " nmv.name LIKE 'MHQ(%' OR" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 " nmv.name = 'HQ5' OR" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 " nmv.name LIKE 'HQ5(%') AND" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 " g.river_id = :river_id " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 "ORDER BY" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 " g.id"; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 public static final String SQL_FIXINGS = |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 "SELECT" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 " id AS wst_id," + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 " description " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 "FROM wsts " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 "WHERE" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 " river_id = :river_id AND kind = 2"; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 public static final String SQL_FIXING_COLUMNS = |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 "SELECT" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 " wc.id AS wst_column_id," + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 " ti.start_time AS start_time," + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 " wc.name AS name " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 "FROM wst_columns wc" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 " JOIN time_intervals ti ON wc.time_interval_id = ti.id " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 "WHERE" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 " wc.wst_id = :wst_id " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 "ORDER BY position"; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 public static final String SQL_FIXING_COLUMN_Q_RANGES = |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 "SELECT" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 " wqr.q AS q," + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 " r.a AS start_km," + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 " r.b AS stop_km " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 "FROM wst_column_q_ranges wcqr" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 " JOIN wst_q_ranges wqr ON wcqr.wst_q_range_id = wqr.id" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 " JOIN ranges r ON wqr.range_id = r.id " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 "WHERE" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 " wcqr.wst_column_id = :column_id " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 "ORDER BY r.a"; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 public static final String SQL_FIXING_COLUMN_KM_RANGE = |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 "SELECT" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 " MIN(position) AS start_km," + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 " MAX(position) AS stop_km " + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 "FROM" + |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 " wst_column_values " + |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
114 "WHERE" + |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 " wst_column_id = :column_id"; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 public static class GaugeRange extends Range { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 private static final class Sector implements Serializable { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 int sector; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 double value; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 Sector(int sector, double value) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 this.sector = sector; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 this.value = value; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
129 } // class Sector |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 protected int gaugeId; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 protected Map<String, Double> mainValues; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 protected List<Sector> sectors; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 public GaugeRange() { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
137 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 public GaugeRange(double start, double end, int gaugeId) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 super(start, end); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 this.gaugeId = gaugeId; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
142 mainValues = new HashMap<String, Double>(); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
143 sectors = new ArrayList<Sector>(3); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
145 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
146 public void addMainValue(String label, Double value) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
147 int idx = label.indexOf('('); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
148 if (idx >= 0) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
149 label = label.substring(0, idx); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
151 mainValues.put(label, value); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
152 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
153 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
154 protected Double getMainValue(String label) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
155 Double v = mainValues.get(label); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
156 if (v == null) { |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
157 log.warn("Missing main value '" |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
158 + label + "' for gauge " + gaugeId); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
159 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 return v; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
161 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
162 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
163 public void buildClasses() { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
164 Double mnq = getMainValue("MNQ"); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
165 Double mq = getMainValue("MQ"); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
166 Double mhq = getMainValue("MHQ"); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
167 Double hq5 = getMainValue("HQ5"); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
168 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
169 Double [][] pairs = { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
170 { mnq, mq }, |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
171 { mq, mhq }, |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
172 { hq5, hq5 } }; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
173 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
174 for (int c = 0; c < pairs.length; ++c) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
175 Double [] pair = pairs[c]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
176 if (pair[0] != null && pair[1] != null) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
177 double value = 0.5*(pair[0] + pair[1]); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
178 sectors.add(new Sector(c, value)); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
179 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
180 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
181 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
182 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
183 public int classify(double value) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
184 for (Sector sector: sectors) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
185 if (value < sector.value) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
186 return sector.sector; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
187 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
188 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
189 return sectors.size(); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
190 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
191 } // class GaugeRange |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
192 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
193 public static class GaugeFinder { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
194 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
195 protected List<GaugeRange> gauges; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
196 protected boolean isKmUp; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
197 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
198 public GaugeFinder(List<GaugeRange> gauges) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
199 this(gauges, true); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
200 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
201 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
202 public GaugeFinder( |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
203 List<GaugeRange> gauges, |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
204 boolean isKmUp |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
205 ) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
206 this.gauges = gauges; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
207 this.isKmUp = isKmUp; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
208 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
209 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
210 public boolean getIsKmUp() { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
211 return isKmUp; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
212 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
213 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
214 public void setIsKmUp(boolean isKmUp) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
215 this.isKmUp = isKmUp; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
216 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
217 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
218 public GaugeRange find(Range range) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
219 double km = isKmUp ? range.start : range.end; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
220 for (GaugeRange gauge: gauges) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
221 if (gauge.inside(km)) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
222 return gauge; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
223 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
224 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
225 return null; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
226 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
227 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
228 public GaugeRange find(int gaugeId) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
229 for (GaugeRange gauge: gauges) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
230 if (gauge.gaugeId == gaugeId) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
231 return gauge; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
232 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
233 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
234 return null; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
235 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
236 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
237 public boolean loadDischargeSectors(Session session, int riverId) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
238 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
239 SQLQuery query = session.createSQLQuery(SQL_DISCHARGE_SECTORS) |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
240 .addScalar("gauge_id", StandardBasicTypes.INTEGER) |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
241 .addScalar("name", StandardBasicTypes.STRING) |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
242 .addScalar("value", StandardBasicTypes.DOUBLE); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
243 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
244 query.setInteger("river_id", riverId); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
245 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
246 List<Object []> list = query.list(); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
247 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
248 if (list.isEmpty()) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
249 log.warn("River " + riverId + " has no discharge sectors."); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
250 return false; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
251 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
252 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
253 GaugeRange gauge = null; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
254 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
255 for (Object [] row: list) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
256 int gaugeId = (Integer)row[0]; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
257 String label = (String) row[1]; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
258 Double value = (Double) row[2]; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
259 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
260 if (gauge == null || gauge.gaugeId != gaugeId) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
261 if ((gauge = find(gaugeId)) == null) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
262 log.warn("Cannot find gauge for id " + gaugeId + "."); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
263 continue; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
264 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
265 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
266 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
267 gauge.addMainValue(label, value); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
268 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
269 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
270 for (GaugeRange g: gauges) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
271 g.buildClasses(); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
272 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
273 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
274 return true; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
275 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
276 } // class GaugeFinder |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
277 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
278 public static class QRange extends Range { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
279 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
280 protected double q; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
281 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
282 public QRange() { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
283 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
284 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
285 public QRange(double start, double end, double q) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
286 super(start, end); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
287 this.q = q; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
288 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
289 } // class QRange |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
290 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
291 public static class SectorRange extends Range { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
292 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
293 protected int sector; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
294 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
295 public SectorRange() { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
296 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
297 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
298 public SectorRange(SectorRange other) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
299 start = other.start; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
300 end = other.end; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
301 sector = other.sector; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
302 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
303 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
304 public SectorRange(double start, double end, int sector) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
305 super(start, end); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
306 this.sector = sector; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
307 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
308 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
309 public int getSector() { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
310 return sector; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
311 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
312 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
313 public boolean enlarge(SectorRange other) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
314 if (sector == other.sector |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
315 && Math.abs(end-other.start) < EPSILON2) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
316 end = other.end; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
317 return true; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
318 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
319 return false; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
320 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
321 } // class SectorRange |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
322 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
323 public static class Fixing implements Serializable { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
324 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
325 public static final Comparator<Column> DATE_CMP = |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
326 new Comparator<Column>() { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
327 @Override |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
328 public int compare(Column a, Column b) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
329 return a.startTime.compareTo(b.startTime); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
330 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
331 }; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
332 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
333 public interface Filter { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
334 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
335 boolean accept(Column column); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
336 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
337 } // interface Filter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
338 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
339 public class Column extends Range { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
340 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
341 protected int columnId; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
342 protected Date startTime; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
343 protected String name; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
344 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
345 protected List<SectorRange> sectors; |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
346 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
347 public Column() { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
348 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
349 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
350 public Column(int columnId, Date startTime, String name) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
351 this.columnId = columnId; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
352 this.startTime = startTime; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
353 this.name = name; |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
354 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
355 sectors = new ArrayList<SectorRange>(); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
356 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
357 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
358 public int getId() { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
359 return columnId; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
360 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
361 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
362 public Fixing getFixing() { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
363 return Fixing.this; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
364 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
365 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
366 public Date getStartTime() { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
367 return startTime; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
368 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
369 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
370 public String getName() { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
371 return name; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
372 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
373 |
2707
d6e32ae72da6
Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2632
diff
changeset
|
374 public String getDescription() { |
d6e32ae72da6
Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2632
diff
changeset
|
375 return Fixing.this.description + "/" + name; |
d6e32ae72da6
Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2632
diff
changeset
|
376 } |
d6e32ae72da6
Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2632
diff
changeset
|
377 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
378 public List<SectorRange> getSectors() { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
379 return sectors; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
380 } |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
381 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
382 public List<SectorRange> getSectors(Range range) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
383 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
384 List<SectorRange> result = |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
385 new ArrayList<SectorRange>(sectors.size()); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
386 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
387 for (SectorRange src: sectors) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
388 SectorRange dst = new SectorRange(src); |
2613
2e129754d450
Fixed NPE bug in filter builder for fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2608
diff
changeset
|
389 if (range == null || dst.clip(range)) { |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
390 result.add(dst); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
391 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
392 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
393 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
394 return result; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
395 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
396 |
3002
e54dd69d306f
FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2744
diff
changeset
|
397 public int findQSector(double km) { |
e54dd69d306f
FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2744
diff
changeset
|
398 for (SectorRange sector: sectors) { |
e54dd69d306f
FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2744
diff
changeset
|
399 if (sector.inside(km)) { |
e54dd69d306f
FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2744
diff
changeset
|
400 return sector.getSector(); |
e54dd69d306f
FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2744
diff
changeset
|
401 } |
e54dd69d306f
FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2744
diff
changeset
|
402 } |
e54dd69d306f
FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2744
diff
changeset
|
403 return -1; |
e54dd69d306f
FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2744
diff
changeset
|
404 } |
e54dd69d306f
FixA: Added method to classify fixing events for certain kms.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2744
diff
changeset
|
405 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
406 public void buildSectors(GaugeRange gauge, List<QRange> qRanges) { |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
407 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
408 for (QRange qRange: qRanges) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
409 SectorRange sector = new SectorRange( |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
410 qRange.start, qRange.end, |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
411 gauge.classify(qRange.q)); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
412 if (sectors.isEmpty() |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
413 || !sectors.get(sectors.size()-1).enlarge(sector)) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
414 sectors.add(sector); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
415 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
416 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
417 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
418 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
419 public void loadKmRange(SQLQuery query) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
420 query.setInteger("column_id", columnId); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
421 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
422 List<Object []> kms = query.list(); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
423 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
424 if (kms.isEmpty()) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
425 log.warn("No km range for column " + columnId + "."); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
426 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
427 else { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
428 Object [] obj = kms.get(0); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
429 start = (Double)obj[0]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
430 end = (Double)obj[1]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
431 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
432 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
433 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
434 public void loadQRanges( |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
435 SQLQuery query, |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
436 GaugeFinder gaugeFinder |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
437 ) { |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
438 query.setInteger("column_id", columnId); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
439 List<Object []> list = query.list(); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
440 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
441 List<QRange> qRanges = new ArrayList<QRange>(list.size()); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
442 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
443 for (Object [] row: list) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
444 double q = (Double)row[0]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
445 double start = (Double)row[1]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
446 double end = (Double)row[2]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
447 QRange qRange = new QRange(start, end, q); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
448 if (qRange.clip(this)) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
449 qRanges.add(qRange); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
450 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
451 } |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
452 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
453 GaugeRange gauge = gaugeFinder.find(this); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
454 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
455 if (gauge != null) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
456 buildSectors(gauge, qRanges); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
457 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
458 else { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
459 log.warn("No gauge found for column " + columnId + "."); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
460 } |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
461 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
462 } // class Column |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
463 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
464 protected int wstId; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
465 protected String description; |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
466 protected List<Column> columns; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
467 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
468 public Fixing() { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
469 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
470 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
471 public int getId() { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
472 return wstId; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
473 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
474 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
475 public String getDescription() { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
476 return description; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
477 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
478 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
479 public Fixing(int wstId, String description) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
480 this.wstId = wstId; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
481 this.description = description; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
482 columns = new ArrayList<Column>(); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
483 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
484 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
485 public void loadColumns(SQLQuery query) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
486 query.setInteger("wst_id", wstId); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
487 List<Object []> list = query.list(); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
488 for (Object [] row: list) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
489 int columnId = (Integer)row[0]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
490 Date startTime = (Date) row[1]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
491 String name = (String) row[2]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
492 columns.add(new Column(columnId, startTime, name)); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
493 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
494 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
495 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
496 public void loadColumnsKmRange(SQLQuery query) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
497 for (Column column: columns) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
498 column.loadKmRange(query); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
499 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
500 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
501 |
2565
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
502 public void adjustExtent(Range extent) { |
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
503 for (Column column: columns) { |
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
504 extent.extend(column); |
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
505 } |
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
506 } |
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
507 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
508 public void loadColumnsQRanges( |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
509 SQLQuery query, |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
510 GaugeFinder gaugeFinder |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
511 ) { |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
512 for (Column column: columns) { |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
513 column.loadQRanges(query, gaugeFinder); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
514 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
515 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
516 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
517 public void addAllColumns( |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
518 List<Column> allColumns, |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
519 Range range, |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
520 Filter filter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
521 ) { |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
522 for (Column column: columns) { |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
523 if ((range == null || column.intersects(range)) |
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3008
diff
changeset
|
524 && (filter == null || filter.accept(column))) { |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
525 allColumns.add(column); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
526 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
527 } |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
528 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
529 } // class Fixing |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
530 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
531 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
532 protected String riverName; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
533 protected int riverId; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
534 protected boolean isKmUp; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
535 protected List<Fixing> fixings; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
536 protected Range extent; |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
537 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
538 public FixingsOverview() { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
539 fixings = new ArrayList<Fixing>(); |
2565
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
540 extent = new Range(Double.MAX_VALUE, -Double.MAX_VALUE); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
541 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
542 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
543 public FixingsOverview(String riverName) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
544 this(); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
545 this.riverName = riverName; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
546 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
547 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
548 protected boolean loadRiver(Session session) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
549 SQLQuery query = session.createSQLQuery(SQL_RIVER_ID) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
550 .addScalar("river_id", StandardBasicTypes.INTEGER) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
551 .addScalar("km_up", StandardBasicTypes.BOOLEAN); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
552 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
553 query.setString("name", riverName); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
554 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
555 List<Object []> list = query.list(); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
556 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
557 if (list.isEmpty()) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
558 log.warn("No river '" + riverName + "' found."); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
559 return false; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
560 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
561 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
562 Object [] row = list.get(0); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
563 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
564 riverId = (Integer)row[0]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
565 isKmUp = (Boolean)row[1]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
566 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
567 return true; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
568 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
569 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
570 protected GaugeFinder loadGauges(Session session) { |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
571 SQLQuery query = session.createSQLQuery(SQL_GAUGES) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
572 .addScalar("gauge_id", StandardBasicTypes.INTEGER) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
573 .addScalar("a", StandardBasicTypes.DOUBLE) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
574 .addScalar("b", StandardBasicTypes.DOUBLE); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
575 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
576 query.setInteger("river_id", riverId); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
577 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
578 List<Object []> list = query.list(); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
579 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
580 if (list.isEmpty()) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
581 log.warn("River " + riverId + " has no gauges."); |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
582 return null; |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
583 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
584 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
585 List<GaugeRange> gauges = new ArrayList<GaugeRange>(); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
586 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
587 for (Object [] row: list) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
588 int gaugeId = (Integer)row[0]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
589 double start = (Double) row[1]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
590 double end = (Double) row[2]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
591 GaugeRange gauge = new GaugeRange(start, end, gaugeId); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
592 gauges.add(gauge); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
593 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
594 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
595 return new GaugeFinder(gauges, isKmUp); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
596 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
597 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
598 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
599 protected void loadFixings(Session session) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
600 SQLQuery query = session.createSQLQuery(SQL_FIXINGS) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
601 .addScalar("wst_id", StandardBasicTypes.INTEGER) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
602 .addScalar("description", StandardBasicTypes.STRING); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
603 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
604 query.setInteger("river_id", riverId); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
605 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
606 List<Object []> list = query.list(); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
607 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
608 if (list.isEmpty()) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
609 log.warn("River " + riverId + " has no fixings."); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
610 // Its pretty fine to have no fixings. |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
611 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
612 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
613 for (Object [] row: list) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
614 int wstId = (Integer)row[0]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
615 String description = (String) row[1]; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
616 Fixing fixing = new Fixing(wstId, description); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
617 fixings.add(fixing); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
618 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
619 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
620 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
621 protected void loadFixingsColumns(Session session) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
622 SQLQuery query = session.createSQLQuery(SQL_FIXING_COLUMNS) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
623 .addScalar("wst_column_id", StandardBasicTypes.INTEGER) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
624 .addScalar("start_time", StandardBasicTypes.DATE) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
625 .addScalar("name", StandardBasicTypes.STRING); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
626 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
627 for (Fixing fixing: fixings) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
628 fixing.loadColumns(query); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
629 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
630 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
631 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
632 protected void loadFixingsColumnsKmRange(Session session) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
633 SQLQuery query = session.createSQLQuery(SQL_FIXING_COLUMN_KM_RANGE) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
634 .addScalar("start_km", StandardBasicTypes.DOUBLE) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
635 .addScalar("stop_km", StandardBasicTypes.DOUBLE); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
636 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
637 for (Fixing fixing: fixings) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
638 fixing.loadColumnsKmRange(query); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
639 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
640 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
641 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
642 protected void loadFixingsColumnsQRanges( |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
643 Session session, |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
644 GaugeFinder gaugeFinder |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
645 ) { |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
646 SQLQuery query = session.createSQLQuery(SQL_FIXING_COLUMN_Q_RANGES) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
647 .addScalar("q", StandardBasicTypes.DOUBLE) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
648 .addScalar("start_km", StandardBasicTypes.DOUBLE) |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
649 .addScalar("stop_km", StandardBasicTypes.DOUBLE); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
650 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
651 for (Fixing fixing: fixings) { |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
652 fixing.loadColumnsQRanges(query, gaugeFinder); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
653 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
654 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
655 |
2565
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
656 protected void adjustExtent() { |
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
657 for (Fixing fixing: fixings) { |
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
658 fixing.adjustExtent(extent); |
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
659 } |
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
660 } |
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
661 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
662 public boolean load(Session session) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
663 |
2565
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
664 if (!loadRiver(session)) { |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
665 return false; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
666 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
667 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
668 GaugeFinder gaugeFinder = loadGauges(session); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
669 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
670 if (gaugeFinder == null |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
671 || !gaugeFinder.loadDischargeSectors(session, riverId)) { |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
672 return false; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
673 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
674 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
675 loadFixings(session); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
676 loadFixingsColumns(session); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
677 loadFixingsColumnsKmRange(session); |
2565
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
678 |
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
679 adjustExtent(); |
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
680 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
681 loadFixingsColumnsQRanges(session, gaugeFinder); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
682 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
683 return true; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
684 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
685 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
686 public static final Range FULL_EXTENT = |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
687 new Range(-Double.MAX_VALUE, Double.MAX_VALUE); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
688 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
689 public static final Fixing.Filter ACCEPT = new Fixing.Filter() { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
690 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
691 public boolean accept(Fixing.Column column) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
692 return true; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
693 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
694 }; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
695 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
696 public static class NotFilter implements Fixing.Filter { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
697 protected Fixing.Filter child; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
698 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
699 public NotFilter(Fixing.Filter child) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
700 this.child = child; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
701 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
702 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
703 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
704 public boolean accept(Fixing.Column column) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
705 return !child.accept(column); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
706 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
707 } // class NotFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
708 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
709 public static abstract class ComponentFilter implements Fixing.Filter { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
710 protected List<Fixing.Filter> children; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
711 |
2744
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
712 public ComponentFilter() { |
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
713 children = new ArrayList<Fixing.Filter>(); |
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
714 } |
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
715 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
716 public ComponentFilter(List<Fixing.Filter> children) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
717 this.children = children; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
718 } |
2744
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
719 |
3121
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
720 public ComponentFilter add(Fixing.Filter filter) { |
2744
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
721 children.add(filter); |
3121
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
722 return this; |
2744
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
723 } |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
724 } // class ComponentFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
725 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
726 public static class OrFilter extends ComponentFilter { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
727 |
2744
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
728 public OrFilter() { |
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
729 } |
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
730 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
731 public OrFilter(List<Fixing.Filter> children) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
732 super(children); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
733 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
734 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
735 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
736 public boolean accept(Fixing.Column column) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
737 for (Fixing.Filter child: children) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
738 if (child.accept(column)) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
739 return true; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
740 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
741 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
742 return false; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
743 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
744 } // class OrFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
745 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
746 public static class AndFilter extends ComponentFilter { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
747 |
2744
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
748 public AndFilter() { |
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
749 } |
c1f2e792704a
FixA: Calculate Delta W/t, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2707
diff
changeset
|
750 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
751 public AndFilter(List<Fixing.Filter> children) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
752 super(children); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
753 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
754 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
755 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
756 public boolean accept(Fixing.Column column) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
757 for (Fixing.Filter child: children) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
758 if (!child.accept(column)) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
759 return false; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
760 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
761 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
762 return true; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
763 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
764 } // class AndFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
765 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
766 public static class IdFilter implements Fixing.Filter { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
767 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
768 protected int columnId; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
769 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
770 public IdFilter(int columnId) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
771 this.columnId = columnId; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
772 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
773 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
774 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
775 public boolean accept(Fixing.Column column) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
776 return column.getId() == columnId; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
777 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
778 } // class IdFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
779 |
3121
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
780 public static class IdsFilter implements Fixing.Filter { |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
781 |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
782 protected int [] columnIds; |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
783 |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
784 public IdsFilter(int [] columnIds) { |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
785 this.columnIds = columnIds; |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
786 } |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
787 |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
788 @Override |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
789 public boolean accept(Fixing.Column column) { |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
790 int cid = column.getId(); |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
791 for (int i = columnIds.length-1; i >= 0; --i) { |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
792 if (columnIds[i] == cid) { |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
793 return true; |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
794 } |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
795 } |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
796 return false; |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
797 } |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
798 } // class IdFilter |
0b86b005bb9a
FixA: Respect the selected events and reference period correctly.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
799 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
800 public static class DateFilter implements Fixing.Filter { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
801 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
802 protected Date date; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
803 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
804 public DateFilter(Date date) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
805 this.date = date; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
806 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
807 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
808 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
809 public boolean accept(Fixing.Column column) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
810 return date.equals(column.getStartTime()); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
811 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
812 } // class DateFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
813 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
814 public static class DateRangeFilter implements Fixing.Filter { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
815 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
816 protected Date start; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
817 protected Date end; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
818 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
819 public DateRangeFilter(Date start, Date end) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
820 this.start = start; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
821 this.end = end; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
822 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
823 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
824 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
825 public boolean accept(Fixing.Column column) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
826 Date date = column.getStartTime(); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
827 return start.compareTo(date) <= 0 && end.compareTo(date) >= 0; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
828 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
829 } // class DateRangeFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
830 |
3008
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
831 public static class SectorFilter implements Fixing.Filter { |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
832 |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
833 protected int sector; |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
834 |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
835 public SectorFilter(int sector) { |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
836 this.sector = sector; |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
837 } |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
838 |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
839 @Override |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
840 public boolean accept(Fixing.Column column) { |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
841 for (SectorRange s: column.getSectors()) { |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
842 if (s.getSector() == sector) { |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
843 return true; |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
844 } |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
845 } |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
846 return false; |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
847 } |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
848 } // class SectorFilter |
9e0500d64524
FixA: Calculate the Delta W/ts + the average Delta W/ts per Q sector per analysis period.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3006
diff
changeset
|
849 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
850 public static class SectorRangeFilter implements Fixing.Filter { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
851 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
852 protected int min; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
853 protected int max; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
854 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
855 public SectorRangeFilter(int min, int max) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
856 this.min = Math.min(min, max); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
857 this.max = Math.max(min, max); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
858 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
859 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
860 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
861 public boolean accept(Fixing.Column column) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
862 for (SectorRange s: column.getSectors()) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
863 int v = s.getSector(); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
864 if (v >= min && v <= max) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
865 return true; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
866 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
867 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
868 return false; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
869 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
870 } // class SectorRangeFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
871 |
3006
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
872 public static class KmFilter implements Fixing.Filter { |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
873 |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
874 protected double km; |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
875 |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
876 public KmFilter(double km) { |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
877 this.km = km; |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
878 } |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
879 |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
880 @Override |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
881 public boolean accept(Fixing.Column column) { |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
882 for (SectorRange s: column.getSectors()) { |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
883 if (s.inside(km)) { |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
884 return true; |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
885 } |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
886 } |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
887 return false; |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
888 } |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
889 } // class KmFilter |
1b1af1597401
FixA: Added new km filter
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3002
diff
changeset
|
890 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
891 public void generateOverview(Document document) { |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
892 generateOverview(document, FULL_EXTENT, ACCEPT); |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
893 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
894 |
2608
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2565
diff
changeset
|
895 public List<Fixing.Column> filter(Range range, Fixing.Filter filter) { |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
896 List<Fixing.Column> allColumns = new ArrayList<Fixing.Column>(); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
897 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
898 for (Fixing fixing: fixings) { |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
899 fixing.addAllColumns(allColumns, range, filter); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
900 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
901 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
902 Collections.sort(allColumns, Fixing.DATE_CMP); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
903 |
2608
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2565
diff
changeset
|
904 return allColumns; |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2565
diff
changeset
|
905 } |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2565
diff
changeset
|
906 |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2565
diff
changeset
|
907 public void generateOverview( |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2565
diff
changeset
|
908 Document document, |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2565
diff
changeset
|
909 Range range, |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2565
diff
changeset
|
910 Fixing.Filter filter |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2565
diff
changeset
|
911 ) { |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2565
diff
changeset
|
912 List<Fixing.Column> allColumns = filter(range, filter); |
938e2f6c0c9a
Refactored the code of the fixings filter building to be useful in more cases.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2565
diff
changeset
|
913 |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
914 Element fixingsElement = document.createElement("fixings"); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
915 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
916 Element riverElement = document.createElement("river"); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
917 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
918 riverElement.setAttribute("from", String.valueOf(extent.start)); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
919 riverElement.setAttribute("to", String.valueOf(extent.end)); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
920 riverElement.setAttribute("rid", String.valueOf(riverId)); |
2565
72f77b2210c2
FixingsOverview: Added XSL transformation which directly converts the output of the fixings overview service into an HTML representation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2564
diff
changeset
|
921 riverElement.setAttribute("name", riverName); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
922 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
923 fixingsElement.appendChild(riverElement); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
924 |
2564
3f038d54bc87
FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
925 SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
926 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
927 Element esE = document.createElement("events"); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
928 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
929 for (Fixing.Column column: allColumns) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
930 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
931 List<SectorRange> sectors = column.getSectors(range); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
932 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
933 if (!sectors.isEmpty()) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
934 Element eE = document.createElement("event"); |
2707
d6e32ae72da6
Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2632
diff
changeset
|
935 eE.setAttribute("description", |
d6e32ae72da6
Deliver description on events instead of names in fixing overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2632
diff
changeset
|
936 String.valueOf(column.getDescription())); |
2561
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
937 eE.setAttribute("cid", String.valueOf(column.columnId)); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
938 eE.setAttribute("date", df.format(column.startTime)); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
939 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
940 for (SectorRange sector: sectors) { |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
941 Element sE = document.createElement("sector"); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
942 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
943 sE.setAttribute("from", String.valueOf(sector.start)); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
944 sE.setAttribute("to", String.valueOf(sector.end)); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
945 sE.setAttribute("class", String.valueOf(sector.sector)); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
946 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
947 eE.appendChild(sE); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
948 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
949 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
950 esE.appendChild(eE); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
951 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
952 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
953 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
954 fixingsElement.appendChild(esE); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
955 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
956 document.appendChild(fixingsElement); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
957 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
958 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
959 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |