Re: [josm-dev] [PATCH 1/2] QuadBuckets (using quad tiling) for node storage in JOSM
I ran josm with your patch. Here are some initial general observations which do not include any analysis of the algorithm itself. It seems the QuadBuckets class is referenced only through the CollectionNode interface, and none of the features (i.e. fast searching within a bbox) are actually used? Rather than adding dead code (presumably with a view to enabling it later), an easier path into the trunk might be to first refactor josm to use a SpatialIndex interface that initially is backed by a List/Collection (i.e. low risk and no change to current performance), and adding working indexes later (initially via plugins for testing). Another observation: It looks like QuadBuckets only works with actual Lat/Longs (i.e. no numbers above 360). It would be nice to handle arbitrary coordinates - two use cases that come to mind are: 1. index screen coordinates (e.g. so that a highlight can follow the nearest object to the cursor and indicate what would be selected if the mouse was clicked). 2. index projected coordinates Finally, a spatial index implementation should be generic enough to be used in multiple places in the code (e.g. an index of way segments, or whatever), so implementing CollectionNode is too specialised. Aled ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev
[josm-dev] Accidentally deleted the National Byway cycle route...
A fellow mapper has kindly informed me that my changeset 2315455 appears to have deleted all the members from the National Byway cycle route. Unfortunately I am not sure how to revert this changeset; If anyone is able to revert this for me I would be most grateful. I think the problem may have been caused by a bug in josm. I was using josm-latest.jar, downloaded on 2008-08-08 21:28. I made some small edits to the cycle path around Rutland Water, where it was wrong at the car park near Whitwell. When I tried to upload, it told me there were conflicts; the conflict merging dialog seemed to resolve it. I didn't pay much attention to what the conflicts were, it told me everything was merged OK. Then I uploaded my changes. The terminal window from which I launched josm is still open on my computer, and I can mail the output from the terminal to anyone who can make use of it. There are a couple of null pointer exceptions, not sure how relevant it is. (I will put every effort into reverting the offending changeset myself, however the earliest I can even start looking at how to do this is 13th September) Aled. ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev
Re: [josm-dev] Patch for Align nodes straight and parallel action
if you want to make, for example, 4 ways straight and parallel using this action, you would simply shift-click 4 times, then press equals. If there was a method that made ways parallel (but did not automatically straighten them), then you would need click then L 4 times, then shift-click 4 times, then equals. The code for make ways parallel but preserve curves is going to be significantly more complicated, so I thought I would do them separately. Aled. On Sun, Aug 31, 2008 at 9:54 AM, Dirk Stöcker [EMAIL PROTECTED] wrote: On Sun, 31 Aug 2008, A Morris wrote: I intend to make a 'Align nodes curved and parallel' next, but I thought I'd start with an easier one :-) Wouldn't an Make ways parallel be enough. You can make a second way parallel to the first selected one. To make a way straight there is already a function in JOSM. Ciao -- http://www.dstoecker.eu/ (PGP key available) ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev
Re: [josm-dev] Patch for Align nodes straight and parallel action
You're right, that the action probably needs more clicks. but making ways straight and aligned is not such an often done task, so for me the negative fact to have more different tools counts more :-) I'm not sure how having additional tools is a negative? I agree it isn't the most common operation, but there are perfectly legitimate uses; for instance, aisles in a parking area or a grid of streets. I will happily integrate a patch which makes two ways parallel without needing special way design. This is also a long-standing feature request. http://josm.openstreetmap.de/ticket/67 You can also make a request: What do you want to do? straigthen ways, relative to first, relative to mean Surely separate actions would be more useful (make parallel and make straight and parallel); it would be really annoying to have to select from a dialog box every time the action was used. (I don't see how the third option relative to first would work, how would the algorithm know which is first?) Aled. ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev
[josm-dev] how to create icons?
I have implemented a new 'action' in josm, but it needs an icon in the menu. What is the preferred way to create these icons? Cheers, Aled. ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev
Re: [josm-dev] how to create icons?
Thanks for the suggestions - I've cobbled something together in gimp, though the quality reflects my artistic talent, I'm afraid. Aled. ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev
[josm-dev] Patch for Align nodes straight and parallel action
This is a patch against the latest svn, please try it out. Bug reports welcome. Basically it adds a new action Align nodes straight and parallel. It requires that two or more ways are selected (this is required, as otherwise the algorithm wouldn't know which nodes were in which line). The nodes will be moved so that they are straight and parallel. You can optionally select a subset of nodes in the way, and only the selected nodes will be moved. I intend to make a 'Align nodes curved and parallel' next, but I thought I'd start with an easier one :-) Aled. === added file 'images/alignparallel.png' Binary files images/alignparallel.png 1970-01-01 00:00:00 + and images/alignparallel.png 2008-08-30 23:01:27 + differ === added file 'src/org/openstreetmap/josm/actions/AlignNodesStraightAndParallel.java' --- src/org/openstreetmap/josm/actions/AlignNodesStraightAndParallel.java 1970-01-01 00:00:00 + +++ src/org/openstreetmap/josm/actions/AlignNodesStraightAndParallel.java 2008-08-30 23:46:11 + @@ -0,0 +1,193 @@ +// AlignWaysStraightAndParallel.java + +//Copyright (C) 2008 Aled Morris [EMAIL PROTECTED] +// +//This program is free software: you can redistribute it and/or modify +//it under the terms of the GNU General Public License as published by +//the Free Software Foundation, either version 2 of the License, or +//(at your option) any later version. +// +//This program is distributed in the hope that it will be useful, +//but WITHOUT ANY WARRANTY; without even the implied warranty of +//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//GNU General Public License for more details. +// +//You should have received a copy of the GNU General Public License +//along with this program. If not, see http://www.gnu.org/licenses/. + +package org.openstreetmap.josm.actions; + +import static org.openstreetmap.josm.tools.I18n.tr; + +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.LinkedList; + +import javax.swing.JOptionPane; + +import org.openstreetmap.josm.Main; +import org.openstreetmap.josm.command.Command; +import org.openstreetmap.josm.command.MoveCommand; +import org.openstreetmap.josm.command.SequenceCommand; +import org.openstreetmap.josm.data.Bearing; +import org.openstreetmap.josm.data.osm.Node; +import org.openstreetmap.josm.data.osm.OsmPrimitive; +import org.openstreetmap.josm.data.osm.Way; + +public final class AlignNodesStraightAndParallel extends JosmAction { + + public AlignNodesStraightAndParallel() { + super(tr(Align Nodes in Parallel Lines), alignparallel, tr(Move the selected nodes to make them straight and parallel), KeyEvent.VK_EQUALS, 0, true); + } + + /** +* User must select two or more ways. The algorithm moves all the nodes in the ways so they are straight and parallel. +* The user may also optionally select a subset of nodes within the way(s); only the selected nodes will be moved. +*/ + public void actionPerformed(ActionEvent e) { + CollectionOsmPrimitive sel = Main.ds.getSelected(); + HashSetNode selectedNodes = new HashSetNode(); + CollectionWay selectedWays = new LinkedListWay(); + + for (OsmPrimitive osm : sel) + { + if (osm instanceof Node) { + selectedNodes.add((Node)osm); + } + else if (osm instanceof Way) { + selectedWays.add(((Way)osm)); + } + } + + if (selectedWays.size() 2) { + JOptionPane.showMessageDialog(Main.parent, tr(Please select at least two ways (and optionally, a subset of the way's nodes).)); + return; + } + + ArrayListArrayListNode nodeChains = new ArrayListArrayListNode(); + + // Go through each way that was selected, and create a node chain containing either: a) all the nodes in the way + // or b) just the nodes that were selected in the way. + for (Way way : selectedWays) { + ArrayListNode nodeChain = new ArrayListNode(); + + // see if any of the nodes in the way were selected; if so, add them to the chain. + for (Node node : way.nodes) { + if (selectedNodes.contains(node)) { + nodeChain.add(node); + selectedNodes.remove(node); // Ensure no node is added twice (can happen in circular ways
Re: [josm-dev] patch for JOSM runtime error on MacOS
I don't knowingly use an external styles file - I simply tried to build and run the latest JOSM revision. Is it not a problem that icon files that are referenced in the source code do not exist in SVN? Cheers, Aled. On Sat, Aug 23, 2008 at 9:10 PM, Dirk Stöcker [EMAIL PROTECTED] wrote: On Sat, 23 Aug 2008, A Morris wrote: I am trying to run the latest SVN revision of JOSM in eclipse on a Mac. The code builds, but does not run; it hangs inside the native method Object.wait() in ElemStyleHandler. The offending line is: curIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(path)); I note that the file 'misc/no_icon.png' (which it is trying to load) does not exist anywhere in my filesystem. (Actually neither does 'amenity.png'). I have applied the following patch which seems to have fixed the problem on my system (the hang, that is, not the fact that icons seem to be missing): You use an external styles file? It must have some errors. The problem is, that the internal style names aren't properly initialized in case an external file is loaded. I will fix that. Ciao -- http://www.dstoecker.eu/ (PGP key available) ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev
Re: [josm-dev] patch for JOSM runtime error on MacOS
Aha. I had forgotten I had obtained out the code from launchpad.net, mainly to see if it worked, which obviously, it didn't. (something to do with svn externals?). It works fine when checked out directly from svn. (I had deleted ~/.josm, so that wasn't a factor) Cheers, Aled. On Sat, Aug 23, 2008 at 10:23 PM, Dirk Stöcker [EMAIL PROTECTED] wrote: On Sat, 23 Aug 2008, A Morris wrote: I don't knowingly use an external styles file - I simply tried to build and run the latest JOSM revision. I fixed that access. Should work now for you too. a) Could you paste any lines with mappaint in your josm-preferences here. b) Please list the whole content of your josm dir. (~/.josm under Linux). Is it not a problem that icon files that are referenced in the source code do not exist in SVN? They are there: images/styles/standard/ Ciao -- http://www.dstoecker.eu/ (PGP key available) ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev ___ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev