Changeset 33692 in osm for applications/editors
- Timestamp:
- 2017-10-03T22:17:31+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/addrinterpolation
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/addrinterpolation/build.xml
r32680 r33692 4 4 <property name="commit.message" value="Impoved Icon"/> 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="12726"/> 7 7 8 8 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/AddrInterpolationAction.java
r33005 r33692 27 27 } 28 28 29 @Override 29 30 public void actionPerformed(ActionEvent e) { 30 31 /*AddrInterpolationDialog addrDialog =*/ new AddrInterpolationDialog(tr("Define Address Interpolation")); 31 32 } 32 33 34 @Override 33 35 public void selectionChanged( 34 36 Collection<? extends OsmPrimitive> newSelection) { -
applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/AddrInterpolationDialog.java
r33005 r33692 24 24 import java.util.ArrayList; 25 25 import java.util.Collection; 26 import java.util.Collections; 27 import java.util.HashMap; 26 28 import java.util.LinkedList; 29 import java.util.Map; 27 30 import java.util.regex.Pattern; 28 31 … … 54 57 import org.openstreetmap.josm.data.osm.RelationMember; 55 58 import org.openstreetmap.josm.data.osm.Way; 59 import org.openstreetmap.josm.gui.MainApplication; 56 60 import org.openstreetmap.josm.gui.widgets.UrlLabel; 57 61 import org.openstreetmap.josm.tools.ImageProvider; … … 266 270 // Numeric increment box can be enabled or disabled. 267 271 addrInterpolationList.addActionListener(new ActionListener() { 272 @Override 268 273 public void actionPerformed(ActionEvent e) { 269 274 int selectedIndex = addrInterpolationList.getSelectedIndex(); … … 527 532 private String FindRelation() { 528 533 String relationDescription = null; 529 DataSet currentDataSet = Main .getLayerManager().getEditDataSet();534 DataSet currentDataSet = MainApplication.getLayerManager().getEditDataSet(); 530 535 if (currentDataSet != null) { 531 536 for (Relation relation : currentDataSet.getRelations()) { … … 574 579 int namedWayCount = 0; 575 580 int unNamedWayCount = 0; 576 DataSet currentDataSet = Main .getLayerManager().getEditDataSet();581 DataSet currentDataSet = MainApplication.getLayerManager().getEditDataSet(); 577 582 if (currentDataSet != null) { 578 583 for (OsmPrimitive osm : currentDataSet.getSelectedWays()) { … … 667 672 } 668 673 674 @Override 669 675 public void actionPerformed(ActionEvent e) { 670 676 if ("ok".equals(e.getActionCommand())) { … … 761 767 newHouseNumberNode.put("addr:housenumber", newHouseNumber); 762 768 763 commandGroup.add(new AddCommand( newHouseNumberNode));769 commandGroup.add(new AddCommand(MainApplication.getLayerManager().getEditDataSet(), newHouseNumberNode)); 764 770 houseNumberNodes.add(newHouseNumberNode); // Street, etc information to be added later 765 771 … … 863 869 newHouseNumberNode.put("addr:housenumber", newHouseNumber); 864 870 865 commandGroup.add(new AddCommand( newHouseNumberNode));871 commandGroup.add(new AddCommand(MainApplication.getLayerManager().getEditDataSet(), newHouseNumberNode)); 866 872 houseNumberNodes.add(newHouseNumberNode); // Street, etc information to be added later 867 873 … … 1011 1017 1012 1018 String streetName = selectedStreet.get("name"); 1019 DataSet currentDataSet = MainApplication.getLayerManager().getEditDataSet(); 1013 1020 1014 1021 if (addrInterpolationWay != null) { … … 1018 1025 1019 1026 // De-select address interpolation way; leave street selected 1020 DataSet currentDataSet = Main.getLayerManager().getEditDataSet(); 1021 if (currentDataSet != null) { 1022 currentDataSet.clearSelection(addrInterpolationWay); 1023 currentDataSet.clearSelection(lastNode); // Workaround for JOSM Bug #3838 1024 } 1027 currentDataSet.clearSelection(addrInterpolationWay); 1028 currentDataSet.clearSelection(lastNode); // Workaround for JOSM Bug #3838 1025 1029 1026 1030 String interpolationTagValue = selectedMethod; … … 1052 1056 // Relation button was selected 1053 1057 if (associatedStreetRelation == null) { 1054 CreateRelation( streetName);1058 CreateRelation(currentDataSet, streetName); 1055 1059 // relationChanged = true; (not changed since it was created) 1056 1060 } … … 1070 1074 AddToRelation(associatedStreetRelation, node, "house"); 1071 1075 } 1076 Map<String, String> tags = new HashMap<>(); 1072 1077 if ((city != null) || (streetNameButton.isSelected())) { 1073 1078 // Include street unconditionally if adding nodes only or city name specified 1074 commandGroup.add(new ChangePropertyCommand(node, "addr:street", streetName));1079 tags.put("addr:street", streetName); 1075 1080 } 1076 1081 // Set or remove remaining optional fields 1077 commandGroup.add(new ChangePropertyCommand(node, "addr:city", city)); 1078 commandGroup.add(new ChangePropertyCommand(node, "addr:state", state)); 1079 commandGroup.add(new ChangePropertyCommand(node, "addr:postcode", postCode)); 1080 commandGroup.add(new ChangePropertyCommand(node, "addr:country", country)); 1081 commandGroup.add(new ChangePropertyCommand(node, "addr:full", fullAddress)); 1082 tags.put("addr:city", city); 1083 tags.put("addr:state", state); 1084 tags.put("addr:postcode", postCode); 1085 tags.put("addr:country", country); 1086 tags.put("addr:full", fullAddress); 1087 commandGroup.add(new ChangePropertyCommand(currentDataSet, Collections.singleton(node), tags)); 1082 1088 } 1083 1089 … … 1087 1093 1088 1094 Main.main.undoRedo.add(new SequenceCommand(tr("Address Interpolation"), commandGroup)); 1089 Main .map.repaint();1095 MainApplication.getLayerManager().getEditLayer().invalidate(); 1090 1096 1091 1097 return true; … … 1109 1115 1110 1116 // Create Associated Street relation, add street, and add to list of commands to perform 1111 private void CreateRelation( String streetName) {1117 private void CreateRelation(DataSet currentDataSet, String streetName) { 1112 1118 associatedStreetRelation = new Relation(); 1113 1119 associatedStreetRelation.put("name", streetName); … … 1115 1121 RelationMember newStreetMember = new RelationMember("street", selectedStreet); 1116 1122 associatedStreetRelation.addMember(newStreetMember); 1117 commandGroup.add(new AddCommand( associatedStreetRelation));1123 commandGroup.add(new AddCommand(currentDataSet, associatedStreetRelation)); 1118 1124 } 1119 1125 -
applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/AddrInterpolationPlugin.java
r33005 r33692 2 2 package org.openstreetmap.josm.plugins.AddrInterpolation; 3 3 4 import org.openstreetmap.josm. Main;4 import org.openstreetmap.josm.gui.MainApplication; 5 5 import org.openstreetmap.josm.gui.MainMenu; 6 6 import org.openstreetmap.josm.plugins.Plugin; … … 9 9 public class AddrInterpolationPlugin extends Plugin { 10 10 11 AddrInterpolationAction action = null;12 13 11 /** 14 12 * constructor … … 16 14 public AddrInterpolationPlugin(PluginInformation info) { 17 15 super(info); 18 action = new AddrInterpolationAction(); 19 MainMenu.add(Main.main.menu.dataMenu, action, false, 0); 16 MainMenu.add(MainApplication.getMenu().dataMenu, new AddrInterpolationAction(), false, 0); 20 17 } 21 18 } -
applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/EscapeDialog.java
r33005 r33692 53 53 protected JRootPane createRootPane() { 54 54 ActionListener escapeActionListener = new ActionListener() { 55 @Override 55 56 public void actionPerformed(ActionEvent actionEvent) { 56 57 dispose(); 57 // setVisible(false);58 58 } 59 59 };
Note:
See TracChangeset
for help on using the changeset viewer.