Ignore:
Timestamp:
2009-12-19T10:47:49+01:00 (14 years ago)
Author:
jttt
Message:

Fixed #4161 Major slowdown in recent versions, used correct pattern for listeners realized using CopyOnWriteArrayList

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r2558 r2655  
    3030import java.util.Map;
    3131import java.util.Set;
    32 import java.util.logging.Logger;
    3332
    3433import javax.swing.JComponent;
     
    6261 */
    6362public class DrawAction extends MapMode implements MapViewPaintable, SelectionChangedListener, AWTEventListener {
    64     static private final Logger logger = Logger.getLogger(DrawAction.class.getName());
     63    //static private final Logger logger = Logger.getLogger(DrawAction.class.getName());
    6564
    6665    final private Cursor cursorCrosshair;
     
    7069    private Cursors currCursor = Cursors.crosshair;
    7170
    72     private static Node lastUsedNode = null;
     71    private Node lastUsedNode = null;
    7372    private double PHI=Math.toRadians(90);
    7473
     
    119118        if(currCursor.equals(c) || (!drawTargetCursor && currCursor.equals(Cursors.crosshair)))
    120119            return;
    121         try {
    122             // We invoke this to prevent strange things from happening
    123             EventQueue.invokeLater(new Runnable() {
    124                 public void run() {
    125                     // Don't change cursor when mode has changed already
    126                     if(!(Main.map.mapMode instanceof DrawAction))
    127                         return;
    128                     switch(c) {
    129                     case way:
    130                         Main.map.mapView.setCursor(cursorJoinWay);
    131                         break;
    132                     case node:
    133                         Main.map.mapView.setCursor(cursorJoinNode);
    134                         break;
    135                     default:
    136                         Main.map.mapView.setCursor(cursorCrosshair);
    137                         break;
    138                     }
    139                 }
    140             });
    141             currCursor = c;
    142         } catch(Exception e) {}
     120        // We invoke this to prevent strange things from happening
     121        EventQueue.invokeLater(new Runnable() {
     122            public void run() {
     123                // Don't change cursor when mode has changed already
     124                if(!(Main.map.mapMode instanceof DrawAction))
     125                    return;
     126                switch(c) {
     127                case way:
     128                    Main.map.mapView.setCursor(cursorJoinWay);
     129                    break;
     130                case node:
     131                    Main.map.mapView.setCursor(cursorJoinNode);
     132                    break;
     133                default:
     134                    Main.map.mapView.setCursor(cursorCrosshair);
     135                    break;
     136                }
     137            }
     138        });
     139        currCursor = c;
    143140    }
    144141
     
    975972         */
    976973        if (getCurrentDataSet() != null && getCurrentDataSet().getSelectedWays().size() > 0 && !wayIsFinished && !alt) {
    977             Way w = (Way) getCurrentDataSet().getSelectedWays().iterator().next();
     974            Way w = getCurrentDataSet().getSelectedWays().iterator().next();
    978975            for (Node m : w.getNodes()) {
    979976                if (m.equals(mouseOnExistingNode) || mouseOnExistingWays.contains(w)) {
Note: See TracChangeset for help on using the changeset viewer.