Changeset 674 in josm for trunk/src/org
- Timestamp:
- 2008-07-02T23:40:17+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r668 r674 245 245 newSelection.add(wayToAdd); 246 246 247 Boolean warnme=false; 247 248 // now copy all relations to new way also 248 249 for (Relation r : Main.ds.relations) { … … 256 257 em.member = wayToAdd; 257 258 em.role = rm.role; 259 if(em.role.length() > 0) 260 warnme = true; 258 261 c.members.add(em); 259 262 commandList.add(new ChangeCommand(r, c)); 263 break; 260 264 } 261 265 } 262 266 } 263 267 } 268 if(warnme) 269 JOptionPane.showMessageDialog(Main.parent, tr("A role based relation membership was copied to both new ways.\nYou should verify this and correct it when necessary.")); 264 270 } 265 271 -
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r655 r674 12 12 import java.util.HashSet; 13 13 import java.util.HashMap; 14 import java.util.Iterator; 14 15 import java.util.LinkedList; 15 16 import java.util.List; … … 24 25 import org.openstreetmap.josm.data.osm.WaySegment; 25 26 import org.openstreetmap.josm.data.osm.Relation; 27 import org.openstreetmap.josm.data.osm.RelationMember; 26 28 import org.openstreetmap.josm.data.osm.visitor.CollectBackReferencesVisitor; 29 import org.openstreetmap.josm.data.osm.visitor.NameVisitor; 27 30 import org.openstreetmap.josm.gui.MapFrame; 28 31 import org.openstreetmap.josm.tools.*; … … 163 166 * nothing to delete. 164 167 */ 168 private int testRelation(Relation ref, OsmPrimitive osm) 169 { 170 NameVisitor n = new NameVisitor(); 171 ref.visit(n); 172 NameVisitor s = new NameVisitor(); 173 osm.visit(s); 174 String role = new String(); 175 for (RelationMember m : ref.members) 176 { 177 if (m.member == osm) 178 { 179 role = m.role; 180 break; 181 } 182 } 183 if (role.length() > 0) 184 { 185 return JOptionPane.showConfirmDialog(Main.parent, 186 tr("Selection \"{0}\" is used by relation \"{1}\" with role {2}.\nDelete from relation?", s.name, n.name, role), 187 tr("Conflicting relation"), JOptionPane.YES_NO_OPTION); 188 } 189 else 190 { 191 return JOptionPane.showConfirmDialog(Main.parent, 192 tr("Selection \"{0}\" is used by relation \"{1}\".\nDelete from relation?", s.name, n.name), 193 tr("Conflicting relation"), JOptionPane.YES_NO_OPTION); 194 } 195 } 196 165 197 private Command delete(Collection<OsmPrimitive> selection, boolean alsoDeleteNodesInWay) { 166 198 if (selection.isEmpty()) return null; … … 168 200 Collection<OsmPrimitive> del = new HashSet<OsmPrimitive>(selection); 169 201 Collection<Way> waysToBeChanged = new HashSet<Way>(); 202 HashMap<OsmPrimitive, Collection<OsmPrimitive>> relationsToBeChanged = new HashMap<OsmPrimitive, Collection<OsmPrimitive>>(); 170 203 171 204 if (alsoDeleteNodesInWay) { … … 197 230 waysToBeChanged.add((Way) ref); 198 231 } else if (ref instanceof Relation) { 199 JOptionPane.showMessageDialog(Main.parent, 200 tr("Cannot delete: Selection is used by relation")); 201 return null; 232 if (testRelation((Relation)ref, osm) == JOptionPane.YES_OPTION) 233 { 234 Collection<OsmPrimitive> relset = relationsToBeChanged.get(ref); 235 if(relset == null) relset = new HashSet<OsmPrimitive>(); 236 relset.add(osm); 237 relationsToBeChanged.put(ref, relset); 238 } 239 else 240 return null; 202 241 } else { 203 242 return null; … … 218 257 if (del.contains(ref)) continue; 219 258 if (ref instanceof Relation) { 220 JOptionPane.showMessageDialog(Main.parent, 221 tr("Cannot delete: Selection is used by relation")); 259 Boolean found = false; 260 Collection<OsmPrimitive> relset = relationsToBeChanged.get(ref); 261 if (relset == null) 262 relset = new HashSet<OsmPrimitive>(); 263 else 264 { 265 for (OsmPrimitive m : relset) { 266 if(m == w) 267 { 268 found = true; 269 break; 270 } 271 } 272 } 273 if (!found) 274 { 275 if (testRelation((Relation)ref, w) == JOptionPane.YES_OPTION) 276 { 277 relset.add(w); 278 relationsToBeChanged.put(ref, relset); 279 } 280 else 281 return null; 282 } 222 283 } else { 223 284 return null; … … 227 288 cmds.add(new ChangeCommand(w, wnew)); 228 289 } 290 } 291 292 Iterator<OsmPrimitive> iterator = relationsToBeChanged.keySet().iterator(); 293 while(iterator.hasNext()) 294 { 295 Relation cur = (Relation)iterator.next(); 296 Relation rel = new Relation(cur); 297 for(OsmPrimitive osm : relationsToBeChanged.get(cur)) 298 { 299 for (RelationMember rm : rel.members) { 300 if (rm.member == osm) 301 { 302 RelationMember mem = new RelationMember(); 303 mem.role = rm.role; 304 mem.member = rm.member; 305 rel.members.remove(mem); 306 break; 307 } 308 } 309 } 310 cmds.add(new ChangeCommand(cur, rel)); 229 311 } 230 312 -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationEditor.java
r669 r674 147 147 148 148 JLabel help = new JLabel("<html><em>"+ 149 "This is the basic relation editor which allows you to change the relation's tags " +149 tr("This is the basic relation editor which allows you to change the relation's tags " + 150 150 "as well as the members. In addition to this we should have a smart editor that " + 151 "detects the type of relationship and limits your choices in a sensible way. </em></html>");151 "detects the type of relationship and limits your choices in a sensible way.")+"</em></html>"); 152 152 153 153 getContentPane().add(help, BorderLayout.NORTH); … … 224 224 })); 225 225 226 buttonPanel.add(createButton(marktr("Delete Selected"),"deleteselected", tr("Delete all currently selected objects from releation"), KeyEvent.VK_R, new ActionListener() { 227 public void actionPerformed(ActionEvent e) { 228 deleteSelected(); 229 } 230 })); 231 226 232 buttonPanel.add(createButton(marktr("Delete"),"delete", tr("Remove the member in the current table row from this relation"), KeyEvent.VK_D, new ActionListener() { 227 233 public void actionPerformed(ActionEvent e) { … … 259 265 refreshTables(); 260 266 261 setSize(new Dimension( 400, 500));267 setSize(new Dimension(600, 500)); 262 268 setLocationRelativeTo(Main.parent); 263 269 } … … 311 317 refreshTables(); 312 318 } 319 320 private void deleteSelected() { 321 for (OsmPrimitive p : Main.ds.getSelected()) { 322 Relation c = new Relation(clone); 323 for (RelationMember rm : c.members) { 324 if (rm.member == p) 325 { 326 RelationMember mem = new RelationMember(); 327 mem.role = rm.role; 328 mem.member = rm.member; 329 clone.members.remove(mem); 330 } 331 } 332 } 333 refreshTables(); 334 } 335 313 336 private void downloadRelationMembers() { 314 337 -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r627 r674 128 128 originalValue = DIFFERENT; 129 129 } 130 p.add(new JLabel(t ext), GBC.std().insets(0,0,10,0));130 p.add(new JLabel(tr(text)+":"), GBC.std().insets(0,0,10,0)); 131 131 p.add(value, GBC.eol().fill(GBC.HORIZONTAL)); 132 132 } … … 174 174 QuadStateCheckBox.State.NOT_SELECTED : 175 175 QuadStateCheckBox.State.UNSET; 176 check = new QuadStateCheckBox(t ext, initialState,176 check = new QuadStateCheckBox(tr(text), initialState, 177 177 new QuadStateCheckBox.State[] { 178 178 QuadStateCheckBox.State.SELECTED, … … 184 184 // in "partial" state. 185 185 initialState = QuadStateCheckBox.State.PARTIAL; 186 check = new QuadStateCheckBox(t ext, QuadStateCheckBox.State.PARTIAL,186 check = new QuadStateCheckBox(tr(text), QuadStateCheckBox.State.PARTIAL, 187 187 new QuadStateCheckBox.State[] { 188 188 QuadStateCheckBox.State.PARTIAL, … … 236 236 } 237 237 for (int i=0; i<value_array.length; i++) { 238 lhm.put(value_array[i], display_array[i]);238 lhm.put(value_array[i], tr(display_array[i])); 239 239 } 240 240 for (String s : usage.values) { … … 250 250 combo.setSelectedItem(DIFFERENT); originalValue=DIFFERENT; 251 251 } 252 p.add(new JLabel(t ext), GBC.std().insets(0,0,10,0));252 p.add(new JLabel(tr(text)+":"), GBC.std().insets(0,0,10,0)); 253 253 p.add(combo, GBC.eol().fill(GBC.HORIZONTAL)); 254 254 } … … 277 277 278 278 @Override public void addToPanel(JPanel p, Collection<OsmPrimitive> sel) { 279 p.add(new JLabel(t ext), GBC.eol());279 p.add(new JLabel(tr(text)), GBC.eol()); 280 280 } 281 281 @Override public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) {} … … 310 310 */ 311 311 public void setName(String name) { 312 putValue(Action.NAME, name);312 putValue(Action.NAME, tr(name)); 313 313 putValue("toolbar", "tagging_"+name); 314 314 }
Note:
See TracChangeset
for help on using the changeset viewer.