- Timestamp:
- 2013-12-31T12:05:47+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r6569 r6575 36 36 import org.openstreetmap.josm.tools.Pair; 37 37 import org.openstreetmap.josm.tools.Shortcut; 38 import org.openstreetmap.josm.tools.Utils;39 38 40 39 /** … … 147 146 // add ways of existing relation to include them in polygon analysis 148 147 selectedWays = new HashSet<Way>(selectedWays); 149 selectedWays.addAll( Utils.filteredCollection(selectedMultipolygonRelation.getMemberPrimitives(),Way.class));148 selectedWays.addAll(selectedMultipolygonRelation.getMemberPrimitives(Way.class)); 150 149 } 151 150 -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r6564 r6575 397 397 } 398 398 399 public <T extends OsmPrimitive> Collection<T> getMemberPrimitives(Class<T> tClass) { 400 return Utils.filteredCollection(getMemberPrimitives(), tClass); 401 } 402 399 403 public List<OsmPrimitive> getMemberPrimitivesList() { 400 404 return Utils.transform(getMembers(), new Utils.Function<RelationMember, OsmPrimitive>() { -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r6494 r6575 15 15 16 16 import org.openstreetmap.josm.Main; 17 import org.openstreetmap.josm.actions.CreateMultipolygonAction; 17 18 import org.openstreetmap.josm.data.osm.Node; 18 19 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 28 29 import org.openstreetmap.josm.data.validation.Test; 29 30 import org.openstreetmap.josm.data.validation.TestError; 31 import org.openstreetmap.josm.gui.DefaultNameFormatter; 30 32 import org.openstreetmap.josm.gui.mappaint.AreaElemStyle; 31 33 import org.openstreetmap.josm.gui.mappaint.ElemStyles; 32 34 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 33 35 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 36 import org.openstreetmap.josm.tools.Pair; 34 37 35 38 /** … … 176 179 } 177 180 178 for (RelationMember rm : r.getMembers()) { 179 if (!rm.getMember().isUsable()) 180 return; // Rest of checks is only for complete multipolygons 181 if (r.hasIncompleteMembers()) { 182 return; // Rest of checks is only for complete multipolygons 183 } 184 185 // Create new multipolygon using the logics from CreateMultipolygonAction and see if roles match. 186 final Pair<Relation, Relation> newMP = CreateMultipolygonAction.createMultipolygonRelation( 187 r.getMemberPrimitives(Way.class), Collections.singleton(new Relation())); 188 if (newMP != null) { 189 for (RelationMember member : r.getMembers()) { 190 final Collection<RelationMember> memberInNewMP = newMP.b.getMembersFor(Collections.singleton(member.getMember())); 191 if (memberInNewMP != null && !memberInNewMP.isEmpty()) { 192 final String roleInNewMP = memberInNewMP.iterator().next().getRole(); 193 if (!member.getRole().equals(roleInNewMP)) { 194 addError(r, new TestError(this, Severity.WARNING, tr("Role for ''{0}'' should be ''{1}''", 195 member.getMember().getDisplayName(DefaultNameFormatter.getInstance()), roleInNewMP), 196 WRONG_MEMBER_ROLE, Collections.singleton(r), Collections.singleton(member.getMember()))); 197 } 198 } 199 } 200 181 201 } 182 202
Note:
See TracChangeset
for help on using the changeset viewer.