Ignore:
Timestamp:
2015-01-26T20:34:28+01:00 (10 years ago)
Author:
belecker
Message:

Fix Bug 10834: IllegalArgumentException when tracing buildings with Tracer2 plugin
To Delete a Node you need a DataSet. There for it is not possible to create a Node and Delete it afterwords.
https://josm.openstreetmap.de/ticket/10834

Location:
applications/editors/josm/plugins/tracer2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/tracer2/build.xml

    r30416 r30927  
    33
    44    <!-- enter the SVN commit message -->
    5     <property name="commit.message" value="Add link to wiki"/>
     5    <property name="commit.message" value="Fix Bug #10834"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    77    <property name="plugin.main.version" value="7001"/>
  • applications/editors/josm/plugins/tracer2/src/org/openstreetmap/josm/plugins/tracer2/ConnectWays.java

    r30737 r30927  
    153153        s_bAlt = alt;
    154154       
     155        boolean bAddWay = false;
     156       
    155157        calcDistance();
    156158        getNodes(newWay);
     
    161163        if (s_oWayOld == null) {
    162164                s_bAddNewWay = true;
    163                 cmds.add(new AddCommand(newWay));
     165                //cmds.add(new AddCommand(newWay));
     166                bAddWay = true;
    164167                s_oWayOld = newWay;
    165168                s_oWay = new Way( newWay );
     
    195198                cmds2.addAll(connectTo());
    196199
     200                // add new Node
     201                Node firstNode = null;
     202                Way way = new Way(s_oWay);
     203                for (Node node : s_oWay.getNodes()) {
     204                        if ( node.getDataSet() != null )
     205                        {
     206                                way.removeNode(node);
     207                        }
     208                }
     209                if ( way.getNodes().size() > 0 )
     210            {
     211                if (way.firstNode() != way.lastNode() )
     212                {
     213                        way.addNode(way.firstNode());
     214                }
     215                        for (Node node : way.getNodes())
     216                        {
     217                                if (firstNode == null || firstNode != node) {
     218                                        cmds.add(new AddCommand(node));
     219                                }
     220                                if (firstNode == null) {
     221                                        firstNode = node;
     222                                }
     223                        }
     224            }
     225               
     226                // add new way
     227                if ( bAddWay == true )
     228                {
     229                        cmds.add(new AddCommand(s_oWay));
     230                }
     231           
    197232                cmds.add(new ChangeCommand(s_oWayOld, trySplitWayByAnyNodes(s_oWay)));
    198233        }
     
    288323        newWay.removeNode(n1);
    289324 //       cmds.add(new ChangeCommand(m_way, newWay));
     325       
     326        if (newWay.firstNode() != newWay.lastNode() )
     327        {
     328                newWay.addNode(newWay.firstNode());
     329        }
    290330        s_oWay = new Way(newWay);
    291331       
    292         cmds.add(new DeleteCommand(n1));
     332        //cmds.add(new DeleteCommand(n1));
    293333        return cmds;
    294334    }
  • applications/editors/josm/plugins/tracer2/src/org/openstreetmap/josm/plugins/tracer2/TracerAction.java

    r30737 r30927  
    320320                    firstNode = node;
    321321                }
    322                 commands.add(new AddCommand(node));
     322                //commands.add(new AddCommand(node));
    323323                way.addNode(node);
    324324            }
Note: See TracChangeset for help on using the changeset viewer.