Changeset 34468 in osm for applications/editors/josm/plugins/lakewalker
- Timestamp:
- 2018-08-15T02:07:09+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/lakewalker
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/lakewalker/build.xml
r33712 r34468 5 5 <property name="commit.message" value="Changed the constructor signature of the plugin main class"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 2856"/>7 <property name="plugin.main.version" value="14153"/> 8 8 9 9 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
r33712 r34468 19 19 import javax.swing.JOptionPane; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.actions.JosmAction; 23 22 import org.openstreetmap.josm.command.AddCommand; 24 23 import org.openstreetmap.josm.command.Command; 25 24 import org.openstreetmap.josm.command.SequenceCommand; 25 import org.openstreetmap.josm.data.UndoRedoHandler; 26 26 import org.openstreetmap.josm.data.coor.LatLon; 27 27 import org.openstreetmap.josm.data.osm.DataSet; … … 32 32 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 33 33 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 34 import org.openstreetmap.josm.spi.preferences.Config; 34 35 import org.openstreetmap.josm.tools.ImageProvider; 35 36 import org.openstreetmap.josm.tools.Logging; … … 79 80 */ 80 81 private void cleanupCache() { 81 final long maxCacheAge = System.currentTimeMillis()- Main.pref.getInt(LakewalkerPreferences.PREF_MAXCACHEAGE, 100)*24*60*60*1000L;82 final long maxCacheSize = Main.pref.getInt(LakewalkerPreferences.PREF_MAXCACHESIZE, 300)*1024*1024L;82 final long maxCacheAge = System.currentTimeMillis()-Config.getPref().getInt(LakewalkerPreferences.PREF_MAXCACHEAGE, 100)*24*60*60*1000L; 83 final long maxCacheSize = Config.getPref().getInt(LakewalkerPreferences.PREF_MAXCACHESIZE, 300)*1024*1024L; 83 84 84 85 for (String wmsFolder : LakewalkerPreferences.WMSLAYERS) { … … 112 113 // create cache directory 113 114 if (!wmsCacheDir.mkdirs()) { 114 JOptionPane.showMessageDialog(Main .parent,115 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 115 116 tr("Error creating cache directory: {0}", wmsCacheDir.getPath())); 116 117 } … … 129 130 * Collect options 130 131 */ 131 final int waylen = Main.pref.getInt(LakewalkerPreferences.PREF_MAX_SEG, 500);132 final int maxnode = Main.pref.getInt(LakewalkerPreferences.PREF_MAX_NODES, 50000);133 final int threshold = Main.pref.getInt(LakewalkerPreferences.PREF_THRESHOLD_VALUE, 90);134 final double epsilon = Main.pref.getDouble(LakewalkerPreferences.PREF_EPSILON, 0.0003);135 final int resolution = Main.pref.getInt(LakewalkerPreferences.PREF_LANDSAT_RES, 4000);136 final int tilesize = Main.pref.getInt(LakewalkerPreferences.PREF_LANDSAT_SIZE, 2000);137 final String startdir = Main.pref.get(LakewalkerPreferences.PREF_START_DIR, "east");138 final String wmslayer = Main.pref.get(LakewalkerPreferences.PREF_WMS, "IR1");132 final int waylen = Config.getPref().getInt(LakewalkerPreferences.PREF_MAX_SEG, 500); 133 final int maxnode = Config.getPref().getInt(LakewalkerPreferences.PREF_MAX_NODES, 50000); 134 final int threshold = Config.getPref().getInt(LakewalkerPreferences.PREF_THRESHOLD_VALUE, 90); 135 final double epsilon = Config.getPref().getDouble(LakewalkerPreferences.PREF_EPSILON, 0.0003); 136 final int resolution = Config.getPref().getInt(LakewalkerPreferences.PREF_LANDSAT_RES, 4000); 137 final int tilesize = Config.getPref().getInt(LakewalkerPreferences.PREF_LANDSAT_SIZE, 2000); 138 final String startdir = Config.getPref().get(LakewalkerPreferences.PREF_START_DIR, "east"); 139 final String wmslayer = Config.getPref().get(LakewalkerPreferences.PREF_WMS, "IR1"); 139 140 140 141 try { … … 220 221 Node fn = null; 221 222 222 double eastOffset = Main.pref.getDouble(LakewalkerPreferences.PREF_EAST_OFFSET, 0.0);223 double northOffset = Main.pref.getDouble(LakewalkerPreferences.PREF_NORTH_OFFSET, 0.0);223 double eastOffset = Config.getPref().getDouble(LakewalkerPreferences.PREF_EAST_OFFSET, 0.0); 224 double northOffset = Config.getPref().getDouble(LakewalkerPreferences.PREF_NORTH_OFFSET, 0.0); 224 225 225 226 int nodesinway = 0; … … 245 246 way.addNode(n); 246 247 247 if (nodesinway > Main.pref.getInt(LakewalkerPreferences.PREF_MAX_SEG, 500)) {248 String waytype = Main.pref.get(LakewalkerPreferences.PREF_WAYTYPE, "water");248 if (nodesinway > Config.getPref().getInt(LakewalkerPreferences.PREF_MAX_SEG, 500)) { 249 String waytype = Config.getPref().get(LakewalkerPreferences.PREF_WAYTYPE, "water"); 249 250 250 251 if (!waytype.equals("none")) { … … 252 253 } 253 254 254 way.put("source", Main.pref.get(LakewalkerPreferences.PREF_SOURCE, "Landsat"));255 way.put("source", Config.getPref().get(LakewalkerPreferences.PREF_SOURCE, "Landsat")); 255 256 commands.add(new AddCommand(ds, way)); 256 257 … … 265 266 266 267 267 String waytype = Main.pref.get(LakewalkerPreferences.PREF_WAYTYPE, "water");268 String waytype = Config.getPref().get(LakewalkerPreferences.PREF_WAYTYPE, "water"); 268 269 269 270 if (!waytype.equals("none")) { … … 271 272 } 272 273 273 way.put("source", Main.pref.get(LakewalkerPreferences.PREF_SOURCE, "Landsat"));274 way.put("source", Config.getPref().get(LakewalkerPreferences.PREF_SOURCE, "Landsat")); 274 275 275 276 way.addNode(fn); … … 278 279 279 280 if (!commands.isEmpty()) { 280 Main.main.undoRedo.add(new SequenceCommand(tr("Lakewalker trace"), commands));281 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Lakewalker trace"), commands)); 281 282 ds.setSelected(ways); 282 283 } else { -
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java
r33912 r34468 6 6 import java.io.File; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.gui.MainApplication; 10 9 import org.openstreetmap.josm.gui.MainMenu; … … 12 11 import org.openstreetmap.josm.plugins.Plugin; 13 12 import org.openstreetmap.josm.plugins.PluginInformation; 13 import org.openstreetmap.josm.spi.preferences.Config; 14 14 15 15 /** … … 30 30 31 31 public static File getLakewalkerCacheDir() { 32 return new File( Main.pref.getDirs().getCacheDirectory(true), "lakewalkerwms");32 return new File(Config.getDirs().getCacheDirectory(true), "lakewalkerwms"); 33 33 } 34 34 } -
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java
r33712 r34468 11 11 import javax.swing.JPanel; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 15 14 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; 15 import org.openstreetmap.josm.spi.preferences.Config; 16 16 import org.openstreetmap.josm.tools.GBC; 17 17 import org.openstreetmap.josm.tools.I18n; … … 98 98 buildPreferences(prefPanel); 99 99 100 maxSegsConfig.setValue( Main.pref.getInt(PREF_MAX_SEG, 500));101 maxNodesConfig.setValue( Main.pref.getInt(PREF_MAX_NODES, 50000));102 thresholdConfig.setValue( Main.pref.getInt(PREF_THRESHOLD_VALUE, 90));103 epsilonConfig.setValue( Main.pref.getDouble(PREF_EPSILON, 0.0003));104 landsatResConfig.setValue( Main.pref.getInt(PREF_LANDSAT_RES, 4000));105 landsatSizeConfig.setValue( Main.pref.getInt(PREF_LANDSAT_SIZE, 2000));106 eastOffsetConfig.setValue( Main.pref.getDouble(PREF_EAST_OFFSET, 0.0));107 northOffsetConfig.setValue( Main.pref.getDouble(PREF_NORTH_OFFSET, 0.0));108 startDirConfig.setValue( Main.pref.get(PREF_START_DIR, "east"));109 lakeTypeConfig.setValue( Main.pref.get(PREF_WAYTYPE, "water"));110 wmsConfig.setValue( Main.pref.get(PREF_WMS, "IR1"));111 sourceConfig.setValue( Main.pref.get(PREF_SOURCE, "Landsat"));112 maxCacheSizeConfig.setValue( Main.pref.getInt(PREF_MAXCACHESIZE, 300));113 maxCacheAgeConfig.setValue( Main.pref.getInt(PREF_MAXCACHEAGE, 100));100 maxSegsConfig.setValue(Config.getPref().getInt(PREF_MAX_SEG, 500)); 101 maxNodesConfig.setValue(Config.getPref().getInt(PREF_MAX_NODES, 50000)); 102 thresholdConfig.setValue(Config.getPref().getInt(PREF_THRESHOLD_VALUE, 90)); 103 epsilonConfig.setValue(Config.getPref().getDouble(PREF_EPSILON, 0.0003)); 104 landsatResConfig.setValue(Config.getPref().getInt(PREF_LANDSAT_RES, 4000)); 105 landsatSizeConfig.setValue(Config.getPref().getInt(PREF_LANDSAT_SIZE, 2000)); 106 eastOffsetConfig.setValue(Config.getPref().getDouble(PREF_EAST_OFFSET, 0.0)); 107 northOffsetConfig.setValue(Config.getPref().getDouble(PREF_NORTH_OFFSET, 0.0)); 108 startDirConfig.setValue(Config.getPref().get(PREF_START_DIR, "east")); 109 lakeTypeConfig.setValue(Config.getPref().get(PREF_WAYTYPE, "water")); 110 wmsConfig.setValue(Config.getPref().get(PREF_WMS, "IR1")); 111 sourceConfig.setValue(Config.getPref().get(PREF_SOURCE, "Landsat")); 112 maxCacheSizeConfig.setValue(Config.getPref().getInt(PREF_MAXCACHESIZE, 300)); 113 maxCacheAgeConfig.setValue(Config.getPref().getInt(PREF_MAXCACHEAGE, 100)); 114 114 } 115 115 … … 155 155 @Override 156 156 public boolean ok() { 157 Main.pref.put(PREF_MAX_SEG, maxSegsConfig.getValueString());158 Main.pref.put(PREF_MAX_NODES, maxNodesConfig.getValueString());159 Main.pref.put(PREF_THRESHOLD_VALUE, thresholdConfig.getValueString());160 Main.pref.put(PREF_EPSILON, epsilonConfig.getValueString());161 Main.pref.put(PREF_LANDSAT_RES, landsatResConfig.getValueString());162 Main.pref.put(PREF_LANDSAT_SIZE, landsatSizeConfig.getValueString());163 Main.pref.put(PREF_EAST_OFFSET, eastOffsetConfig.getValueString());164 Main.pref.put(PREF_NORTH_OFFSET, northOffsetConfig.getValueString());165 Main.pref.put(PREF_START_DIR, startDirConfig.getValueString());166 Main.pref.put(PREF_WAYTYPE, lakeTypeConfig.getValueString());167 Main.pref.put(PREF_WMS, wmsConfig.getValueString());168 Main.pref.put(PREF_MAXCACHESIZE, maxCacheSizeConfig.getValueString());169 Main.pref.put(PREF_MAXCACHEAGE, maxCacheAgeConfig.getValueString());170 Main.pref.put(PREF_SOURCE, sourceConfig.getValueString());157 Config.getPref().put(PREF_MAX_SEG, maxSegsConfig.getValueString()); 158 Config.getPref().put(PREF_MAX_NODES, maxNodesConfig.getValueString()); 159 Config.getPref().put(PREF_THRESHOLD_VALUE, thresholdConfig.getValueString()); 160 Config.getPref().put(PREF_EPSILON, epsilonConfig.getValueString()); 161 Config.getPref().put(PREF_LANDSAT_RES, landsatResConfig.getValueString()); 162 Config.getPref().put(PREF_LANDSAT_SIZE, landsatSizeConfig.getValueString()); 163 Config.getPref().put(PREF_EAST_OFFSET, eastOffsetConfig.getValueString()); 164 Config.getPref().put(PREF_NORTH_OFFSET, northOffsetConfig.getValueString()); 165 Config.getPref().put(PREF_START_DIR, startDirConfig.getValueString()); 166 Config.getPref().put(PREF_WAYTYPE, lakeTypeConfig.getValueString()); 167 Config.getPref().put(PREF_WMS, wmsConfig.getValueString()); 168 Config.getPref().put(PREF_MAXCACHESIZE, maxCacheSizeConfig.getValueString()); 169 Config.getPref().put(PREF_MAXCACHEAGE, maxCacheAgeConfig.getValueString()); 170 Config.getPref().put(PREF_SOURCE, sourceConfig.getValueString()); 171 171 return false; 172 172 }
Note:
See TracChangeset
for help on using the changeset viewer.