Changeset 1444 in josm
- Timestamp:
- 2009-02-25T14:21:24+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r1443 r1444 9 9 import java.awt.Color; 10 10 import java.awt.Cursor; 11 import java.awt.EventQueue; 11 12 import java.awt.Graphics; 12 13 import java.awt.Graphics2D; … … 59 60 */ 60 61 public class DrawAction extends MapMode implements MapViewPaintable, SelectionChangedListener, AWTEventListener { 61 62 final private Cursor cursorCrosshair; 63 final private Cursor cursorJoinNode; 64 final private Cursor cursorJoinWay; 65 enum Cursors { crosshair, node, way } 66 private Cursors currCursor = Cursors.crosshair; 67 62 68 private static Node lastUsedNode = null; 63 69 private double PHI=Math.toRadians(90); … … 88 94 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( 89 95 Shortcut.registerShortcut("mapmode:drawfocus", tr("Mode: Draw Focus"), KeyEvent.VK_N, Shortcut.GROUP_EDIT).getKeyStroke(), tr("Draw")); 96 97 cursorCrosshair = getCursor(); 98 cursorJoinNode = ImageProvider.getCursor("crosshair", "joinnode"); 99 cursorJoinWay = ImageProvider.getCursor("crosshair", "joinway"); 90 100 } 91 101 … … 99 109 100 110 /** 101 * Sets a special cursor to indicate that the next click will automatically join into 102 * an existing node or way (if feature is enabled) 103 * 104 * @param way If true, the cursor will indicate it is joined into a way; node otherwise 105 */ 106 private void setJoinCursor(boolean way) { 107 if(!drawTargetCursor) { 108 resetCursor(); 109 return; 110 } 111 * Displays the given cursor instead of the normal one 112 * @param Cursors One of the available cursors 113 */ 114 private void setCursor(final Cursors c) { 115 if(currCursor.equals(c) || (!drawTargetCursor && currCursor.equals(Cursors.crosshair))) 116 return; 111 117 try { 112 Main.map.mapView.setCursor( 113 ImageProvider.getCursor("crosshair", (way ? "joinway" : "joinnode")) 114 ); 115 return; 116 } catch (Exception e) { 117 e.printStackTrace(); 118 } 119 resetCursor(); 120 } 121 122 /** 123 * Resets the cursor to the default cursor for drawing mode (i.e. crosshair) 124 */ 125 private void resetCursor() { 126 Main.map.mapView.setCursor(getCursor()); 118 // We invoke this to prevent strange things from happening 119 EventQueue.invokeLater(new Runnable() { 120 public void run() { 121 switch(c) { 122 case way: 123 Main.map.mapView.setCursor(cursorJoinWay); 124 break; 125 case node: 126 Main.map.mapView.setCursor(cursorJoinNode); 127 break; 128 default: 129 Main.map.mapView.setCursor(cursorCrosshair); 130 break; 131 } 132 } 133 }); 134 currCursor = c; 135 } catch(Exception e) {} 136 } 137 138 private void redrawIfRequired() { 139 if ((!drawHelperLine || wayIsFinished) && !drawTargetHighlight) return; 140 Main.map.mapView.repaint(); 127 141 } 128 142 … … 135 149 // if ctrl key is held ("no join"), don't highlight anything 136 150 if (ctrl) { 137 resetCursor();151 setCursor(Cursors.crosshair); 138 152 return; 139 153 } … … 144 158 145 159 if (mouseOnExistingNode != null) { 146 set JoinCursor(false);160 setCursor(Cursors.node); 147 161 // We also need this list for the statusbar help text 148 162 oldHighlights.add(mouseOnExistingNode); … … 154 168 // Insert the node into all the nearby way segments 155 169 if(mouseOnExistingWays.size() == 0) { 156 resetCursor();157 return; 158 } 159 160 set JoinCursor(true);170 setCursor(Cursors.crosshair); 171 return; 172 } 173 174 setCursor(Cursors.way); 161 175 162 176 // We also need this list for the statusbar help text … … 219 233 return; 220 234 updateKeyModifiers((InputEvent) event); 235 computeHelperLine(); 221 236 addHighlighting(); 222 computeHelperLine();237 redrawIfRequired(); 223 238 } 224 239 /** … … 229 244 return; 230 245 computeHelperLine(); 246 addHighlighting(); 247 redrawIfRequired(); 231 248 } 232 249 … … 247 264 248 265 // Redraw to remove the helper line stub 266 computeHelperLine(); 249 267 removeHighlighting(); 250 computeHelperLine(); 251 Main.map.mapView.repaint(); 268 redrawIfRequired(); 252 269 } 253 270 … … 477 494 computeHelperLine(); 478 495 removeHighlighting(); 479 Main.map.mapView.repaint();496 redrawIfRequired(); 480 497 } 481 498 … … 550 567 mousePos = e.getPoint(); 551 568 569 computeHelperLine(); 552 570 addHighlighting(); 553 computeHelperLine();571 redrawIfRequired(); 554 572 } 555 573 … … 663 681 Main.map.statusLine.setDist(distance); 664 682 updateStatusLine(); 665 666 if ((!drawHelperLine || wayIsFinished) && !drawTargetHighlight) return;667 Main.map.mapView.repaint();668 683 } 669 684 -
trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java
r1424 r1444 65 65 Map<String, String> colorKeyList = new TreeMap<String, String>(); 66 66 Map<String, String> colorKeyList_mappaint = new TreeMap<String, String>(); 67 Map<String, String> colorKeyList_layer = new TreeMap<String, String>(); 67 68 for(String key : colorMap.keySet()) { 68 if(key.startsWith("mappaint.")) 69 if(key.startsWith("layer ")) 70 colorKeyList_layer.put(getName(key), key); 71 else if(key.startsWith("mappaint.")) 69 72 colorKeyList_mappaint.put(getName(key), key); 70 73 else … … 78 81 } 79 82 for (Entry<String, String> k : colorKeyList_mappaint.entrySet()) { 83 Vector<Object> row = new Vector<Object>(2); 84 row.add(k.getValue()); 85 row.add(ColorHelper.html2color(colorMap.get(k.getValue()))); 86 tableModel.addRow(row); 87 } 88 for (Entry<String, String> k : colorKeyList_layer.entrySet()) { 80 89 Vector<Object> row = new Vector<Object>(2); 81 90 row.add(k.getValue()); … … 113 122 } 114 123 catch (Exception e) {} 124 try 125 { 126 Matcher m = Pattern.compile("layer (.+)").matcher(o); 127 m.matches(); 128 return tr("Layer: {0}", tr(m.group(1))); 129 } 130 catch (Exception e) {} 115 131 return tr(o); 116 132 } -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r1425 r1444 75 75 */ 76 76 private String parseNotes = new String(); 77 private int parseNotesCount = 0; 77 78 public String getParseNotes() { 78 79 return parseNotes; … … 373 374 Node n = findNode(id); 374 375 if (n == null) { 375 parseNotes += tr("Skipping a way because it includes a node that doesn''t exist: {0}\n", id); 376 /* don't report ALL of them, just a few */ 377 if (parseNotesCount++ < 6) { 378 parseNotes += tr("Skipping a way because it includes a node that doesn''t exist: {0}\n", id); 379 } else if (parseNotesCount == 6) { 380 parseNotes += "...\n"; 381 } 376 382 failed = true; 377 383 break; -
trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java
r1415 r1444 10 10 import org.openstreetmap.josm.data.osm.DataSet; 11 11 import org.xml.sax.SAXException; 12 13 import javax.swing.JOptionPane; 12 14 13 15 public class OsmServerObjectReader extends OsmServerReader { … … 47 49 return null; 48 50 Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data...")); 49 final DataSet data = OsmReader.parseDataSet(in, null, Main.pleaseWaitDlg); 51 final OsmReader osm = OsmReader.parseDataSetOsm(in, null, Main.pleaseWaitDlg); 52 final DataSet data = osm.getDs(); 53 50 54 // String origin = Main.pref.get("osm-server.url")+"/"+Main.pref.get("osm-server.version", "0.5"); 51 55 // Bounds bounds = new Bounds(new LatLon(lat1, lon1), new LatLon(lat2, lon2)); 52 56 // DataSource src = new DataSource(bounds, origin); 53 57 // data.dataSources.add(src); 58 if (osm.getParseNotes().length() != 0) { 59 JOptionPane.showMessageDialog(Main.parent, osm.getParseNotes()); 60 } 54 61 in.close(); 55 62 activeConnection = null; -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r1415 r1444 107 107 p.put(info.stage, new LinkedList<PluginInformation>()); 108 108 p.get(info.stage).add(info); 109 } else {109 } else if(early) { 110 110 JOptionPane.showMessageDialog(Main.parent, tr("Plugin not found: {0}.", pluginName)); 111 111 }
Note:
See TracChangeset
for help on using the changeset viewer.