Ignore:
Timestamp:
2018-08-18T20:17:12+02:00 (6 years ago)
Author:
donvip
Message:

update to JOSM 14153

Location:
applications/editors/josm/plugins/splinex
Files:
4 edited

Legend:

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

    r33844 r34557  
    55    <property name="commit.message" value="Commit message"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="12987"/>
     7    <property name="plugin.main.version" value="14153"/>
    88
    99    <!-- Configure these properties (replace "..." accordingly).
  • applications/editors/josm/plugins/splinex/src/org/openstreetmap/josm/plugins/Splinex/DrawSplineAction.java

    r33844 r34557  
    1919import javax.swing.AbstractAction;
    2020
    21 import org.openstreetmap.josm.Main;
    2221import org.openstreetmap.josm.actions.mapmode.MapMode;
    2322import org.openstreetmap.josm.command.Command;
    2423import org.openstreetmap.josm.command.MoveCommand;
    2524import org.openstreetmap.josm.data.Bounds;
     25import org.openstreetmap.josm.data.UndoRedoHandler;
    2626import org.openstreetmap.josm.data.coor.EastNorth;
    2727import org.openstreetmap.josm.data.osm.Node;
     
    2929import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings;
    3030import org.openstreetmap.josm.data.preferences.NamedColorProperty;
     31import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    3132import org.openstreetmap.josm.gui.MainApplication;
    3233import org.openstreetmap.josm.gui.MapFrame;
     
    4546import org.openstreetmap.josm.plugins.Splinex.Spline.PointHandle;
    4647import org.openstreetmap.josm.plugins.Splinex.Spline.SplinePoint;
     48import org.openstreetmap.josm.spi.preferences.Config;
    4749import org.openstreetmap.josm.tools.ImageProvider;
    4850import org.openstreetmap.josm.tools.Logging;
     
    109111    protected void readPreferences() {
    110112        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);
    113115        initialMoveThreshold *= initialMoveThreshold;
    114         drawHelperLine = Main.pref.getBoolean("draw.helper-line", true);
     116        drawHelperLine = Config.getPref().getBoolean("draw.helper-line", true);
    115117    }
    116118
     
    165167            if (!spl.isClosed() && spl.nodeCount() > 1 && ph != null && ph.point == SplinePoint.ENDPOINT
    166168                    && ((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());
    168170                return;
    169171            }
     
    185187                        + ph.sn.cnext.north()) < EPSILON);
    186188            }
    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();
    189191                if (cmd instanceof MoveCommand) {
    190192                    mc = (MoveCommand) cmd;
     
    196198                }
    197199            }
    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();
    200202                if (!(cmd instanceof Spline.EditSplineCommand && ((Spline.EditSplineCommand) cmd).sn == ph.sn))
    201203                    dragControl = true;
     
    224226        }
    225227        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));
    227229        ph = spl.new PointHandle(idx, direction == -1 ? SplinePoint.CONTROL_PREV : SplinePoint.CONTROL_NEXT);
    228230        lockCounterpart = true;
     
    257259            return;
    258260        EastNorth en = MainApplication.getMap().mapView.getEastNorth(e.getX(), e.getY());
    259         if (Main.getProjection().eastNorth2latlon(en).isOutSideWorld())
     261        if (ProjectionRegistry.getProjection().eastNorth2latlon(en).isOutSideWorld())
    260262            return;
    261263        if (dragSpline) {
    262264            if (mc == null) {
    263265                mc = new MoveCommand(spl.getNodes(), MainApplication.getMap().mapView.getEastNorth(clickPos.x, clickPos.y), en);
    264                 MainApplication.undoRedo.add(mc);
     266                UndoRedoHandler.getInstance().add(mc);
    265267                clickPos = null;
    266268            } else
     
    274276            if (mc == null) {
    275277                mc = new MoveCommand(ph.sn.node, ph.sn.node.getEastNorth(), en);
    276                 MainApplication.undoRedo.add(mc);
     278                UndoRedoHandler.getInstance().add(mc);
    277279            } else
    278280                mc.applyVectorTo(en);
    279281        } else {
    280282            if (dragControl) {
    281                 MainApplication.undoRedo.add(new Spline.EditSplineCommand(ph.sn));
     283                UndoRedoHandler.getInstance().add(new Spline.EditSplineCommand(ph.sn));
    282284                dragControl = false;
    283285            }
     
    400402        @Override
    401403        public void actionPerformed(ActionEvent e) {
    402             MainApplication.undoRedo.undo();
     404            UndoRedoHandler.getInstance().undo();
    403405        }
    404406    }
     
    448450            if (spl.nodeCount() == 3 && spl.isClosed() && ph.idx == 1)
    449451                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));
    451453            e.consume();
    452454        }
  • applications/editors/josm/plugins/splinex/src/org/openstreetmap/josm/plugins/Splinex/Spline.java

    r33844 r34557  
    2323import javax.swing.JOptionPane;
    2424
    25 import org.openstreetmap.josm.Main;
    2625import org.openstreetmap.josm.command.AddCommand;
    2726import org.openstreetmap.josm.command.Command;
    2827import org.openstreetmap.josm.command.SequenceCommand;
     28import org.openstreetmap.josm.data.UndoRedoHandler;
    2929import org.openstreetmap.josm.data.coor.EastNorth;
    3030import org.openstreetmap.josm.data.osm.DataSet;
     
    3434import org.openstreetmap.josm.data.osm.Way;
    3535import org.openstreetmap.josm.data.preferences.IntegerProperty;
     36import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    3637import org.openstreetmap.josm.gui.MainApplication;
    3738import org.openstreetmap.josm.gui.MapView;
     
    261262            if (!a.equalsEpsilon(ca, EPSILON) || !b.equalsEpsilon(cb, EPSILON))
    262263                for (int i = 1; i < detail; i++) {
    263                     Node n = new Node(Main.getProjection().eastNorth2latlon(
     264                    Node n = new Node(ProjectionRegistry.getProjection().eastNorth2latlon(
    264265                            cubicBezier(a, ca, cb, b, (double) i / detail)));
    265266                    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."));
    267268                        return;
    268269                    }
     
    276277        if (!cmds.isEmpty())
    277278            cmds.add(new AddCommand(ds, w));
    278         MainApplication.undoRedo.add(new FinishSplineCommand(cmds));
     279        UndoRedoHandler.getInstance().add(new FinishSplineCommand(cmds));
    279280    }
    280281
  • applications/editors/josm/plugins/splinex/src/org/openstreetmap/josm/plugins/Splinex/SplineHitTest.java

    r33534 r34557  
    22package org.openstreetmap.josm.plugins.Splinex;
    33
    4 import org.openstreetmap.josm.Main;
    54import org.openstreetmap.josm.tools.Logging;
    65
Note: See TracChangeset for help on using the changeset viewer.