Changeset 34520 in osm for applications/editors
- Timestamp:
- 2018-08-18T18:06:33+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/importvec
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/importvec/build.xml
r33557 r34520 4 4 <property name="commit.message" value="Remove the action, add importing SVG to File/Open"/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 2671"/>6 <property name="plugin.main.version" value="14153"/> 7 7 8 8 <property name="plugin.author" value="Upliner"/> -
applications/editors/josm/plugins/importvec/src/org/openstreetmap/josm/plugins/importvec/ImportDialog.java
r23712 r34520 12 12 import javax.swing.JPanel; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.gui.ExtendedDialog; 15 import org.openstreetmap.josm.gui.MainApplication; 16 16 import org.openstreetmap.josm.tools.GBC; 17 17 … … 22 22 23 23 public ImportDialog() { 24 super(Main .parent, tr("Import vector graphics"),24 super(MainApplication.getMainFrame(), tr("Import vector graphics"), 25 25 new String[] { tr("OK"), tr("Cancel") }, 26 26 true); -
applications/editors/josm/plugins/importvec/src/org/openstreetmap/josm/plugins/importvec/Settings.java
r23707 r34520 1 1 package org.openstreetmap.josm.plugins.importvec; 2 2 3 import org.openstreetmap.josm. Main;3 import org.openstreetmap.josm.spi.preferences.Config; 4 4 5 5 public class Settings { 6 6 7 7 public static void setScaleNumerator(double value) { 8 Main.pref.putDouble("importvec.scalenum", value);8 Config.getPref().putDouble("importvec.scalenum", value); 9 9 } 10 10 public static void setScaleDivisor(double value) { 11 11 if (value == 0) 12 12 throw new IllegalArgumentException("Scale divisor cannot be 0"); 13 Main.pref.putDouble("importvec.scalediv", value);13 Config.getPref().putDouble("importvec.scalediv", value); 14 14 } 15 15 public static void setCurveSteps(long value) { 16 16 if (value < 1) 17 17 throw new IllegalArgumentException("Curve steps cannot less than 1"); 18 Main.pref.putLong("importvec.curvesteps", value);18 Config.getPref().putLong("importvec.curvesteps", value); 19 19 } 20 20 21 21 public static double getScaleNumerator() { 22 return Main.pref.getDouble("importvec.scalenum", 1);22 return Config.getPref().getDouble("importvec.scalenum", 1); 23 23 } 24 24 public static double getScaleDivisor() { 25 return Main.pref.getDouble("importvec.scalediv", 1);25 return Config.getPref().getDouble("importvec.scalediv", 1); 26 26 } 27 27 public static double getCurveSteps() { 28 return Main.pref.getDouble("importvec.curvesteps", 4);28 return Config.getPref().getDouble("importvec.curvesteps", 4); 29 29 } 30 30 } -
applications/editors/josm/plugins/importvec/src/org/openstreetmap/josm/plugins/importvec/SvgImportTask.java
r33902 r34520 16 16 import java.util.List; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.command.AddCommand; 20 19 import org.openstreetmap.josm.command.Command; 21 20 import org.openstreetmap.josm.command.SequenceCommand; 21 import org.openstreetmap.josm.data.UndoRedoHandler; 22 22 import org.openstreetmap.josm.data.coor.EastNorth; 23 23 import org.openstreetmap.josm.data.coor.LatLon; … … 26 26 import org.openstreetmap.josm.data.osm.Way; 27 27 import org.openstreetmap.josm.data.projection.Projection; 28 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 28 29 import org.openstreetmap.josm.data.projection.Projections; 29 30 import org.openstreetmap.josm.gui.MainApplication; 30 31 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 31 32 import org.openstreetmap.josm.io.OsmTransferException; 33 import org.openstreetmap.josm.spi.preferences.Config; 32 34 import org.openstreetmap.josm.tools.I18n; 33 35 … … 163 165 @Override 164 166 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()); 166 168 scale = Settings.getScaleNumerator() / Settings.getScaleDivisor() / Math.cos(Math.toRadians(center.lat())); 167 169 this.center = projection.latlon2eastNorth(center); 168 170 try { 169 171 SVGUniverse universe = new SVGUniverse(); 170 universe.setVerbose( Main.pref.getBoolean("importvec.verbose", false));172 universe.setVerbose(Config.getPref().getBoolean("importvec.verbose", false)); 171 173 for (File f : files) { 172 174 if (f.isDirectory()) continue; … … 196 198 cmds.add(new AddCommand(ds, w)); 197 199 } 198 MainApplication.undoRedo.add(new SequenceCommand("Import primitives", cmds));200 UndoRedoHandler.getInstance().add(new SequenceCommand("Import primitives", cmds)); 199 201 } 200 202 -
applications/editors/josm/plugins/importvec/src/org/openstreetmap/josm/plugins/importvec/SvgImporter.java
r33564 r34520 9 9 import javax.swing.JOptionPane; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.actions.ExtensionFileFilter; 13 12 import org.openstreetmap.josm.gui.MainApplication; … … 34 33 public void importData(List<File> files, ProgressMonitor progressMonitor) throws IOException, IllegalDataException { 35 34 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")); 37 36 return; 38 37 }
Note:
See TracChangeset
for help on using the changeset viewer.