[josm-dev] Jumbo Patch

Gabriel Ebner ge at gabrielebner.at
Sun Dec 16 23:26:56 GMT 2007


On Sun, Dec 16, 2007 at 02:05:06PM -0800, Dave Hansen wrote:
> On Sun, 2007-12-16 at 22:14 +0100, Gabriel Ebner wrote:
> > Wouldn't it make more sense to have an AddNodeToWayCommand, a
> > RemoveNodeFromWayCommand, and a ReplaceNodeInWayCommand, taking indices
> > instead of nodes?  This would get us rid of the highly complex Way.replace
> > logic, and we'd be able to properly support duplicate nodes, while making it
> > possible to better guard against erroneous requests.
> 
> I don't think indexes work, though.  If we have a way:
> 
>         W----X----Y----Z
>         
>         RemoveNodeFromCommand('X');
>         RemoveNodeFromCommand('Y');
>         
>         W----Z
>         
> On the other hand, if we work by indexes:
>         
>         W(0)----X(1)----Y(2)----Z(3)
>         
>         RemoveNodeFromCommand(1);
>         RemoveNodeFromCommand(2);
>         
> After first command executes
> 
>         W(0)----Y(1)----Z(2)
> 
> After second command:
> 
>         W(0)----Y(1)

Ouch.  You're right, of course.

- We could just start with the last index.  Obviously this would only work when
  we're dealing with ways and not with nodes.  (DuplicatedWayNodes,
  SplitWayAction)

- Sometimes we actually want to change all occurencies of a node (and not just
  the first one).  ReplaceAllNodesInWay?  (DuplicateNode,
  MotorwayIntersections, DeleteAction)

  Gabriel.




More information about the josm-dev mailing list