Changeset 26455 in osm


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
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/FastDraw/build.xml

    r26448 r26455  
    3030<project name="FastDraw" default="dist" basedir=".">
    3131    <!-- enter the SVN commit message -->
    32     <property name="commit.message" value="FastDraw: better linux compatibility"/>
     32    <property name="commit.message" value="FastDraw: draw last line segment, up/down=change minDelta"/>
    3333    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    3434    <property name="plugin.main.version" value="4201"/>
  • applications/editors/josm/plugins/FastDraw/nbproject

    • Property svn:ignore set to
      private
  • applications/editors/josm/plugins/FastDraw/nbproject/project.xml

    r26448 r26455  
    1616            <ide-actions>
    1717                <action name="build">
    18                     <target>dist</target>
     18                    <target>compile</target>
    1919                </action>
    2020                <action name="clean">
     
    2626                <action name="rebuild">
    2727                    <target>clean</target>
    28                     <target>dist</target>
     28                    <target>compile</target>
     29                </action>
     30                <action name="debug">
     31                    <script>nbproject/ide-targets.xml</script>
     32                    <target>debug-nb</target>
    2933                </action>
    3034            </ide-actions>
     35            <export>
     36                <type>jar</type>
     37                <location>../../dist/FastDraw.jar</location>
     38                <build-target>compile</build-target>
     39            </export>
    3140            <view>
    3241                <items>
     
    4453                    <ide-action name="clean"/>
    4554                    <ide-action name="run"/>
     55                    <ide-action name="debug"/>
    4656                </context-menu>
    4757            </view>
     
    5161                <package-root>src</package-root>
    5262                <classpath mode="compile">../../core/src</classpath>
     63                <built-to>../../dist/FastDraw.jar</built-to>
    5364                <source-level>1.6</source-level>
    5465            </compilation-unit>
  • 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.