comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java @ 4623:89322548b044

Set the discharge zone type to be able to generate the appropriate facets.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 03 Dec 2012 17:04:28 +0100
parents cc6323401643
children c7ce7c9e405e
comparison
equal deleted inserted replaced
4622:900064815369 4623:89322548b044
56 List<DischargeZone> zones = new ArrayList<DischargeZone>(); 56 List<DischargeZone> zones = new ArrayList<DischargeZone>();
57 57
58 if (mainIds != null) { 58 if (mainIds != null) {
59 for (int id: mainIds) { 59 for (int id: mainIds) {
60 DischargeZone zone = DischargeZone.getDischargeZoneById(id); 60 DischargeZone zone = DischargeZone.getDischargeZoneById(id);
61 zone.putType("main");
61 62
62 if (zone != null) { 63 if (zone != null) {
63 zones.add(zone); 64 zones.add(zone);
64 } 65 }
65 } 66 }
66 } 67 }
67 68
68 if (totalIds != null) { 69 if (totalIds != null) {
69 for (int id: totalIds) { 70 for (int id: totalIds) {
70 DischargeZone zone = DischargeZone.getDischargeZoneById(id); 71 DischargeZone zone = DischargeZone.getDischargeZoneById(id);
71
72 if (zone != null) { 72 if (zone != null) {
73 zones.add(zone); 73 int ndx = zones.indexOf(zone);
74 if (zones.contains(zone) &&
75 zones.get(ndx).fetchType().equals("main")) {
76 zone.putType("main_total");
77 }
78 else {
79 zone.putType("total");
80 zones.add(zone);
81 }
74 } 82 }
75 } 83 }
76 } 84 }
77 85
78 return zones; 86 return zones;
131 139
132 DischargeZone zone = model.getDischargeZone(); 140 DischargeZone zone = model.getDischargeZone();
133 String lo = zone.getLowerDischarge(); 141 String lo = zone.getLowerDischarge();
134 String hi = zone.getUpperDischarge(); 142 String hi = zone.getUpperDischarge();
135 143
144 data.setType(zone.fetchType());
136 if (lo.equals(hi)) { 145 if (lo.equals(hi)) {
137 data.setZone(lo); 146 data.setZone(lo);
138 } 147 }
139 else { 148 else {
140 data.setZone(lo + " - " + hi); 149 data.setZone(lo + " - " + hi);
150 double kmHi = access.getUpperKM(); 159 double kmHi = access.getUpperKM();
151 160
152 logger.debug("Prepare data for km range: " + kmLo + " - " + kmHi); 161 logger.debug("Prepare data for km range: " + kmLo + " - " + kmHi);
153 162
154 FlowVelocityData[] data = new FlowVelocityData[models.size()]; 163 FlowVelocityData[] data = new FlowVelocityData[models.size()];
155
156 for (int i = 0, n = models.size(); i < n; i++) { 164 for (int i = 0, n = models.size(); i < n; i++) {
157 FlowVelocityData d = new FlowVelocityData(); 165 FlowVelocityData d = new FlowVelocityData();
158 166
159 prepareData(d, models.get(i), kmLo, kmHi); 167 prepareData(d, models.get(i), kmLo, kmHi);
160 168

http://dive4elements.wald.intevation.org