| 122 | | errors.add(new TestError( |
| 123 | | parentTest, |
| 124 | | Severity.ERROR, |
| 125 | | tr("Duplicated nodes"), |
| 126 | | DUPLICATE_NODE, |
| 127 | | bag.get(tagSet) |
| 128 | | )); |
| | 137 | |
| | 138 | for (String type: types) { |
| | 139 | typeMap.put(type, false); |
| | 140 | } |
| | 141 | |
| | 142 | for (OsmPrimitive p : bag.get(tagSet)) { |
| | 143 | if (p.getType()==OsmPrimitiveType.NODE) { |
| | 144 | Node n = (Node) p; |
| | 145 | List<OsmPrimitive> lp=n.getReferrers(); |
| | 146 | for (OsmPrimitive sp: lp) { |
| | 147 | if (sp.getType()==OsmPrimitiveType.WAY) { |
| | 148 | boolean typed = false; |
| | 149 | Way w=(Way) sp; |
| | 150 | Map<String, String> keys = w.getKeys(); |
| | 151 | for (String type: typeMap.keySet()) { |
| | 152 | if (keys.containsKey(type)) { |
| | 153 | typeMap.put(type, true); |
| | 154 | typed=true; |
| | 155 | } |
| | 156 | } |
| | 157 | if (!typed) typeMap.put("none", true); |
| | 158 | } |
| | 159 | } |
| | 160 | |
| | 161 | } |
| | 162 | } |
| | 163 | |
| | 164 | int nbType=0; |
| | 165 | for (String type: typeMap.keySet()) { |
| | 166 | if (typeMap.get(type)) nbType++; |
| | 167 | } |
| | 168 | |
| | 169 | if (nbType>1) { |
| | 170 | String msg = marktr("Mixed type duplicated nodes"); |
| | 171 | errors.add(new TestError( |
| | 172 | parentTest, |
| | 173 | Severity.ERROR, |
| | 174 | tr("Duplicated nodes"), |
| | 175 | tr(msg), |
| | 176 | msg, |
| | 177 | DUPLICATE_NODE_MIXED, |
| | 178 | bag.get(tagSet) |
| | 179 | )); |
| | 180 | } else if (typeMap.get("highway")) { |
| | 181 | String msg = marktr("Highway duplicated nodes"); |
| | 182 | errors.add(new TestError( |
| | 183 | parentTest, |
| | 184 | Severity.ERROR, |
| | 185 | tr("Duplicated nodes"), |
| | 186 | tr(msg), |
| | 187 | msg, |
| | 188 | DUPLICATE_NODE_HIGHWAY, |
| | 189 | bag.get(tagSet) |
| | 190 | )); |
| | 191 | } else if (typeMap.get("railway")) { |
| | 192 | String msg = marktr("Railway duplicated nodes"); |
| | 193 | errors.add(new TestError( |
| | 194 | parentTest, |
| | 195 | Severity.ERROR, |
| | 196 | tr("Duplicated nodes"), |
| | 197 | tr(msg), |
| | 198 | msg, |
| | 199 | DUPLICATE_NODE_RAILWAY, |
| | 200 | bag.get(tagSet) |
| | 201 | )); |
| | 202 | } else if (typeMap.get("waterway")) { |
| | 203 | String msg = marktr("Waterway duplicated nodes"); |
| | 204 | errors.add(new TestError( |
| | 205 | parentTest, |
| | 206 | Severity.ERROR, |
| | 207 | tr("Duplicated nodes"), |
| | 208 | tr(msg), |
| | 209 | msg, |
| | 210 | DUPLICATE_NODE_WATERWAY, |
| | 211 | bag.get(tagSet) |
| | 212 | )); |
| | 213 | } else if (typeMap.get("boundary")) { |
| | 214 | String msg = marktr("Boundary duplicated nodes"); |
| | 215 | errors.add(new TestError( |
| | 216 | parentTest, |
| | 217 | Severity.ERROR, |
| | 218 | tr("Duplicated nodes"), |
| | 219 | tr(msg), |
| | 220 | msg, |
| | 221 | DUPLICATE_NODE_BOUNDARY, |
| | 222 | bag.get(tagSet) |
| | 223 | )); |
| | 224 | } else if (typeMap.get("power")) { |
| | 225 | String msg = marktr("Power duplicated nodes"); |
| | 226 | errors.add(new TestError( |
| | 227 | parentTest, |
| | 228 | Severity.ERROR, |
| | 229 | tr("Duplicated nodes"), |
| | 230 | tr(msg), |
| | 231 | msg, |
| | 232 | DUPLICATE_NODE_POWER, |
| | 233 | bag.get(tagSet) |
| | 234 | )); |
| | 235 | } else { |
| | 236 | errors.add(new TestError( |
| | 237 | parentTest, |
| | 238 | Severity.ERROR, |
| | 239 | tr("Duplicated nodes"), |
| | 240 | DUPLICATE_NODE, |
| | 241 | bag.get(tagSet) |
| | 242 | )); |
| | 243 | |
| | 244 | } |