Changeset 34557 in osm for applications/editors/josm/plugins/splinex
- Timestamp:
- 2018-08-18T20:17:12+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/splinex
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/splinex/build.xml
r33844 r34557 5 5 <property name="commit.message" value="Commit message"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 2987"/>7 <property name="plugin.main.version" value="14153"/> 8 8 9 9 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/splinex/src/org/openstreetmap/josm/plugins/Splinex/DrawSplineAction.java
r33844 r34557 19 19 import javax.swing.AbstractAction; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.actions.mapmode.MapMode; 23 22 import org.openstreetmap.josm.command.Command; 24 23 import org.openstreetmap.josm.command.MoveCommand; 25 24 import org.openstreetmap.josm.data.Bounds; 25 import org.openstreetmap.josm.data.UndoRedoHandler; 26 26 import org.openstreetmap.josm.data.coor.EastNorth; 27 27 import org.openstreetmap.josm.data.osm.Node; … … 29 29 import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings; 30 30 import org.openstreetmap.josm.data.preferences.NamedColorProperty; 31 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 31 32 import org.openstreetmap.josm.gui.MainApplication; 32 33 import org.openstreetmap.josm.gui.MapFrame; … … 45 46 import org.openstreetmap.josm.plugins.Splinex.Spline.PointHandle; 46 47 import org.openstreetmap.josm.plugins.Splinex.Spline.SplinePoint; 48 import org.openstreetmap.josm.spi.preferences.Config; 47 49 import org.openstreetmap.josm.tools.ImageProvider; 48 50 import org.openstreetmap.josm.tools.Logging; … … 109 111 protected void readPreferences() { 110 112 rubberLineColor = new NamedColorProperty(marktr("helper line"), Color.RED).get(); 111 initialMoveDelay = Main.pref.getInt("edit.initial-move-", 200);112 initialMoveThreshold = Main.pref.getInt("edit.initial-move-threshold", 5);113 initialMoveDelay = Config.getPref().getInt("edit.initial-move-", 200); 114 initialMoveThreshold = Config.getPref().getInt("edit.initial-move-threshold", 5); 113 115 initialMoveThreshold *= initialMoveThreshold; 114 drawHelperLine = Main.pref.getBoolean("draw.helper-line", true);116 drawHelperLine = Config.getPref().getBoolean("draw.helper-line", true); 115 117 } 116 118 … … 165 167 if (!spl.isClosed() && spl.nodeCount() > 1 && ph != null && ph.point == SplinePoint.ENDPOINT 166 168 && ((ph.idx == 0 && direction == 1) || (ph.idx == spl.nodeCount() - 1 && direction == -1))) { 167 MainApplication.undoRedo.add(spl.new CloseSplineCommand());169 UndoRedoHandler.getInstance().add(spl.new CloseSplineCommand()); 168 170 return; 169 171 } … … 185 187 + ph.sn.cnext.north()) < EPSILON); 186 188 } 187 if (ph.point == SplinePoint.ENDPOINT && ! MainApplication.undoRedo.commands.isEmpty()) {188 Command cmd = MainApplication.undoRedo.commands.getLast();189 if (ph.point == SplinePoint.ENDPOINT && !UndoRedoHandler.getInstance().commands.isEmpty()) { 190 Command cmd = UndoRedoHandler.getInstance().commands.getLast(); 189 191 if (cmd instanceof MoveCommand) { 190 192 mc = (MoveCommand) cmd; … … 196 198 } 197 199 } 198 if (ph.point != SplinePoint.ENDPOINT && ! MainApplication.undoRedo.commands.isEmpty()) {199 Command cmd = MainApplication.undoRedo.commands.getLast();200 if (ph.point != SplinePoint.ENDPOINT && !UndoRedoHandler.getInstance().commands.isEmpty()) { 201 Command cmd = UndoRedoHandler.getInstance().commands.getLast(); 200 202 if (!(cmd instanceof Spline.EditSplineCommand && ((Spline.EditSplineCommand) cmd).sn == ph.sn)) 201 203 dragControl = true; … … 224 226 } 225 227 int idx = direction == -1 ? 0 : spl.nodeCount(); 226 MainApplication.undoRedo.add(spl.new AddSplineNodeCommand(new Spline.SNode(n), existing, idx));228 UndoRedoHandler.getInstance().add(spl.new AddSplineNodeCommand(new Spline.SNode(n), existing, idx)); 227 229 ph = spl.new PointHandle(idx, direction == -1 ? SplinePoint.CONTROL_PREV : SplinePoint.CONTROL_NEXT); 228 230 lockCounterpart = true; … … 257 259 return; 258 260 EastNorth en = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY()); 259 if ( Main.getProjection().eastNorth2latlon(en).isOutSideWorld())261 if (ProjectionRegistry.getProjection().eastNorth2latlon(en).isOutSideWorld()) 260 262 return; 261 263 if (dragSpline) { 262 264 if (mc == null) { 263 265 mc = new MoveCommand(spl.getNodes(), MainApplication.getMap().mapView.getEastNorth(clickPos.x, clickPos.y), en); 264 MainApplication.undoRedo.add(mc);266 UndoRedoHandler.getInstance().add(mc); 265 267 clickPos = null; 266 268 } else … … 274 276 if (mc == null) { 275 277 mc = new MoveCommand(ph.sn.node, ph.sn.node.getEastNorth(), en); 276 MainApplication.undoRedo.add(mc);278 UndoRedoHandler.getInstance().add(mc); 277 279 } else 278 280 mc.applyVectorTo(en); 279 281 } else { 280 282 if (dragControl) { 281 MainApplication.undoRedo.add(new Spline.EditSplineCommand(ph.sn));283 UndoRedoHandler.getInstance().add(new Spline.EditSplineCommand(ph.sn)); 282 284 dragControl = false; 283 285 } … … 400 402 @Override 401 403 public void actionPerformed(ActionEvent e) { 402 MainApplication.undoRedo.undo();404 UndoRedoHandler.getInstance().undo(); 403 405 } 404 406 } … … 448 450 if (spl.nodeCount() == 3 && spl.isClosed() && ph.idx == 1) 449 451 return; // Don't allow to delete node when it results with two-node closed spline 450 MainApplication.undoRedo.add(spl.new DeleteSplineNodeCommand(ph.idx));452 UndoRedoHandler.getInstance().add(spl.new DeleteSplineNodeCommand(ph.idx)); 451 453 e.consume(); 452 454 } -
applications/editors/josm/plugins/splinex/src/org/openstreetmap/josm/plugins/Splinex/Spline.java
r33844 r34557 23 23 import javax.swing.JOptionPane; 24 24 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.command.AddCommand; 27 26 import org.openstreetmap.josm.command.Command; 28 27 import org.openstreetmap.josm.command.SequenceCommand; 28 import org.openstreetmap.josm.data.UndoRedoHandler; 29 29 import org.openstreetmap.josm.data.coor.EastNorth; 30 30 import org.openstreetmap.josm.data.osm.DataSet; … … 34 34 import org.openstreetmap.josm.data.osm.Way; 35 35 import org.openstreetmap.josm.data.preferences.IntegerProperty; 36 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 36 37 import org.openstreetmap.josm.gui.MainApplication; 37 38 import org.openstreetmap.josm.gui.MapView; … … 261 262 if (!a.equalsEpsilon(ca, EPSILON) || !b.equalsEpsilon(cb, EPSILON)) 262 263 for (int i = 1; i < detail; i++) { 263 Node n = new Node( Main.getProjection().eastNorth2latlon(264 Node n = new Node(ProjectionRegistry.getProjection().eastNorth2latlon( 264 265 cubicBezier(a, ca, cb, b, (double) i / detail))); 265 266 if (n.getCoor().isOutSideWorld()) { 266 JOptionPane.showMessageDialog(Main .parent, tr("Spline goes outside of the world."));267 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Spline goes outside of the world.")); 267 268 return; 268 269 } … … 276 277 if (!cmds.isEmpty()) 277 278 cmds.add(new AddCommand(ds, w)); 278 MainApplication.undoRedo.add(new FinishSplineCommand(cmds));279 UndoRedoHandler.getInstance().add(new FinishSplineCommand(cmds)); 279 280 } 280 281 -
applications/editors/josm/plugins/splinex/src/org/openstreetmap/josm/plugins/Splinex/SplineHitTest.java
r33534 r34557 2 2 package org.openstreetmap.josm.plugins.Splinex; 3 3 4 import org.openstreetmap.josm.Main;5 4 import org.openstreetmap.josm.tools.Logging; 6 5
Note:
See TracChangeset
for help on using the changeset viewer.