Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java @ 2592:26cd4dfafdf1
Removed useless imports.
flys-artifacts/trunk@4149 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 16 Mar 2012 07:07:32 +0000 |
parents | 72f77b2210c2 |
children | 938e2f6c0c9a |
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 |
2564
3f038d54bc87
FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
33 public static final String DATE_FORMAT = "dd.MM.yyyy HH:mm"; |
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 Range 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
|
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 protected double 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
|
120 protected double 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
|
121 |
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 public 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
|
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 |
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 public Range(double start, double 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
|
126 this.start = 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
|
127 this.end = 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
|
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 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
130 public double getStart() { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
131 return start; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
132 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
133 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
134 public double getEnd() { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
135 return end; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
136 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
137 |
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
|
138 public boolean disjoint(Range 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
|
139 return start > other.end || other.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
|
140 } |
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 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
142 public boolean intersects(Range other) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
143 return !disjoint(other); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
144 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
145 |
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
|
146 public void extend(Range other) { |
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
|
147 if (other.start < start) start = other.start; |
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
|
148 if (other.end > end ) end = other.end; |
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
|
149 } |
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
|
150 |
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
|
151 public boolean clip(Range 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
|
152 if (disjoint(other)) 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
|
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 if (other.start > start) start = other.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
|
155 if (other.end < end ) 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
|
156 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
157 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
|
158 } |
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 public boolean inside(double x) { |
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 return x > start-EPSILON && x < end+EPSILON; |
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 } // class 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
|
164 |
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 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
|
166 |
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 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
|
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 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
|
170 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
|
171 |
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 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
|
173 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
|
174 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
|
175 } |
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 |
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 } // 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
|
178 |
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 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
|
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 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
|
182 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
|
183 |
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 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
|
185 } |
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 |
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 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
|
188 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
|
189 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
|
190 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
|
191 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
|
192 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
193 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
194 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
|
195 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
|
196 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
|
197 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
|
198 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
199 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
|
200 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
201 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
202 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
|
203 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
|
204 if (v == 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
|
205 log.warn("Missing main 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
|
206 + 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
|
207 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
208 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
|
209 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
210 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
217 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
|
218 { 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
|
219 { 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
|
220 { 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
|
221 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
222 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
|
223 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
|
224 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
|
225 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
|
226 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
|
227 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
228 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
229 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
230 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
231 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
|
232 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
|
233 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
|
234 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
|
235 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
236 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
237 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
|
238 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
239 } // 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
|
240 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
241 public static class GaugeFinder { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
242 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
243 protected List<GaugeRange> gauges; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
244 protected boolean isKmUp; |
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 public GaugeFinder(List<GaugeRange> gauges) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
247 this(gauges, true); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
248 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
249 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
250 public GaugeFinder( |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
251 List<GaugeRange> gauges, |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
252 boolean isKmUp |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
253 ) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
254 this.gauges = gauges; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
255 this.isKmUp = isKmUp; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
256 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
257 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
258 public boolean getIsKmUp() { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
259 return isKmUp; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
260 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
261 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
262 public void setIsKmUp(boolean isKmUp) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
263 this.isKmUp = isKmUp; |
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 public GaugeRange find(Range range) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
267 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
|
268 for (GaugeRange gauge: gauges) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
269 if (gauge.inside(km)) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
270 return gauge; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
271 } |
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 return null; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
274 } |
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 public GaugeRange find(int gaugeId) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
277 for (GaugeRange gauge: gauges) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
278 if (gauge.gaugeId == gaugeId) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
279 return gauge; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
280 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
281 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
282 return null; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
283 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
284 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
285 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
|
286 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
287 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
|
288 .addScalar("gauge_id", StandardBasicTypes.INTEGER) |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
289 .addScalar("name", StandardBasicTypes.STRING) |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
290 .addScalar("value", StandardBasicTypes.DOUBLE); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
291 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
292 query.setInteger("river_id", riverId); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
293 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
294 List<Object []> list = query.list(); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
295 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
296 if (list.isEmpty()) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
297 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
|
298 return false; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
299 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
300 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
301 GaugeRange gauge = null; |
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 for (Object [] row: list) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
304 int gaugeId = (Integer)row[0]; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
305 String label = (String) row[1]; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
306 Double value = (Double) row[2]; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
307 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
308 if (gauge == null || gauge.gaugeId != gaugeId) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
309 if ((gauge = find(gaugeId)) == null) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
310 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
|
311 continue; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
312 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
313 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
314 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
315 gauge.addMainValue(label, value); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
316 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
317 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
318 for (GaugeRange g: gauges) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
319 g.buildClasses(); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
320 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
321 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
322 return true; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
323 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
324 } // class GaugeFinder |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
325 |
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
|
326 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
|
327 |
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 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
|
329 |
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 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
|
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 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
333 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
|
334 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
|
335 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
|
336 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
337 } // 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
|
338 |
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 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
|
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 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
|
342 |
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 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
|
344 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
345 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
346 public SectorRange(SectorRange other) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
347 start = other.start; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
348 end = other.end; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
349 sector = other.sector; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
350 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
351 |
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
|
352 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
|
353 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
|
354 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
|
355 } |
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 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
357 public int getSector() { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
358 return sector; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
359 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
360 |
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
|
361 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
|
362 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
|
363 && 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
|
364 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
|
365 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
|
366 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
367 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
|
368 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
369 } // 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
|
370 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
371 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
|
372 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
373 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
|
374 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
|
375 @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
|
376 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
|
377 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
|
378 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
379 }; |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
380 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
381 public interface Filter { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
382 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
383 boolean accept(Column column); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
384 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
385 } // interface Filter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
386 |
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
|
387 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
|
388 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
389 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
|
390 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
|
391 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
|
392 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
393 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
|
394 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
395 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
|
396 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
397 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
398 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
|
399 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
|
400 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
|
401 this.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
|
402 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
403 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
|
404 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
405 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
406 public int getId() { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
407 return columnId; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
408 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
409 |
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
|
410 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
|
411 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
|
412 } |
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 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
414 public Date getStartTime() { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
415 return startTime; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
416 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
417 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
418 public String getName() { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
419 return name; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
420 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
421 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
422 public List<SectorRange> getSectors() { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
423 return sectors; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
424 } |
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
|
425 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
426 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
|
427 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
428 List<SectorRange> result = |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
429 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
|
430 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
431 for (SectorRange src: sectors) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
432 SectorRange dst = new SectorRange(src); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
433 if (dst.clip(range)) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
434 result.add(dst); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
435 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
436 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
437 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
438 return result; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
439 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
440 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
441 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
|
442 |
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 (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
|
444 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
|
445 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
|
446 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
|
447 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
|
448 || !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
|
449 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
|
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 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
452 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
453 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
454 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
|
455 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
|
456 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
457 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
|
458 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
459 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
|
460 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
|
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 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
|
463 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
|
464 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
|
465 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
|
466 } |
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 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
469 public void loadQRanges( |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
470 SQLQuery query, |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
471 GaugeFinder gaugeFinder |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
472 ) { |
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
|
473 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
|
474 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
|
475 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
476 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
|
477 |
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
|
478 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
|
479 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
|
480 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
|
481 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
|
482 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
|
483 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
|
484 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
|
485 } |
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 } |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
487 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
488 GaugeRange gauge = gaugeFinder.find(this); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
489 |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
490 if (gauge != null) { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
491 buildSectors(gauge, qRanges); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
492 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
493 else { |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
494 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
|
495 } |
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
|
496 } |
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 } // 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
|
498 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
499 protected int wstId; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
500 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
|
501 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
|
502 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
503 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
|
504 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
505 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
506 public int getId() { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
507 return wstId; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
508 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
509 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
510 public String getDescription() { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
511 return description; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
512 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
513 |
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 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
|
515 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
|
516 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
|
517 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
|
518 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
519 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
520 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
|
521 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
|
522 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
|
523 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
|
524 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
|
525 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
|
526 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
|
527 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
|
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 } |
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 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
|
532 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
|
533 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
|
534 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
535 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
536 |
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
|
537 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
|
538 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
|
539 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
|
540 } |
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
|
541 } |
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
|
542 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
543 public void loadColumnsQRanges( |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
544 SQLQuery query, |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
545 GaugeFinder gaugeFinder |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
546 ) { |
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
|
547 for (Column column: columns) { |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
548 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
|
549 } |
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 } |
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 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
552 public void addAllColumns( |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
553 List<Column> allColumns, |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
554 Range range, |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
555 Filter filter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
556 ) { |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
557 for (Column column: columns) { |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
558 if (column.intersects(range) && filter.accept(column)) { |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
559 allColumns.add(column); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
560 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
561 } |
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
|
562 } |
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 } // 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
|
564 |
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 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
566 protected String riverName; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
567 protected int riverId; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
568 protected boolean isKmUp; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
569 protected List<Fixing> fixings; |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
570 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
|
571 |
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 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
|
573 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
|
574 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
|
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 |
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 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
|
578 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
|
579 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
|
580 } |
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 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
582 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
|
583 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
|
584 .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
|
585 .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
|
586 |
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 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
|
588 |
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 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
|
590 |
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 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
|
592 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
|
593 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
|
594 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
595 |
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 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
|
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 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
|
599 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
|
600 |
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 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
|
602 } |
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 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
604 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
|
605 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
|
606 .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
|
607 .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
|
608 .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
|
609 |
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 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
|
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 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
|
613 |
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 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
|
615 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
|
616 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
|
617 } |
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 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
619 List<GaugeRange> gauges = new ArrayList<GaugeRange>(); |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
620 |
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
|
621 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
|
622 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
|
623 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
|
624 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
|
625 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
|
626 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
|
627 } |
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 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
629 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
|
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 |
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 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
|
634 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
|
635 .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
|
636 .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
|
637 |
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 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
|
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 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
|
641 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
642 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
|
643 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
|
644 // 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
|
645 } |
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 |
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 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
|
648 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
|
649 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
|
650 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
|
651 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
|
652 } |
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 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
|
656 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
|
657 .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
|
658 .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
|
659 .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
|
660 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
661 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
|
662 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
|
663 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
664 } |
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 |
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 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
|
667 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
|
668 .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
|
669 .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
|
670 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
671 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
|
672 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
|
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 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
676 protected void loadFixingsColumnsQRanges( |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
677 Session session, |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
678 GaugeFinder gaugeFinder |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
679 ) { |
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
|
680 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
|
681 .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
|
682 .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
|
683 .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
|
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 for (Fixing fixing: fixings) { |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
686 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
|
687 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
688 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
689 |
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
|
690 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
|
691 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
|
692 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
|
693 } |
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
|
694 } |
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
|
695 |
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
|
696 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
|
697 |
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
|
698 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
|
699 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
|
700 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
701 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
702 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
|
703 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
704 if (gaugeFinder == null |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
705 || !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
|
706 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
|
707 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
708 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
709 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
|
710 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
|
711 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
|
712 |
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
|
713 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
|
714 |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
715 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
|
716 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
717 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
|
718 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
719 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
720 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
|
721 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
|
722 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
723 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
|
724 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
725 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
|
726 return true; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
727 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
728 }; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
729 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
730 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
|
731 protected Fixing.Filter child; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
732 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
733 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
|
734 this.child = child; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
735 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
736 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
737 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
738 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
|
739 return !child.accept(column); |
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 } // class NotFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
742 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
743 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
|
744 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
|
745 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
746 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
|
747 this.children = children; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
748 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
749 } // class ComponentFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
750 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
751 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
|
752 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
753 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
|
754 super(children); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
755 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
756 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
757 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
758 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
|
759 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
|
760 if (child.accept(column)) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
761 return true; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
762 } |
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 return false; |
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 } // class OrFilter |
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 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
|
769 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
770 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
|
771 super(children); |
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 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
|
777 if (!child.accept(column)) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
778 return false; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
779 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
780 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
781 return true; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
782 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
783 } // class AndFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
784 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
785 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
|
786 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
787 protected int columnId; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
788 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
789 public IdFilter(int columnId) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
790 this.columnId = columnId; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
791 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
792 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
793 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
794 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
|
795 return column.getId() == columnId; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
796 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
797 } // class IdFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
798 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
799 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
|
800 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
801 protected Date date; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
802 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
803 public DateFilter(Date date) { |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
804 this.date = date; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
805 } |
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 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
808 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
|
809 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
|
810 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
811 } // class DateFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
812 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
813 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
|
814 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
815 protected Date start; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
816 protected Date end; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
817 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
818 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
|
819 this.start = start; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
820 this.end = end; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
821 } |
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 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
824 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
|
825 Date date = column.getStartTime(); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
826 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
|
827 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
828 } // class DateRangeFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
829 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
830 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
|
831 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
832 protected int min; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
833 protected int max; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
834 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
835 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
|
836 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
|
837 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
|
838 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
839 |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
840 @Override |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
841 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
|
842 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
|
843 int v = s.getSector(); |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
844 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
|
845 return true; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
846 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
847 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
848 return false; |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
849 } |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
850 } // class SectorRangeFilter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
851 |
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
|
852 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
|
853 generateOverview(document, FULL_EXTENT, ACCEPT); |
2562
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
854 } |
ba35dfb7c09a
FixingsOverview: Construct the Q sectors once.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2561
diff
changeset
|
855 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
856 public void generateOverview( |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
857 Document document, |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
858 Range range, |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
859 Fixing.Filter filter |
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
860 ) { |
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
|
861 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
|
862 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
863 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
|
864 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
|
865 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
866 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
867 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
|
868 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
869 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
|
870 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
871 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
|
872 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
873 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
|
874 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
|
875 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
|
876 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
|
877 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
878 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
|
879 |
2564
3f038d54bc87
FixingsOverviewService: Made the filter mechanisms available via the incoming XML document.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
880 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
|
881 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
882 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
|
883 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
884 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
|
885 |
2563
59c920e73d8a
FixingsOverview: Added a filter mechanism for generating output.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2562
diff
changeset
|
886 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
|
887 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
888 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
|
889 Element eE = document.createElement("event"); |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
890 eE.setAttribute("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
|
891 String.valueOf(column.getFixing().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
|
892 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
|
893 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
|
894 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
895 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
|
896 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
|
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 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
|
899 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
|
900 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
|
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 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
|
903 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
904 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
905 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
|
906 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
907 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
908 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
909 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
|
910 |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
911 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
|
912 } |
b3f6d49cdc80
Service to generate the data needed to build the "Fixerungen pro Fluss Uebersicht"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
913 } |
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |