Changeset 26106 in osm
- Timestamp:
- 2011-06-07T15:27:57+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/turbopen/src/org/openstreetmap/josm/plugins/fastdraw
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/turbopen/src/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLine.java
r26101 r26106 273 273 } 274 274 275 276 277 278 279 280 281 282 283 284 275 } -
applications/editors/josm/plugins/turbopen/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java
r26101 r26106 16 16 import java.awt.event.MouseEvent; 17 17 import org.openstreetmap.josm.data.coor.LatLon; 18 import org.openstreetmap.josm.data.osm.Tag; 18 19 import static org.openstreetmap.josm.tools.I18n.tr; 19 20 … … 27 28 import java.awt.event.KeyEvent; 28 29 import java.io.IOException; 30 import java.lang.annotation.Target; 29 31 import java.util.*; 30 32 import javax.swing.JOptionPane; 31 33 32 34 import org.openstreetmap.josm.Main; 35 import org.openstreetmap.josm.actions.PasteTagsAction.TagPaster; 33 36 import org.openstreetmap.josm.actions.mapmode.MapMode; 34 37 import org.openstreetmap.josm.command.AddCommand; … … 50 53 AWTEventListener { 51 54 private static final String SIMPLIFYMODE_MESSAGE= 52 "Press Enter to simplify or save, Up/Down to tune simplification";55 "Press Enter to simplify or save, Ctrl-Enter to save with tags, Up/Down to tune simplification"; 53 56 private static final String DRAWINGMODE_MESSAGE= 54 "Click or Click&drag to continue, Ctrl-Click to add fixed node, Shift-Click to start new line";55 56 private static final Color COLOR_FIXED = Color.green;57 private static final Color COLOR_NORMAL = Color.white;58 private static final Color COLOR_DELETE = Color.red;59 private static final Color COLOR_SELECTEDFRAGMENT = Color.red;60 private static final Color COLOR_EDITEDFRAGMENT = Color.orange;57 "Click or Click&drag to continue, Ctrl-Click to add fixed node, Shift-Click to delete, Enter to simplify or save, Ctrl-Shift-Click to start new line"; 58 59 private Color COLOR_FIXED; 60 private Color COLOR_NORMAL; 61 private Color COLOR_DELETE; 62 private Color COLOR_SELECTEDFRAGMENT; 63 private Color COLOR_EDITEDFRAGMENT; 61 64 62 65 private double maxDist; … … 191 194 pp2 = it2.next(); 192 195 p2 = line.getPoint(pp2); 193 if ( highlighted==pp1) {lineColor=COLOR_SELECTEDFRAGMENT;}196 if (shift && highlighted==pp1 && nearestIdx<0) {lineColor=COLOR_SELECTEDFRAGMENT;} 194 197 if (line.isLastPoint(i)) { lineColor=COLOR_EDITEDFRAGMENT; } 195 198 g.setColor(lineColor); … … 212 215 } 213 216 if (ctrl && !line.wasSimplified() && nearestIdx==i+1 ) { 214 // highlight node to delete217 // highlight node to toggle fixation 215 218 g.setStroke(strokeForDelete); 216 219 g.setColor( line.isFixed(pp2) ? COLOR_NORMAL: COLOR_FIXED); … … 293 296 if (e.getButton() != MouseEvent.BUTTON1) return; 294 297 drawing = false; 295 if (!ready) setStatusLine(tr(DRAWINGMODE_MESSAGE)296 + tr(SIMPLIFYMODE_MESSAGE));298 highlighted=null; 299 if (!ready) setStatusLine(tr(DRAWINGMODE_MESSAGE)); 297 300 repaint(); 298 301 } … … 435 438 w.addNode(nd); 436 439 i++; 440 } 441 if (ctrl) { 442 // paste tags - from ctrl-shift-v 443 Set <OsmPrimitive> ts = new HashSet<OsmPrimitive>(); 444 ts.add(w); 445 TagPaster tp = new TagPaster(Main.pasteBuffer.getDirectlyAdded(), ts); 446 List<Tag> execute = tp.execute(); 447 Map<String,String> tgs=new HashMap<String,String>(); 448 for (Tag t : execute) { 449 w.put(t.getKey(), t.getValue()); 450 } 437 451 } 438 452 cmds.add(new AddCommand(w)); … … 487 501 488 502 void loadPrefs() { 503 COLOR_DELETE = Main.pref.getColor("fastdraw.color.delete", Color.red); 504 COLOR_EDITEDFRAGMENT = Main.pref.getColor("fastdraw.color.edit", Color.orange); 505 COLOR_FIXED = Main.pref.getColor("fastdraw.color.fixed", Color.green); 506 COLOR_NORMAL = Main.pref.getColor("fastdraw.color.normal", Color.red); 507 COLOR_SELECTEDFRAGMENT = Main.pref.getColor("fastdraw.color.select", Color.blue); 489 508 maxDist = Main.pref.getDouble("fastdraw.maxdist", 5); 490 509 epsilonMult = Main.pref.getDouble("fastdraw.epsilonmult", 1.1); … … 496 515 497 516 void savePrefs() { 517 Main.pref.putColor("fastdraw.color.delete", COLOR_DELETE ); 518 Main.pref.putColor("fastdraw.color.edit", COLOR_EDITEDFRAGMENT); 519 Main.pref.putColor("fastdraw.color.fixed", COLOR_FIXED); 520 Main.pref.putColor("fastdraw.color.normal", COLOR_NORMAL); 521 Main.pref.putColor("fastdraw.color.select", COLOR_SELECTEDFRAGMENT); 498 522 Main.pref.putDouble("fastdraw.maxdist", maxDist); 499 523 Main.pref.putDouble("fastdraw.epsilonmult", epsilonMult);
Note:
See TracChangeset
for help on using the changeset viewer.