comparison flys-aft/src/main/java/de/intevation/aft/SyncContext.java @ 5188:2b7f44c80857

Stations are now filtered by DiPS not AFT.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 07 Mar 2013 12:46:37 +0100
parents f939e1e6cfa4
children
comparison
equal deleted inserted replaced
5187:eec78b9f73b8 5188:2b7f44c80857
83 return null; 83 return null;
84 } 84 }
85 85
86 public Map<Long, DIPSGauge> getDIPSGauges() { 86 public Map<Long, DIPSGauge> getDIPSGauges() {
87 return numberToGauge; 87 return numberToGauge;
88 }
89
90 public Map<Long, DIPSGauge> getDIPSGauges(
91 String riverName,
92 double from,
93 double to
94 ) {
95 if (from > to) {
96 double t = from;
97 from = to;
98 to = t;
99 }
100
101 riverName = riverName.toLowerCase();
102
103 Map<Long, DIPSGauge> result = new HashMap<Long, DIPSGauge>();
104
105 for (Map.Entry<Long, DIPSGauge> entry: numberToGauge.entrySet()) {
106 DIPSGauge gauge = entry.getValue();
107 // XXX: Maybe a bit too sloppy.
108 if (!riverName.contains(gauge.getRiverName().toLowerCase())) {
109 continue;
110 }
111 double station = gauge.getStation();
112 if (station >= from && station <= to) {
113 result.put(entry.getKey(), gauge);
114 }
115 }
116
117 return result;
88 } 118 }
89 119
90 protected static Map<Long, DIPSGauge> indexByNumber(Document document) { 120 protected static Map<Long, DIPSGauge> indexByNumber(Document document) {
91 Map<Long, DIPSGauge> map = new HashMap<Long, DIPSGauge>(); 121 Map<Long, DIPSGauge> map = new HashMap<Long, DIPSGauge>();
92 NodeList nodes = document.getElementsByTagName("PEGELSTATION"); 122 NodeList nodes = document.getElementsByTagName("PEGELSTATION");

http://dive4elements.wald.intevation.org