Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/HYKFactory.java @ 2139:923256599afe
Somewhat improved hyk handling and rendering.
flys-artifacts/trunk@3717 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 19 Jan 2012 12:52:44 +0000 |
parents | 04b6b6a4564d |
children | 345a236f7075 |
rev | line source |
---|---|
2131
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import java.math.BigDecimal; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import net.sf.ehcache.Cache; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 import net.sf.ehcache.Element; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import org.apache.log4j.Logger; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import org.hibernate.Query; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import org.hibernate.Session; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.model.HYKFormation; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.flys.model.HYKFlowZone; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.artifacts.cache.CacheFactory; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.flys.backend.SessionHolder; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 /** |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 * Factory to access HYKs (hydrographic values). |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 */ |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 public class HYKFactory |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 { |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 private static Logger logger = Logger.getLogger(HYKFactory.class); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 public static String HYK_CACHE_NAME = "hykache"; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 /** Do not instantiate a HYKFactory. */ |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 private HYKFactory() { |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 /** |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 * Get List of Zones for given river and km. |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 */ |
2139
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
42 public static Object getHYKs(int hykid, double km) { |
2131
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 logger.debug("HYKFactory.getHYKs"); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 Cache cache = CacheFactory.getCache(HYK_CACHE_NAME); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 String cacheKey; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 if (cache != null) { |
2139
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
50 cacheKey = "" + hykid + "_" + km; |
2131
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 Element element = cache.get(cacheKey); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 if (element != null) { |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 logger.debug("Got hyk from cache"); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 return (List<Zone>)element.getValue(); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 else { |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 cacheKey = null; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 |
2139
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
61 List<Zone> zones = getZonesUncached(hykid, km); |
2131
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 if (zones != null && cacheKey != null) { |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 logger.debug("Store hykzones in cache."); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 Element element = new Element(cacheKey, zones); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 cache.put(element); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 return zones; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 |
2139
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
73 public static String getHykName(int hykid) { |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
74 logger.debug("HYKFactory.getHykName " + hykid); |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
75 |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
76 Session session = SessionHolder.HOLDER.get(); |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
77 |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
78 // TODO respect interval better. respect multiples (sort, limit), |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
79 // TODO respect flow direction of river. |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
80 Query query = session.createQuery( |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
81 "select description from HYK where id = :hykid "); |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
82 query.setParameter("hykid", hykid); |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
83 |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
84 return (String) query.uniqueResult(); |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
85 } |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
86 |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
87 |
2131
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 /** |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 * |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 * @param column the position columns value |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 * @param wst_id database id of the wst |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 * @return according WKms. |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 */ |
2137
04b6b6a4564d
Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2131
diff
changeset
|
94 // TODO we also need to know the HYK-id to specify which set we are |
04b6b6a4564d
Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2131
diff
changeset
|
95 // inspecting. |
2139
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
96 public static List<Zone> getZonesUncached(int hykid, double km) { |
2131
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 if (logger.isDebugEnabled()) { |
2139
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
99 logger.debug("HYKFactory.getZoneUncached " + hykid + " km " + km); |
2131
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 Session session = SessionHolder.HOLDER.get(); |
2137
04b6b6a4564d
Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2131
diff
changeset
|
103 |
04b6b6a4564d
Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2131
diff
changeset
|
104 // TODO respect interval better. respect multiples (sort, limit), |
04b6b6a4564d
Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2131
diff
changeset
|
105 // TODO respect flow direction of river. |
2131
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 Query query = session.createQuery( |
2139
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
107 "from HYKFormation where entry.HYK.id = :hykid " + |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
108 " and :km between entry.km - cast(distance_vl/1000.0 + 0.001 as big_decimal) and " + |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
109 " entry.km + cast(distance_vl/1000.0 + 0.001 as big_decimal)" + |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
110 " order by entry.km asc"); |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
111 query.setParameter("hykid", hykid); |
2131
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 query.setParameter("km", new BigDecimal(km)); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 logger.debug("Big km " + new BigDecimal(km)); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
114 List<HYKFormation> forms = query.list(); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 List<Zone> zones = new ArrayList<Zone>(); |
2139
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
117 // TODO limit query by one; sensible sorting. |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
118 // Take the first one. |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
119 if (forms.size() >= 1) { |
923256599afe
Somewhat improved hyk handling and rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2137
diff
changeset
|
120 HYKFormation form = forms.get(0); |
2131
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
121 // Create respective zones. |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 for (HYKFlowZone flowZone: form.getZones()) { |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 Zone z = new Zone(flowZone.getA().doubleValue(), |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 flowZone.getB().doubleValue(), |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 flowZone.getType().getName()); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 zones.add(z); |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
130 return zones; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
133 /** Labelled section. */ |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
134 public static class Zone { |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
135 /** Lower end of segment. */ |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 protected double from; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 /** Upper end of segment. */ |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 protected double to; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 /** The label. */ |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 protected String name; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
142 /** Constructor for labelled section. */ |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 public Zone (double from, double to, String name) { |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 this.from = from; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
145 this.to = to; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
146 this.name = name; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
147 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
148 |
2137
04b6b6a4564d
Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2131
diff
changeset
|
149 /** Get upper value. */ |
04b6b6a4564d
Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2131
diff
changeset
|
150 public double getTo() { |
04b6b6a4564d
Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2131
diff
changeset
|
151 return to; |
04b6b6a4564d
Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2131
diff
changeset
|
152 } |
04b6b6a4564d
Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2131
diff
changeset
|
153 |
04b6b6a4564d
Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2131
diff
changeset
|
154 /** Get lower value. */ |
2131
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 public double getFrom() { |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 return from; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 |
2137
04b6b6a4564d
Prepare improved hyk-handling.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2131
diff
changeset
|
159 /** Get name (type). */ |
2131
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
160 public String getName() { |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
161 return name; |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
162 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 } // public static class Zone |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
164 } |
e50a928187cd
Added stubby hyk infrastructure.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
165 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |