Changeset 33676 in osm
- Timestamp:
- 2017-09-26T19:23:48+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2
- Property svn:ignore
-
old new 3 3 findbugs-josm-utilsplugin2.xml 4 4 MANIFEST 5 spotbugs-josm-utilsplugin2.xml
-
- Property svn:ignore
-
applications/editors/josm/plugins/utilsplugin2/build.xml
r33579 r33676 5 5 <property name="commit.message" value="[josm_utilsplugin2]: select boundary by double-click; multitagger table highlights"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="12 678"/>7 <property name="plugin.main.version" value="12840"/> 8 8 9 9 <property name="plugin.author" value="Kalle Lampila, Upliner, Zverik, akks, joshdoe and others"/> -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/ExtractPointAction.java
r33579 r33676 14 14 import javax.swing.JOptionPane; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.actions.JosmAction; 18 17 import org.openstreetmap.josm.command.AddCommand; … … 21 20 import org.openstreetmap.josm.command.MoveCommand; 22 21 import org.openstreetmap.josm.command.SequenceCommand; 22 import org.openstreetmap.josm.data.osm.DataSet; 23 23 import org.openstreetmap.josm.data.osm.Node; 24 24 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 46 46 @Override 47 47 public void actionPerformed(ActionEvent e) { 48 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 48 DataSet ds = getLayerManager().getEditDataSet(); 49 Collection<OsmPrimitive> selection = ds.getSelected(); 49 50 List<Node> selectedNodes = OsmPrimitive.getFilteredList(selection, Node.class); 50 51 if (selectedNodes.size() != 1) { … … 61 62 cmds.add(new MoveCommand(nd, MainApplication.getMap().mapView.getLatLon(p.x, p.y))); 62 63 List<OsmPrimitive> refs = nd.getReferrers(); 63 cmds.add(new AddCommand( ndCopy));64 cmds.add(new AddCommand(ds, ndCopy)); 64 65 65 66 for (OsmPrimitive pr: refs) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java
r33579 r33676 19 19 20 20 import org.openstreetmap.josm.actions.JosmAction; 21 import org.openstreetmap.josm.actions.SplitWayAction;22 21 import org.openstreetmap.josm.command.DeleteCommand; 22 import org.openstreetmap.josm.command.SplitWayCommand; 23 23 import org.openstreetmap.josm.data.osm.Node; 24 24 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 185 185 } 186 186 187 List<List<Node>> wayChunks = SplitWay Action.buildSplitChunks(selectedWay, selectedNodes);187 List<List<Node>> wayChunks = SplitWayCommand.buildSplitChunks(selectedWay, selectedNodes); 188 188 if (wayChunks != null) { 189 189 // close the chunks … … 208 208 } 209 209 } 210 SplitWay Action.SplitWayResult result = SplitWayAction.splitWay(211 getLayerManager().getEditLayer(),selectedWay, wayChunks, Collections.<OsmPrimitive>emptyList());212 MainApplication.undoRedo.add(result .getCommand());210 SplitWayCommand result = SplitWayCommand.splitWay( 211 selectedWay, wayChunks, Collections.<OsmPrimitive>emptyList()); 212 MainApplication.undoRedo.add(result); 213 213 if (splitWay != null) 214 214 MainApplication.undoRedo.add(new DeleteCommand(splitWay)); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitOnIntersectionsAction.java
r33579 r33676 16 16 17 17 import org.openstreetmap.josm.actions.JosmAction; 18 import org.openstreetmap.josm.actions.SplitWayAction;19 18 import org.openstreetmap.josm.command.Command; 20 19 import org.openstreetmap.josm.command.SequenceCommand; 20 import org.openstreetmap.josm.command.SplitWayCommand; 21 21 import org.openstreetmap.josm.data.osm.Node; 22 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 85 85 86 86 for (Way splitWay : splitWays.keySet()) { 87 List<List<Node>> wayChunks = SplitWay Action.buildSplitChunks(splitWay, splitWays.get(splitWay));87 List<List<Node>> wayChunks = SplitWayCommand.buildSplitChunks(splitWay, splitWays.get(splitWay)); 88 88 if (wayChunks != null) { 89 List<OsmPrimitive> sel = new ArrayList<>(selectedWays.size()); 90 sel.addAll(selectedWays); 91 SplitWayAction.SplitWayResult result = SplitWayAction.splitWay(getLayerManager().getEditLayer(), splitWay, wayChunks, sel); 92 list.add(result.getCommand()); 89 list.add(SplitWayCommand.splitWay(splitWay, wayChunks, new ArrayList<>(selectedWays))); 93 90 } 94 91 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/UnGlueRelationAction.java
r33579 r33676 11 11 import java.util.List; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.actions.JosmAction; 15 14 import org.openstreetmap.josm.command.AddCommand; 16 15 import org.openstreetmap.josm.command.Command; 17 16 import org.openstreetmap.josm.command.SequenceCommand; 17 import org.openstreetmap.josm.data.osm.DataSet; 18 18 import org.openstreetmap.josm.data.osm.Node; 19 19 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 52 52 LinkedList<Command> cmds = new LinkedList<>(); 53 53 List<OsmPrimitive> newPrimitives = new LinkedList<>(); 54 Collection<OsmPrimitive> selection = getLayerManager().getEditDataSet().getSelected(); 54 DataSet ds = getLayerManager().getEditDataSet(); 55 Collection<OsmPrimitive> selection = ds.getSelected(); 55 56 56 57 for (OsmPrimitive p : selection) { … … 69 70 } 70 71 newPrimitives.add(newp); 71 cmds.add(new AddCommand( newp));72 cmds.add(new ChangeRelationMemberCommand( relation, p, newp));72 cmds.add(new AddCommand(ds, newp)); 73 cmds.add(new ChangeRelationMemberCommand(ds, relation, p, newp)); 73 74 } else { 74 75 first = false; … … 83 84 //Set selection all primiteves (new and old) 84 85 newPrimitives.addAll(selection); 85 getLayerManager().getEditDataSet().setSelected(newPrimitives);86 ds.setSelected(newPrimitives); 86 87 MainApplication.getMap().mapView.repaint(); 87 88 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/command/ChangeRelationMemberCommand.java
r33522 r33676 9 9 10 10 import org.openstreetmap.josm.command.Command; 11 import org.openstreetmap.josm.data.osm.DataSet; 11 12 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 12 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 25 26 private boolean oldModified; 26 27 27 public ChangeRelationMemberCommand(Relation relation, OsmPrimitive oldMember, OsmPrimitive newMember) { 28 public ChangeRelationMemberCommand(DataSet ds, Relation relation, OsmPrimitive oldMember, OsmPrimitive newMember) { 29 super(ds); 28 30 this.relation = relation; 29 31 this.oldMember = oldMember; -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java
r32725 r33676 18 18 import org.openstreetmap.josm.command.Command; 19 19 import org.openstreetmap.josm.data.coor.EastNorth; 20 import org.openstreetmap.josm.data.osm.DataSet; 20 21 import org.openstreetmap.josm.data.osm.Node; 21 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 23 import org.openstreetmap.josm.data.osm.Way; 24 import org.openstreetmap.josm.gui.MainApplication; 23 25 24 26 public final class CircleArcMaker { … … 68 70 69 71 Set<Way> targetWays = new HashSet<>(); 72 DataSet ds = MainApplication.getLayerManager().getEditDataSet(); 70 73 71 74 boolean nodesHaveBeenChoosen = false; … … 79 82 Way newWay = new Way(); 80 83 targetWays.add(newWay); 81 cmds.add(new AddCommand( newWay));84 cmds.add(new AddCommand(ds, newWay)); 82 85 newWay.addNode(n1); 83 86 newWay.addNode(n2); … … 149 152 Node n = new Node(p); 150 153 arcNodes.add(n); 151 cmds.add(new AddCommand( n));154 cmds.add(new AddCommand(ds, n)); 152 155 } 153 156 i++; -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CurveAction.java
r33579 r33676 39 39 private void updatePreferences() { 40 40 // @formatter:off 41 angleSeparation = Main.pref.getInt eger(prefKey("circlearc.angle-separation"), 20);41 angleSeparation = Main.pref.getInt(prefKey("circlearc.angle-separation"), 20); 42 42 // @formatter:on 43 43 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/ChooseURLAction.java
r32410 r33676 87 87 if (dialog.getValue() == 1 && idx >= 0) { 88 88 URLList.select(vals[idx]); 89 Main.pref.put ("utilsplugin2.askurl", check1.isSelected());89 Main.pref.putBoolean("utilsplugin2.askurl", check1.isSelected()); 90 90 } 91 91 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/URLList.java
r33579 r33676 47 47 items.add("Browse element [demo, =Ctrl-Shift-I]"); 48 48 items.add("https://www.openstreetmap.org/{#type}/{#id}"); 49 Main.pref.put Collection("utilsplugin2.urlHistory", items);49 Main.pref.putList("utilsplugin2.urlHistory", items); 50 50 Main.pref.put("utilsplugin2.customurl", items.get(9)); 51 51 return items; … … 53 53 54 54 public static List<String> getURLList() { 55 List<String> items = (List<String>) Main.pref.getCollection("utilsplugin2.urlHistory");55 List<String> items = Main.pref.getList("utilsplugin2.urlHistory"); 56 56 if (items == null || items.isEmpty()) { 57 57 resetURLList(); 58 items = (List<String>) Main.pref.getCollection("utilsplugin2.urlHistory");58 items = Main.pref.getList("utilsplugin2.urlHistory"); 59 59 } 60 60 return items; … … 62 62 63 63 public static void updateURLList(List<String> lst) { 64 Main.pref.put Collection("utilsplugin2.urlHistory", lst);64 Main.pref.putList("utilsplugin2.urlHistory", lst); 65 65 try { 66 66 Main.pref.save(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java
r33579 r33676 16 16 import org.openstreetmap.josm.command.SequenceCommand; 17 17 import org.openstreetmap.josm.data.coor.LatLon; 18 import org.openstreetmap.josm.data.osm.DataSet; 18 19 import org.openstreetmap.josm.data.osm.Node; 19 20 import org.openstreetmap.josm.data.osm.Way; … … 62 63 // first we create all the nodes, then we do extra stuff based on what geometry type we need. 63 64 LinkedList<Node> nodes = new LinkedList<>(); 65 DataSet ds = getLayerManager().getEditDataSet(); 64 66 65 67 for (LatLon ll : coordinates) { 66 68 Node nnew = new Node(ll); 67 69 nodes.add(nnew); 68 cmds.add(new AddCommand( nnew));70 cmds.add(new AddCommand(ds, nnew)); 69 71 } 70 72 … … 74 76 Way wnew = new Way(); 75 77 wnew.setNodes(nodes); 76 cmds.add(new AddCommand( wnew));78 cmds.add(new AddCommand(ds, wnew)); 77 79 } else if ("area".equals(type)) { 78 80 nodes.add(nodes.get(0)); // this is needed to close the way. 79 81 Way wnew = new Way(); 80 82 wnew.setNodes(nodes); 81 cmds.add(new AddCommand( wnew));83 cmds.add(new AddCommand(ds, wnew)); 82 84 } 83 85 MainApplication.undoRedo.add(new SequenceCommand(tr("Lat Lon tool"), cmds)); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonDialog.java
r33579 r33676 33 33 34 34 import org.openstreetmap.josm.Main; 35 import org.openstreetmap.josm.data.coor.CoordinateFormat;36 35 import org.openstreetmap.josm.data.coor.LatLon; 36 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; 37 import org.openstreetmap.josm.data.coor.conversion.ICoordinateFormat; 38 import org.openstreetmap.josm.data.coor.conversion.LatLonParser; 37 39 import org.openstreetmap.josm.gui.ExtendedDialog; 38 40 import org.openstreetmap.josm.gui.util.WindowGeometry; … … 58 60 private static final String SEC = "\u2033"; 59 61 60 private static final char N_TR = LatLon .NORTH.charAt(0);61 private static final char S_TR = LatLon .SOUTH.charAt(0);62 private static final char E_TR = LatLon .EAST.charAt(0);63 private static final char W_TR = LatLon .WEST.charAt(0);62 private static final char N_TR = LatLonParser.NORTH.charAt(0); 63 private static final char S_TR = LatLonParser.SOUTH.charAt(0); 64 private static final char E_TR = LatLonParser.EAST.charAt(0); 65 private static final char W_TR = LatLonParser.WEST.charAt(0); 64 66 65 67 private static final Pattern p = Pattern.compile( … … 179 181 this.latLonCoordinates = ll; 180 182 String text = ""; 183 ICoordinateFormat format = CoordinateFormatManager.getDefaultFormat(); 181 184 for (LatLon latlon : ll) { 182 text = text + latlon.latToString(CoordinateFormat.getDefaultFormat()) 183 + " " + latlon.lonToString(CoordinateFormat.getDefaultFormat()) + "\n"; 185 text = text + format.latToString(latlon) + " " + format.lonToString(latlon) + "\n"; 184 186 } 185 187 taLatLon.setText(text); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java
r33579 r33676 151 151 private void loadHistory() { 152 152 List<String> cmtHistory = new LinkedList<>( 153 Main.pref.get Collection(HISTORY_KEY, Arrays.asList(defaultHistory)));153 Main.pref.getList(HISTORY_KEY, Arrays.asList(defaultHistory))); 154 154 Collections.reverse(cmtHistory); 155 155 cbTagSet.setPossibleItems(cmtHistory); … … 213 213 private void initAutocompletion() { 214 214 OsmDataLayer l = MainApplication.getLayerManager().getEditLayer(); 215 AutoCompletionManager autocomplete = l.data.getAutoCompletionManager();215 AutoCompletionManager autocomplete = AutoCompletionManager.of(l.data); 216 216 for (int i = 0; i < tableModel.mainTags.length; i++) { 217 217 if (tableModel.isSpecialTag[i]) continue; … … 303 303 history = Arrays.asList(defaultHistory); 304 304 } 305 Main.pref.put Collection(HISTORY_KEY, history);305 Main.pref.putList(HISTORY_KEY, history); 306 306 loadHistory(); 307 307 } … … 336 336 oldTags = s; 337 337 cbTagSet.addCurrentItemToHistory(); 338 Main.pref.put Collection(HISTORY_KEY, cbTagSet.getHistory());338 Main.pref.putList(HISTORY_KEY, cbTagSet.getHistory()); 339 339 specifyTagSet(s); 340 340 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryUtils.java
r33579 r33676 112 112 // FIXME: handle different layers 113 113 List<Command> commands = new ArrayList<>(); 114 Command c = MergeNodesAction.mergeNodes( MainApplication.getLayerManager().getEditLayer(),114 Command c = MergeNodesAction.mergeNodes( 115 115 Arrays.asList(subjectNode, referenceNode), referenceNode); 116 116 if (c == null) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInRelationsMatch.java
r33522 r33676 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import org.openstreetmap.josm.data.osm.Changeset;7 6 import org.openstreetmap.josm.data.osm.Node; 8 7 import org.openstreetmap.josm.data.osm.OsmPrimitive; 9 8 import org.openstreetmap.josm.data.osm.Relation; 10 9 import org.openstreetmap.josm.data.osm.Way; 10 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer; 11 11 import org.openstreetmap.josm.data.osm.search.SearchParseError; 12 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer; 13 import org.openstreetmap.josm.data.osm.visitor.Visitor; 12 import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor; 14 13 15 14 /** … … 25 24 } 26 25 27 private static class RelationCounter implements Visitor {26 private static class RelationCounter implements OsmPrimitiveVisitor { 28 27 int count; 29 28 @Override … … 40 39 public void visit(Relation r) { 41 40 count++; 42 }43 44 @Override45 public void visit(Changeset cs) {46 // Do nothing47 41 } 48 42 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UsedInWaysMatch.java
r33522 r33676 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import org.openstreetmap.josm.data.osm.Changeset;7 6 import org.openstreetmap.josm.data.osm.Node; 8 7 import org.openstreetmap.josm.data.osm.OsmPrimitive; 9 8 import org.openstreetmap.josm.data.osm.Relation; 10 9 import org.openstreetmap.josm.data.osm.Way; 10 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer; 11 11 import org.openstreetmap.josm.data.osm.search.SearchParseError; 12 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer; 13 import org.openstreetmap.josm.data.osm.visitor.Visitor; 12 import org.openstreetmap.josm.data.osm.visitor.OsmPrimitiveVisitor; 14 13 15 14 /** … … 25 24 } 26 25 27 private static class WayCounter implements Visitor {26 private static class WayCounter implements OsmPrimitiveVisitor { 28 27 int count; 29 28 @Override … … 39 38 @Override 40 39 public void visit(Relation r) { 41 // Do nothing42 }43 44 @Override45 public void visit(Changeset cs) {46 40 // Do nothing 47 41 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java
r32725 r33676 32 32 public final class NodeWayUtils { 33 33 34 static final int maxLevel = Main.pref.getInt eger("selection.maxrecursion", 15);35 static final int maxWays = Main.pref.getInt eger("selection.maxfoundways", 2000);36 static final int maxWays1 = Main.pref.getInt eger("selection.maxfoundways.intersection", 500);34 static final int maxLevel = Main.pref.getInt("selection.maxrecursion", 15); 35 static final int maxWays = Main.pref.getInt("selection.maxfoundways", 2000); 36 static final int maxWays1 = Main.pref.getInt("selection.maxfoundways.intersection", 500); 37 37 38 38 private NodeWayUtils() {
Note:
See TracChangeset
for help on using the changeset viewer.