Ignore:
Timestamp:
2011-08-05T10:05:38+02:00 (13 years ago)
Author:
akks
Message:

'FastDraw: draw last line segment, up/down=change minDelta'

Location:
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java

    r26311 r26455  
    2323    public double maxPointsPerKm;
    2424    public int pkmBlockSize;
     25    public boolean drawLastSegment;
    2526   
    2627    public void loadPrefs() {
     
    3738        maxPointsPerKm = Main.pref.getDouble("fastdraw.maxpkm", 20);
    3839        pkmBlockSize = Main.pref.getInteger("fastdraw.pkmblocksize", 10);
     40        drawLastSegment = Main.pref.getBoolean("fastdraw.drawlastsegment", true);
    3941    }
    4042
     
    5254         Main.pref.putDouble("fastdraw.maxpkm",maxPointsPerKm);
    5355         Main.pref.putInteger("fastdraw.pkmblocksize",pkmBlockSize);
     56         Main.pref.put("fastdraw.drawlastsegment",drawLastSegment);
    5457         try {Main.pref.save();} catch (IOException e) {
    5558             System.err.println(tr("Can not save preferences"));
  • applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java

    r26448 r26455  
    8383    private List<Node> oldNodes;
    8484   
    85     private final TreeSet set = new TreeSet();
     85    private final TreeSet<Integer> set = new TreeSet<Integer>();
    8686    private Timer timer;
    8787 
     
    242242                }
    243243            }
     244            if (settings.drawLastSegment && !drawing && !shift && !line.wasSimplified()) {
     245                // draw line to current point
     246                g.setColor(lineColor);
     247                Point lp=line.getLastPoint();
     248                Point mp=Main.map.mapView.getMousePosition();
     249                g.drawLine(lp.x,lp.y,mp.x,mp.y);
     250            }
    244251        }
    245252    }
     
    363370        int nearestIdx2=line.findClosestPoint(e.getPoint(),settings.maxDist);
    364371        if (nearestIdx != nearestIdx2) {nearestIdx=nearestIdx2; updateCursor();needRepaint=true;}
     372        if (settings.drawLastSegment) needRepaint=true;
    365373       
    366374        if (!drawing) {
     
    433441            // more details
    434442            e.consume();
    435             changeEpsilon(settings.epsilonMult);
     443            if (line.wasSimplified()) changeEpsilon(settings.epsilonMult);
     444            else changeDelta(1/1.1);
    436445        break;
    437446        case KeyEvent.VK_UP:
    438447            // less details
    439448            e.consume();
    440             changeEpsilon(1/settings.epsilonMult);
     449            if (line.wasSimplified()) changeEpsilon(1/settings.epsilonMult);
     450            else changeDelta(1.1);
    441451        break;
    442452        case KeyEvent.VK_ESCAPE:
     
    576586    }
    577587
     588    void changeDelta(double k) {
     589        settings.minPixelsBetweenPoints*=k;
     590        setStatusLine(tr("min distance={0} pixes",(int)settings.minPixelsBetweenPoints));
     591       
     592    }
     593
    578594    private void setStatusLine(String tr) {
    579595        statusText=tr;
Note: See TracChangeset for help on using the changeset viewer.