Changeset 3383 in josm for trunk


Ignore:
Timestamp:
2010-07-24T19:15:45+02:00 (14 years ago)
Author:
jttt
Message:

Fix #5269 JoinAreasAction

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r3230 r3383  
    186186            int i = 0;
    187187            if(checkForTagConflicts(a, b)) return true; // User aborted, so don't warn again
    188             if(joinAreas(a, a))
     188            if(joinAreas(a, a)) {
    189189                ++i;
    190             if(joinAreas(b, b))
     190            }
     191            if(joinAreas(b, b)) {
    191192                ++i;
     193            }
    192194            hadChanges = i > 0;
    193195            cmdsCount = i;
     
    215217        // Join outer ways
    216218        Way outerWay = joinOuterWays(allWays, innerWays);
     219        if (outerWay == null)
     220            return true;
    217221
    218222        // Fix Multipolygons if there are any
     
    605609
    606610        commitCommands(marktr("Join Areas: Remove Short Ways"));
    607         return closeWay(joinWays(join));
     611        Way joinedWay = joinWays(join);
     612        if (joinedWay != null)
     613            return closeWay(joinedWay);
     614        else
     615            return null;
    608616    }
    609617
     
    648656            a = b;
    649657        }
    650         if((a = new CombineWayAction().combineWays(ways)) != null)
     658        if((a = new CombineWayAction().combineWays(ways)) != null) {
    651659            cmdsCount++;
     660        }
    652661        return a;
    653662    }
     
    676685            for(Node n : w.getNodes()) {
    677686                if(outerNodes.contains(n)) {
    678                     if(!selfintersect) // allow outer point for self intersection
     687                    if(!selfintersect) { // allow outer point for self intersection
    679688                        continue wayIterator;
     689                    }
    680690                }
    681691                else if(!hasInnerNodes && innerNodes.contains(n)) {
     
    715725                        int i = 0;
    716726                        // w2 cannot be closed, otherwise it would have been removed above
    717                         if(w1.equals(w2))
     727                        if(w1.equals(w2)) {
    718728                            continue;
    719                         if(w2.isFirstLastNode(w1.firstNode()))
     729                        }
     730                        if(w2.isFirstLastNode(w1.firstNode())) {
    720731                            ++i;
    721                         if(w2.isFirstLastNode(w1.lastNode()))
     732                        }
     733                        if(w2.isFirstLastNode(w1.lastNode())) {
    722734                            ++i;
     735                        }
    723736                        if(i == 2) // this way closes w1 - take it!
    724737                        {
    725                             if(secondary.size() > 0)
     738                            if(secondary.size() > 0) {
    726739                                secondary.clear();
     740                            }
    727741                            secondary.add(w2);
    728742                            break;
    729743                        }
    730                         else if(i > 0)
     744                        else if(i > 0) {
    731745                            secondary.add(w2);
     746                        }
    732747                    }
    733748                    if(k == 0 ? secondary.size() == 1 : secondary.size() > 0)
     
    742757                            possibleWays.removeAll(joinThem);
    743758
    744                             List<Node> nodes = joined.getNodes();
     759                            //List<Node> nodes = joined.getNodes();
    745760                            // check if we added too much
    746761                            /*for(int i = 1; i < nodes.size()-2; ++i)
Note: See TracChangeset for help on using the changeset viewer.