Changeset 32398 in osm for applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java
- Timestamp:
- 2016-06-25T11:56:57+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java
r32395 r32398 60 60 boolean wont = false; 61 61 for (RelationMember m : r.getMembers()) { 62 if (m.isWay() ) {62 if (m.isWay()) { 63 63 ways.add(m.getWay()); 64 64 } else { … … 67 67 } 68 68 if (wont) { 69 JOptionPane.showMessageDialog(Main.parent, tr("Multipolygon must consist only of ways"), tr("Reconstruct polygon"), JOptionPane.ERROR_MESSAGE); 69 JOptionPane.showMessageDialog(Main.parent, 70 tr("Multipolygon must consist only of ways"), tr("Reconstruct polygon"), JOptionPane.ERROR_MESSAGE); 70 71 return; 71 72 } … … 79 80 80 81 if (!mpc.innerWays.isEmpty()) { 81 JOptionPane.showMessageDialog(Main.parent, tr("Reconstruction of polygons can be done only from outer ways"), tr("Reconstruct polygon"), JOptionPane.ERROR_MESSAGE); 82 JOptionPane.showMessageDialog(Main.parent, 83 tr("Reconstruction of polygons can be done only from outer ways"), tr("Reconstruct polygon"), JOptionPane.ERROR_MESSAGE); 82 84 return; 83 85 } … … 86 88 List<Way> newSelection = new ArrayList<>(); 87 89 List<Command> commands = new ArrayList<>(); 88 Command c = DeleteCommand.delete(Main. main.getEditLayer(), Collections.singleton(r), true, true);89 if (c == null )90 Command c = DeleteCommand.delete(Main.getLayerManager().getEditLayer(), Collections.singleton(r), true, true); 91 if (c == null) 90 92 return; 91 93 commands.add(c); … … 106 108 } 107 109 List<OsmPrimitive> referrers = w.getReferrers(); 108 for (Iterator<OsmPrimitive> ref1 = relations.iterator(); ref1.hasNext(); )109 if (!referrers.contains(ref1.next()) ) {110 for (Iterator<OsmPrimitive> ref1 = relations.iterator(); ref1.hasNext();) { 111 if (!referrers.contains(ref1.next())) { 110 112 ref1.remove(); 111 113 } 114 } 112 115 } 113 116 tags.putAll(r.getKeys()); … … 123 126 keys.removeAll(IRRELEVANT_KEYS); 124 127 if (keys.isEmpty()) { 125 if (candidateWay == null ) {128 if (candidateWay == null) { 126 129 candidateWay = w; 127 130 } else { … … 149 152 Main.main.undoRedo.add(new SequenceCommand(tr("Reconstruct polygons from relation {0}", 150 153 r.getDisplayName(DefaultNameFormatter.getInstance())), commands)); 151 Main. main.getCurrentDataSet().setSelected(newSelection);154 Main.getLayerManager().getEditDataSet().setSelected(newSelection); 152 155 } 153 156 … … 158 161 159 162 private boolean isSuitableRelation(Relation newRelation) { 160 if (newRelation == null || !"multipolygon".equals(newRelation.get("type")) || newRelation.getMembersCount() == 0 )163 if (newRelation == null || !"multipolygon".equals(newRelation.get("type")) || newRelation.getMembersCount() == 0) 161 164 return false; 162 165 else { 163 for (RelationMember m : newRelation.getMembers() )164 if ("inner".equals(m.getRole()) )166 for (RelationMember m : newRelation.getMembers()) { 167 if ("inner".equals(m.getRole())) 165 168 return false; 169 } 166 170 return true; 167 171 }
Note:
See TracChangeset
for help on using the changeset viewer.
