Changeset 33718 in osm
- Timestamp:
- 2017-10-14T00:20:49+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/FixAddresses
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FixAddresses
- Property svn:ignore
-
old new 2 2 checkstyle-josm-FixAddresses.xml 3 3 findbugs-josm-FixAddresses.xml 4 spotbugs-josm-FixAddresses.xml
-
- Property svn:ignore
-
applications/editors/josm/plugins/FixAddresses/build.xml
r32680 r33718 4 4 <property name="commit.message" value="[josm_fixadresses]: Fixes #josm8336"/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 0580"/>6 <property name="plugin.main.version" value="12840"/> 7 7 8 8 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/AddressEditContainer.java
r32970 r33718 10 10 11 11 import org.openstreetmap.josm.Main; 12 import org.openstreetmap.josm.data.osm. Changeset;12 import org.openstreetmap.josm.data.osm.DataSet; 13 13 import org.openstreetmap.josm.data.osm.Node; 14 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 24 24 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 25 25 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 26 import org.openstreetmap.josm.data.osm.visitor.Visitor; 26 import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor; 27 import org.openstreetmap.josm.gui.MainApplication; 27 28 import org.openstreetmap.josm.tools.CheckParameterUtil; 28 29 … … 43 44 * 44 45 */ 45 public class AddressEditContainer implements Visitor, DataSetListener, IAddressEditContainerListener, IProblemVisitor, IAllKnowingTrashHeap {46 public class AddressEditContainer implements OsmPrimitiveVisitor, DataSetListener, IAddressEditContainerListener, IProblemVisitor, IAllKnowingTrashHeap { 46 47 47 48 private Collection<? extends OsmPrimitive> workingSet; … … 300 301 } 301 302 302 @Override303 public void visit(Changeset cs) {304 }305 306 303 /** 307 304 * Gets the dictionary containing the collected streets. … … 489 486 invalidate(workingSet); 490 487 } else { 491 if (Main.getLayerManager().getEditDataSet() != null) { 492 invalidate(Main.getLayerManager().getEditDataSet().allPrimitives()); 488 DataSet ds = MainApplication.getLayerManager().getEditDataSet(); 489 if (ds != null) { 490 invalidate(ds.allPrimitives()); 493 491 } 494 492 } … … 708 706 * Internal class to handle results of {@link AddressEditContainer#getClosestStreetNames(String, int)}. 709 707 */ 710 private class StreetScore implements Comparable<StreetScore> {708 private static class StreetScore implements Comparable<StreetScore> { 711 709 private String name; 712 710 private int score; -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/FixAddressesMapMode.java
r30348 r33718 7 7 8 8 import org.openstreetmap.josm.actions.mapmode.MapMode; 9 import org.openstreetmap.josm.gui.MapFrame;10 9 11 10 @SuppressWarnings("serial") 12 11 public class FixAddressesMapMode extends MapMode { 13 12 14 public FixAddressesMapMode( MapFrame mapFrame) {13 public FixAddressesMapMode() { 15 14 super(tr("Fix addresses"), "incompleteaddress_24", 16 15 tr("Show dialog with incomplete addresses"), 17 mapFrame,18 16 Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); 19 17 } -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/FixAddressesPlugin.java
r30348 r33718 2 2 package org.openstreetmap.josm.plugins.fixAddresses; 3 3 4 import org.openstreetmap.josm.Main;5 4 import org.openstreetmap.josm.gui.IconToggleButton; 5 import org.openstreetmap.josm.gui.MainApplication; 6 6 import org.openstreetmap.josm.gui.MainMenu; 7 7 import org.openstreetmap.josm.gui.MapFrame; … … 30 30 31 31 // ... and add them to the tools menu in main 32 MainMenu.add(Main.main.menu.toolsMenu, action, false, 0);33 MainMenu.add(Main .main.menu.toolsMenu, incAddrAction);32 MainMenu.add(MainApplication.getMenu().toolsMenu, action, false, 0); 33 MainMenu.add(MainApplication.getMenu().toolsMenu, incAddrAction); 34 34 35 35 // create preferences instance … … 40 40 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 41 41 if (newFrame != null) { 42 FixAddressesMapMode faMode = new FixAddressesMapMode( Main.map);42 FixAddressesMapMode faMode = new FixAddressesMapMode(); 43 43 IconToggleButton faModeButton = new IconToggleButton(faMode); 44 44 faModeButton.setVisible(true); -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/FixAddressesPreferences.java
r32970 r33718 50 50 */ 51 51 private void saveToPrefs() { 52 Main.pref.put (FIX_ADDRESSES_SELECT_GUESSED_OBJECTS_KEY, isSelectGuessedObjects());53 Main.pref.put (FIX_ADDRESSES_IGNORE_POST_CODE_KEY, isIgnorePostCode());52 Main.pref.putBoolean(FIX_ADDRESSES_SELECT_GUESSED_OBJECTS_KEY, isSelectGuessedObjects()); 53 Main.pref.putBoolean(FIX_ADDRESSES_IGNORE_POST_CODE_KEY, isIgnorePostCode()); 54 54 } 55 55 -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/GuessAddressRunnable.java
r32970 r33718 9 9 import java.util.List; 10 10 11 import org.openstreetmap.josm. Main;11 import org.openstreetmap.josm.data.osm.DataSet; 12 12 import org.openstreetmap.josm.data.osm.Node; 13 13 import org.openstreetmap.josm.data.osm.Way; 14 import org.openstreetmap.josm.gui.MainApplication; 14 15 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 15 16 import org.openstreetmap.josm.io.OsmTransferException; … … 120 121 OsmTransferException { 121 122 122 if (Main.getLayerManager().getEditDataSet() == null || addressesToGuess == null) return; 123 DataSet ds = MainApplication.getLayerManager().getEditDataSet(); 124 if (ds == null || addressesToGuess == null) return; 123 125 124 126 isRunning = true; … … 153 155 154 156 // visit osm data 155 for (Way way : Main.getLayerManager().getEditDataSet().getWays()) {157 for (Way way : ds.getWays()) { 156 158 if (canceled) { 157 159 break; … … 173 175 174 176 // visit osm data 175 for (Node node : Main.getLayerManager().getEditDataSet().getNodes()) {177 for (Node node : ds.getNodes()) { 176 178 if (canceled) { 177 179 break; -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/GuessedValueHandler.java
r32970 r33718 2 2 package org.openstreetmap.josm.plugins.fixAddresses; 3 3 4 import org.openstreetmap.josm.data.osm.Changeset;5 4 import org.openstreetmap.josm.data.osm.Node; 6 5 import org.openstreetmap.josm.data.osm.OsmPrimitive; 7 6 import org.openstreetmap.josm.data.osm.Relation; 8 7 import org.openstreetmap.josm.data.osm.Way; 9 import org.openstreetmap.josm.data.osm.visitor. Visitor;8 import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor; 10 9 11 10 /** … … 16 15 * The default maximum distance is 100m. 17 16 */ 18 public class GuessedValueHandler implements Visitor {17 public class GuessedValueHandler implements OsmPrimitiveVisitor { 19 18 20 19 /** Default maximum distance (100m) */ … … 191 190 // nothing to do (yet) 192 191 } 193 194 @Override195 public void visit(Changeset cs) {196 // nothing to do (yet)197 }198 192 } -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OsmUtils.java
r32970 r33718 5 5 import java.util.Locale; 6 6 7 import org.openstreetmap.josm.Main;8 7 import org.openstreetmap.josm.data.Bounds; 9 8 import org.openstreetmap.josm.data.coor.LatLon; … … 14 13 import org.openstreetmap.josm.data.osm.Way; 15 14 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 15 import org.openstreetmap.josm.gui.MainApplication; 16 16 import org.openstreetmap.josm.tools.CheckParameterUtil; 17 17 import org.openstreetmap.josm.tools.Pair; … … 202 202 CheckParameterUtil.ensureParameterNotNull(addressList, "addressList"); 203 203 204 if ( Main.map == null && Main.map.mapView == null) return; // nothing to do205 if (addressList.size() == 0) return; 204 if (!MainApplication.isDisplayingMapView()) return; // nothing to do 205 if (addressList.size() == 0) return; // dto. 206 206 207 207 // compute bounding box … … 215 215 if (bbox.getBounds() != null) { 216 216 // zoom to calculated bounding box 217 Main .map.mapView.zoomTo(bbox.getBounds());217 MainApplication.getMap().mapView.zoomTo(bbox.getBounds()); 218 218 } 219 219 } -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/AbstractAddressEditAction.java
r32970 r33718 170 170 throw new RuntimeException("No command list available. Did you forget to call beginTransaction?"); 171 171 } 172 // execute the command 173 Main.main.undoRedo.add(new SequenceCommand(txName, commands)); 174 commands.clear(); 175 if (container != null) { 176 container.invalidate(); 172 // execute the commands 173 if (!commands.isEmpty()) { 174 Main.main.undoRedo.add(new SequenceCommand(txName, commands)); 175 commands.clear(); 176 if (container != null) { 177 container.invalidate(); 178 } 177 179 } 178 180 } -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/ConvertToRelationAction.java
r32970 r33718 55 55 // Create the relation 56 56 Relation r = new Relation(); 57 commands.add(new AddCommand( r));57 commands.add(new AddCommand(getLayerManager().getEditDataSet(), r)); 58 58 commands.add(new ChangePropertyCommand(r, TagConstants.NAME_TAG, streetNode.getName())); 59 59 commands.add(new ChangePropertyCommand(r, TagConstants.RELATION_TYPE, TagConstants.ASSOCIATEDSTREET_RELATION_TYPE)); -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/actions/GuessAddressDataAction.java
r32970 r33718 6 6 import java.util.List; 7 7 8 import org.openstreetmap.josm. Main;8 import org.openstreetmap.josm.gui.MainApplication; 9 9 import org.openstreetmap.josm.plugins.fixAddresses.AddressEditContainer; 10 10 import org.openstreetmap.josm.plugins.fixAddresses.GuessAddressRunnable; … … 66 66 GuessAddressRunnable aft = new GuessAddressRunnable(nodes, tr("Guessing address values")); 67 67 aft.addFinishListener(this); 68 Main .worker.submit(aft);68 MainApplication.worker.submit(aft); 69 69 } 70 70
Note:
See TracChangeset
for help on using the changeset viewer.