Changeset 29263 in osm for applications/editors/josm
- Timestamp:
- 2013-02-18T18:42:49+01:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/FastDraw
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FastDraw/build.xml
r28167 r29263 30 30 <project name="FastDraw" default="dist" basedir="."> 31 31 <!-- enter the SVN commit message --> 32 <property name="commit.message" value=" FastDraw: better shortcut handling after core changes"/>32 <property name="commit.message" value="JOSM/FastDraw: add option (Q) to draw closed polygons"/> 33 33 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 34 34 <property name="plugin.main.version" value="5035"/> -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLine.java
r26522 r29263 8 8 import java.util.ListIterator; 9 9 import java.util.Set; 10 import javax.xml.stream.events.StartDocument;11 10 import org.openstreetmap.josm.data.coor.LatLon; 12 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 380 379 } 381 380 381 int getPointCount() { 382 return points.size(); 383 } 384 382 385 } -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java
r26501 r29263 33 33 // option for simplifiction: 0="Autosimplify and wait", 34 34 //1="Simplify and wait", 2="Save as is" 35 36 public boolean drawClosed; 35 37 public int simplifyMode; 36 38 public float lineWidth; … … 54 56 fixedClick = Main.pref.getBoolean("fastdraw.fixedclick", false); 55 57 fixedSpacebar = Main.pref.getBoolean("fastdraw.fixedspacebar", false); 58 drawClosed = Main.pref.getBoolean("fastdraw.drawclosed", false); 56 59 simplifyMode = Main.pref.getInteger("fastdraw.simplifymode", 0); 57 60 lineWidth = (float) Main.pref.getDouble("fastdraw.linewidth", 2); … … 76 79 Main.pref.put("fastdraw.fixedclick", fixedClick); 77 80 Main.pref.put("fastdraw.fixedspacebar", fixedSpacebar); 81 Main.pref.put("fastdraw.drawclosed", drawClosed); 78 82 Main.pref.putInteger("fastdraw.simplifymode", simplifyMode); 79 83 Main.pref.putDouble("fastdraw.linewidth",(double)lineWidth); -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java
r26530 r29263 5 5 package org.openstreetmap.josm.plugins.fastdraw; 6 6 7 import org.openstreetmap.josm.tools.GBC;7 import java.awt.Component; 8 8 import java.awt.GridBagLayout; 9 9 import javax.swing.JOptionPane; 10 import org.openstreetmap.josm.tools.GBC; 10 11 import java.text.NumberFormat; 11 12 import java.text.ParseException; … … 42 43 JCheckBox fixedClickCb = new JCheckBox(tr("Add fixed points on click")); 43 44 JCheckBox fixedSpaceCb = new JCheckBox(tr("Add fixed points on spacebar")); 45 JCheckBox drawClosedCb = new JCheckBox(tr("Draw closed polygons only")); 46 44 47 all.add(label1,GBC.std().insets(10,0,0,0)); 45 48 all.add(text1, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5)); … … 54 57 all.add(fixedClickCb,GBC.eop().insets(20,0,0,0)); 55 58 all.add(fixedSpaceCb,GBC.eop().insets(20,0,0,0)); 59 all.add(drawClosedCb,GBC.eop().insets(20,0,0,0)); 56 60 57 61 text1.setValue(settings.epsilonMult); … … 61 65 fixedClickCb.setSelected(settings.fixedClick); 62 66 fixedSpaceCb.setSelected(settings.fixedSpacebar); 67 drawClosedCb.setSelected(settings.drawClosed); 63 68 combo1.setSelectedIndex(settings.simplifyMode); 64 69 65 70 ExtendedDialog dialog = new ExtendedDialog(Main.parent, 66 71 tr("FastDraw settings"), … … 84 89 settings.fixedClick=fixedClickCb.isSelected(); 85 90 settings.fixedSpacebar=fixedSpaceCb.isSelected(); 91 settings.drawClosed=drawClosedCb.isSelected(); 86 92 settings.simplifyMode=combo1.getSelectedIndex(); 87 93 settings.savePrefs(); -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java
r28167 r29263 127 127 mv = Main.map.mapView; 128 128 line.setMv(mv); 129 129 130 130 if (getCurrentDataSet() == null) return; 131 131 … … 195 195 g.setStroke(strokeForOriginal); 196 196 } 197 197 198 198 Point p1, p2; 199 199 LatLon pp1, pp2; … … 308 308 return; 309 309 } 310 autoCloseIfNeeded(); 310 311 311 312 if (ctrl && shift) {newDrawing();repaint();return;} … … 427 428 } 428 429 } 429 //statusText = getLatLon(e).toString(); updateStatusLine();430 autoCloseIfNeeded(); 430 431 } 431 432 … … 721 722 Main.map.mapView.repaint(); 722 723 } 723 // </editor-fold> 724 725 // <editor-fold defaultstate="collapsed" desc="Helper functions"> 726 727 private Node getNearestNode(Point point, double maxDist) { 728 Node nd = Main.map.mapView.getNearestNode(point, OsmPrimitive.isSelectablePredicate); 729 if (nd!=null && line.getPoint(nd.getCoor()).distance(point)<=maxDist) return nd; 730 else return null; 731 } 732 733 LatLon getLatLon(MouseEvent e) { 734 return mv.getLatLon(e.getX(), e.getY()); 735 } 736 // </editor-fold> 737 724 738 725 private void tryToLoadWay() { 739 726 updateCursor(); … … 749 736 } 750 737 738 private void autoCloseIfNeeded() { 739 if (settings.drawClosed && line.getPointCount()>1 && !line.isClosed()) { 740 line.closeLine(); 741 } 742 } 743 // </editor-fold> 744 745 // <editor-fold defaultstate="collapsed" desc="Helper functions"> 746 747 private Node getNearestNode(Point point, double maxDist) { 748 Node nd = Main.map.mapView.getNearestNode(point, OsmPrimitive.isSelectablePredicate); 749 if (nd!=null && line.getPoint(nd.getCoor()).distance(point)<=maxDist) return nd; 750 else return null; 751 } 752 753 LatLon getLatLon(MouseEvent e) { 754 return mv.getLatLon(e.getX(), e.getY()); 755 } 756 // </editor-fold> 751 757 752 758 }
Note:
See TracChangeset
for help on using the changeset viewer.