Changeset 34520 in osm for applications/editors


Ignore:
Timestamp:
2018-08-18T18:06:33+02:00 (6 years ago)
Author:
donvip
Message:

update to JOSM 14153

Location:
applications/editors/josm/plugins/importvec
Files:
5 edited

Legend:

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

    r33557 r34520  
    44    <property name="commit.message" value="Remove the action, add importing SVG to File/Open"/>
    55    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    6     <property name="plugin.main.version" value="12671"/>
     6    <property name="plugin.main.version" value="14153"/>
    77
    88    <property name="plugin.author" value="Upliner"/>
  • applications/editors/josm/plugins/importvec/src/org/openstreetmap/josm/plugins/importvec/ImportDialog.java

    r23712 r34520  
    1212import javax.swing.JPanel;
    1313
    14 import org.openstreetmap.josm.Main;
    1514import org.openstreetmap.josm.gui.ExtendedDialog;
     15import org.openstreetmap.josm.gui.MainApplication;
    1616import org.openstreetmap.josm.tools.GBC;
    1717
     
    2222
    2323    public ImportDialog() {
    24         super(Main.parent, tr("Import vector graphics"),
     24        super(MainApplication.getMainFrame(), tr("Import vector graphics"),
    2525                new String[] { tr("OK"), tr("Cancel") },
    2626                true);
  • applications/editors/josm/plugins/importvec/src/org/openstreetmap/josm/plugins/importvec/Settings.java

    r23707 r34520  
    11package org.openstreetmap.josm.plugins.importvec;
    22
    3 import org.openstreetmap.josm.Main;
     3import org.openstreetmap.josm.spi.preferences.Config;
    44
    55public class Settings {
    66
    77    public static void setScaleNumerator(double value) {
    8         Main.pref.putDouble("importvec.scalenum", value);
     8        Config.getPref().putDouble("importvec.scalenum", value);
    99    }
    1010    public static void setScaleDivisor(double value) {
    1111        if (value == 0)
    1212            throw new IllegalArgumentException("Scale divisor cannot be 0");
    13         Main.pref.putDouble("importvec.scalediv", value);
     13        Config.getPref().putDouble("importvec.scalediv", value);
    1414    }
    1515    public static void setCurveSteps(long value) {
    1616        if (value < 1)
    1717            throw new IllegalArgumentException("Curve steps cannot less than 1");
    18         Main.pref.putLong("importvec.curvesteps", value);
     18        Config.getPref().putLong("importvec.curvesteps", value);
    1919    }
    2020   
    2121    public static double getScaleNumerator() {
    22         return Main.pref.getDouble("importvec.scalenum", 1);
     22        return Config.getPref().getDouble("importvec.scalenum", 1);
    2323    }
    2424    public static double getScaleDivisor() {
    25         return Main.pref.getDouble("importvec.scalediv", 1);
     25        return Config.getPref().getDouble("importvec.scalediv", 1);
    2626    }
    2727    public static double getCurveSteps() {
    28         return Main.pref.getDouble("importvec.curvesteps", 4);
     28        return Config.getPref().getDouble("importvec.curvesteps", 4);
    2929    }
    3030}
  • applications/editors/josm/plugins/importvec/src/org/openstreetmap/josm/plugins/importvec/SvgImportTask.java

    r33902 r34520  
    1616import java.util.List;
    1717
    18 import org.openstreetmap.josm.Main;
    1918import org.openstreetmap.josm.command.AddCommand;
    2019import org.openstreetmap.josm.command.Command;
    2120import org.openstreetmap.josm.command.SequenceCommand;
     21import org.openstreetmap.josm.data.UndoRedoHandler;
    2222import org.openstreetmap.josm.data.coor.EastNorth;
    2323import org.openstreetmap.josm.data.coor.LatLon;
     
    2626import org.openstreetmap.josm.data.osm.Way;
    2727import org.openstreetmap.josm.data.projection.Projection;
     28import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    2829import org.openstreetmap.josm.data.projection.Projections;
    2930import org.openstreetmap.josm.gui.MainApplication;
    3031import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    3132import org.openstreetmap.josm.io.OsmTransferException;
     33import org.openstreetmap.josm.spi.preferences.Config;
    3234import org.openstreetmap.josm.tools.I18n;
    3335
     
    163165    @Override
    164166    protected void realRun() throws IOException, OsmTransferException {
    165         LatLon center = Main.getProjection().eastNorth2latlon(MainApplication.getMap().mapView.getCenter());
     167        LatLon center = ProjectionRegistry.getProjection().eastNorth2latlon(MainApplication.getMap().mapView.getCenter());
    166168        scale = Settings.getScaleNumerator() / Settings.getScaleDivisor() / Math.cos(Math.toRadians(center.lat()));
    167169        this.center = projection.latlon2eastNorth(center);
    168170        try {
    169171            SVGUniverse universe = new SVGUniverse();
    170             universe.setVerbose(Main.pref.getBoolean("importvec.verbose", false));
     172            universe.setVerbose(Config.getPref().getBoolean("importvec.verbose", false));
    171173            for (File f : files) {
    172174                if (f.isDirectory()) continue;
     
    196198            cmds.add(new AddCommand(ds, w));
    197199        }
    198         MainApplication.undoRedo.add(new SequenceCommand("Import primitives", cmds));
     200        UndoRedoHandler.getInstance().add(new SequenceCommand("Import primitives", cmds));
    199201    }
    200202   
  • applications/editors/josm/plugins/importvec/src/org/openstreetmap/josm/plugins/importvec/SvgImporter.java

    r33564 r34520  
    99import javax.swing.JOptionPane;
    1010
    11 import org.openstreetmap.josm.Main;
    1211import org.openstreetmap.josm.actions.ExtensionFileFilter;
    1312import org.openstreetmap.josm.gui.MainApplication;
     
    3433    public void importData(List<File> files, ProgressMonitor progressMonitor) throws IOException, IllegalDataException {
    3534        if (MainApplication.getLayerManager().getEditLayer() == null) {
    36             JOptionPane.showMessageDialog(Main.parent, tr("Please open or create data layer before importing"));
     35            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Please open or create data layer before importing"));
    3736            return;
    3837        }
Note: See TracChangeset for help on using the changeset viewer.