Changeset 3951 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2011-03-04T21:36:49+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r3844 r3951 148 148 149 149 AreaElemStyle area = null; 150 boolean areaStyle = false; 150 151 for (ElemStyle s : styles.generateStyles(r, SCALE, null, false).a) { 151 152 if (s instanceof AreaElemStyle) { 152 153 area = (AreaElemStyle) s; 154 areaStyle = true; 153 155 break; 154 156 } … … 156 158 // If area style was not found for relation then use style of ways 157 159 if (area == null) { 158 errors.add( new TestError(this, Severity.OTHER, tr("No style in multipolygon relation"),159 NO_STYLE_POLYGON, r));160 160 for (Way w : polygon.getOuterWays()) { 161 161 162 for (ElemStyle s : styles.generateStyles( r, SCALE, null, true).a) {162 for (ElemStyle s : styles.generateStyles(w, SCALE, null, true).a) { 163 163 if (s instanceof AreaElemStyle) { 164 164 area = (AreaElemStyle) s; … … 170 170 } 171 171 } 172 if(area == null) 173 errors.add(new TestError(this, Severity.OTHER, tr("No style for multipolygon"), NO_STYLE, r)); 174 else 175 errors.add( new TestError(this, Severity.OTHER, tr("No style in multipolygon relation"), 176 NO_STYLE_POLYGON, r)); 172 177 } 173 178 … … 190 195 } 191 196 } 192 for (Way wOuter : polygon.getOuterWays()) { 193 AreaElemStyle areaOuter = null; 194 for (ElemStyle s : styles.generateStyles(wOuter, SCALE, null, false).a) { 195 if (s instanceof AreaElemStyle) { 196 areaOuter = (AreaElemStyle) s; 197 break; 198 } 199 } 200 if (areaOuter != null && !area.equals(areaOuter)) { 201 List<OsmPrimitive> l = new ArrayList<OsmPrimitive>(); 202 l.add(r); 203 l.add(wOuter); 204 errors.add(new TestError(this, Severity.WARNING, tr("Style for outer way mismatches"), 205 OUTER_STYLE_MISMATCH, l, Collections.singletonList(wOuter))); 206 } 207 } 208 } 209 else { 210 errors.add(new TestError(this, Severity.OTHER, tr("No style for multipolygon"), NO_STYLE, r)); 197 if(!areaStyle) { 198 for (Way wOuter : polygon.getOuterWays()) { 199 AreaElemStyle areaOuter = null; 200 for (ElemStyle s : styles.generateStyles(wOuter, SCALE, null, false).a) { 201 if (s instanceof AreaElemStyle) { 202 areaOuter = (AreaElemStyle) s; 203 break; 204 } 205 } 206 if (areaOuter != null && !area.equals(areaOuter)) { 207 List<OsmPrimitive> l = new ArrayList<OsmPrimitive>(); 208 l.add(r); 209 l.add(wOuter); 210 errors.add(new TestError(this, Severity.WARNING, tr("Style for outer way mismatches"), 211 OUTER_STYLE_MISMATCH, l, Collections.singletonList(wOuter))); 212 } 213 } 214 } 211 215 } 212 216 }
Note:
See TracChangeset
for help on using the changeset viewer.