Mercurial > dive4elements > river
comparison flys-aft/src/main/java/de/intevation/aft/SyncContext.java @ 5379:61bf64b102bc mapgenfix
Merge with default branch
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 22 Mar 2013 11:25:54 +0100 |
parents | 2b7f44c80857 |
children |
comparison
equal
deleted
inserted
replaced
5175:cfc5540a4eec | 5379:61bf64b102bc |
---|---|
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"); |