Ignore:
Timestamp:
2009-03-30T16:32:25+02:00 (16 years ago)
Author:
stoecker
Message:

close #2343 - wrong joining - patch by xeen

Location:
applications/editors/josm/plugins/utilsplugin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/utilsplugin/data/Join Areas Tests.osm

    r13776 r14356  
    22<osm version='0.5' generator='JOSM'>
    33  <bounds minlat='49.6358455937926' minlon='8.97891998291015' maxlat='49.6659612524238' maxlon='9.01926040649414' origin='JOSM' />
     4  <bounds minlat='51.0727784461145' minlon='13.7410855293274' maxlat='51.07443677101' maxlon='13.743531703949' origin='OpenStreetMap server' />
    45  <node id='-1' visible='true' lat='49.665557350679464' lon='8.980018030697323'>
    56    <tag k='name' v='Multipolygon' />
     
    231232  <node id='-204' action='modify' visible='true' lat='49.640963432528' lon='9.002300773285747' />
    232233  <node id='-205' action='modify' visible='true' lat='49.640355464550595' lon='9.00163017923136' />
    233   <node id='-206' visible='true' lat='49.64101635201889' lon='9.01104143811511' />
    234   <node id='-207' visible='true' lat='49.63695925798987' lon='9.010907319304232' />
    235   <node id='-208' visible='true' lat='49.63692572828715' lon='9.01338851730545' />
    236   <node id='-209' visible='true' lat='49.641116941127045' lon='9.013556165819047' />
    237   <node id='-210' visible='true' lat='49.636858668881715' lon='9.01704325490184' />
    238   <node id='-211' visible='true' lat='49.641116941127045' lon='9.016909136090963' />
    239   <way id='-212' visible='true'>
     234  <node id='-206' action='modify' visible='true' lat='49.641650361020126' lon='9.011375542032631' />
     235  <node id='-207' action='modify' visible='true' lat='49.63994510769946' lon='9.011537754906723' />
     236  <node id='-208' action='modify' visible='true' lat='49.63989778320692' lon='9.01301762121565' />
     237  <node id='-209' action='modify' timestamp='2008-03-17T23:16:02Z' visible='true' lat='49.63851559945754' lon='9.011923928883068'>
     238    <tag k='created_by' v='Merkaartor 0.10' />
     239  </node>
     240  <node id='-210' action='modify' timestamp='2008-03-17T23:16:00Z' visible='true' lat='49.63931004998166' lon='9.014994879645652'>
     241    <tag k='created_by' v='Merkaartor 0.10' />
     242  </node>
     243  <node id='-211' action='modify' timestamp='2008-03-17T23:16:02Z' visible='true' lat='49.63656290879177' lon='9.01184224653937'>
     244    <tag k='created_by' v='Merkaartor 0.10' />
     245  </node>
     246  <node id='-212' action='modify' timestamp='2008-03-19T00:23:09Z' visible='true' lat='49.638495992538296' lon='9.013041516659012'>
     247    <tag k='created_by' v='Merkaartor 0.10' />
     248  </node>
     249  <node id='-213' action='modify' timestamp='2008-03-17T23:16:00Z' visible='true' lat='49.639297465489946' lon='9.013075043737933'>
     250    <tag k='created_by' v='Merkaartor 0.10' />
     251  </node>
     252  <node id='-214' action='modify' timestamp='2008-03-17T23:16:01Z' visible='true' lat='49.63932787364639' lon='9.011341760369241'>
     253    <tag k='created_by' v='Merkaartor 0.10' />
     254  </node>
     255  <node id='-215' action='modify' timestamp='2008-03-17T23:16:00Z' visible='true' lat='49.6362341674196' lon='9.011212347946481' />
     256  <node id='-216' action='modify' timestamp='2008-06-18T15:47:24Z' visible='true' lat='49.63846974351432' lon='9.014959728094702' />
     257  <node id='-217' action='modify' timestamp='2008-03-17T23:16:01Z' visible='true' lat='49.639285639926086' lon='9.016386267202325'>
     258    <tag k='created_by' v='Merkaartor 0.10' />
     259  </node>
     260  <node id='-218' action='modify' timestamp='2008-03-17T23:16:01Z' visible='true' lat='49.63614569649766' lon='9.016254920813461'>
     261    <tag k='created_by' v='Merkaartor 0.10' />
     262  </node>
     263  <node id='-219' action='modify' timestamp='2008-03-17T23:16:02Z' visible='true' lat='49.636497278618506' lon='9.01558299248487' />
     264  <node id='-220' action='modify' visible='true' lat='49.64173715249402' lon='9.01288893804428' />
     265  <node id='-221' action='modify' visible='true' lat='49.63997057825359' lon='9.017121223877993' />
     266  <node id='-222' action='modify' visible='true' lat='49.6418769973781' lon='9.016690773382148' />
     267  <node id='-223' action='modify' timestamp='2008-03-17T23:16:02Z' visible='true' lat='49.638457370514' lon='9.015664984322639'>
     268    <tag k='created_by' v='Merkaartor 0.10' />
     269  </node>
     270  <way id='-224' visible='true'>
     271    <nd ref='-171' />
     272    <nd ref='-151' />
     273    <nd ref='-147' />
     274    <nd ref='-146' />
     275    <nd ref='-148' />
     276    <nd ref='-145' />
     277    <nd ref='-152' />
     278    <nd ref='-172' />
     279    <nd ref='-150' />
     280    <nd ref='-149' />
     281    <nd ref='-171' />
     282    <tag k='name' v='Thing in the Middle' />
     283  </way>
     284  <way id='-225' visible='true'>
     285    <nd ref='-164' />
     286    <nd ref='-163' />
     287    <nd ref='-166' />
     288    <nd ref='-165' />
     289    <nd ref='-164' />
     290    <tag k='parking' v='surface' />
     291    <tag k='name' v='Outer blob' />
     292    <tag k='amenity' v='parking' />
     293  </way>
     294  <way id='-226' visible='true'>
     295    <nd ref='-117' />
     296    <nd ref='-106' />
     297    <nd ref='-105' />
     298    <nd ref='-116' />
     299    <nd ref='-117' />
     300  </way>
     301  <way id='-227' visible='true'>
     302    <nd ref='-28' />
     303    <nd ref='-39' />
     304    <nd ref='-34' />
     305    <nd ref='-37' />
     306    <nd ref='-40' />
     307    <nd ref='-35' />
     308    <nd ref='-31' />
     309    <nd ref='-33' />
     310    <nd ref='-36' />
     311    <nd ref='-29' />
     312    <nd ref='-28' />
     313    <tag k='parking' v='surface' />
     314    <tag k='amenity' v='parking' />
     315  </way>
     316  <way id='-228' visible='true'>
    240317    <nd ref='-158' />
    241318    <nd ref='-155' />
     
    246323    <tag k='amenity' v='parking' />
    247324  </way>
    248   <way id='-213' visible='true'>
    249     <nd ref='-153' />
    250     <nd ref='-154' />
    251     <nd ref='-133' />
    252     <nd ref='-156' />
    253     <nd ref='-153' />
    254   </way>
    255   <way id='-214' visible='true'>
    256     <nd ref='-169' />
    257     <nd ref='-170' />
    258     <nd ref='-173' />
    259     <nd ref='-174' />
    260     <nd ref='-169' />
    261     <tag k='parking' v='surface' />
    262     <tag k='amenity' v='parking' />
    263   </way>
    264   <way id='-215' action='modify' visible='true'>
     325  <way id='-229' visible='true'>
     326    <nd ref='-109' />
     327    <nd ref='-110' />
     328    <nd ref='-107' />
     329    <nd ref='-108' />
     330    <nd ref='-109' />
     331  </way>
     332  <way id='-230' visible='true'>
     333    <nd ref='-70' />
     334    <nd ref='-77' />
     335    <nd ref='-73' />
     336    <nd ref='-76' />
     337    <nd ref='-70' />
     338    <tag k='parking' v='surface' />
     339    <tag k='amenity' v='parking' />
     340  </way>
     341  <way id='-231' visible='true'>
     342    <nd ref='-10' />
     343    <nd ref='-11' />
     344    <nd ref='-12' />
     345    <nd ref='-13' />
     346    <nd ref='-10' />
     347    <tag k='parking' v='surface' />
     348    <tag k='amenity' v='parking' />
     349  </way>
     350  <way id='-232' visible='true'>
     351    <nd ref='-99' />
     352    <nd ref='-102' />
     353    <nd ref='-101' />
     354    <nd ref='-111' />
     355    <nd ref='-99' />
     356    <tag k='parking' v='surface' />
     357    <tag k='amenity' v='parking' />
     358  </way>
     359  <way id='-233' action='modify' visible='true'>
    265360    <nd ref='-198' />
    266361    <nd ref='-201' />
     
    279374    <tag k='amenity' v='parking' />
    280375  </way>
    281   <way id='-216' visible='true'>
    282     <nd ref='-60' />
    283     <nd ref='-59' />
    284     <nd ref='-58' />
    285     <nd ref='-57' />
    286     <nd ref='-60' />
    287     <tag k='parking' v='surface' />
    288     <tag k='amenity' v='parking' />
    289   </way>
    290   <way id='-217' visible='true'>
    291     <nd ref='-117' />
    292     <nd ref='-106' />
    293     <nd ref='-105' />
    294     <nd ref='-116' />
    295     <nd ref='-117' />
    296   </way>
    297   <way id='-218' visible='true'>
    298     <nd ref='-176' />
    299     <nd ref='-175' />
    300     <tag k='highway' v='motorway' />
    301     <tag k='lanes' v='5' />
    302   </way>
    303   <way id='-219' visible='true'>
    304     <nd ref='-137' />
    305     <nd ref='-144' />
    306     <nd ref='-124' />
    307     <nd ref='-139' />
    308     <nd ref='-137' />
    309   </way>
    310   <way id='-220' visible='true'>
    311     <nd ref='-78' />
    312     <nd ref='-79' />
    313     <tag k='highway' v='motorway' />
    314     <tag k='lanes' v='5' />
    315   </way>
    316   <way id='-221' visible='true'>
    317     <nd ref='-80' />
    318     <nd ref='-86' />
    319     <tag k='highway' v='motorway' />
    320     <tag k='lanes' v='5' />
    321   </way>
    322   <way id='-222' visible='true'>
    323     <nd ref='-26' />
    324     <nd ref='-16' />
    325     <nd ref='-19' />
    326     <nd ref='-24' />
    327     <nd ref='-23' />
    328     <nd ref='-26' />
    329     <tag k='landuse' v='retail' />
    330   </way>
    331   <way id='-223' visible='true'>
    332     <nd ref='-87' />
    333     <nd ref='-82' />
    334     <tag k='highway' v='motorway' />
    335     <tag k='lanes' v='5' />
    336   </way>
    337   <way id='-224' action='modify' visible='true'>
    338     <nd ref='-192' />
    339     <nd ref='-189' />
    340     <nd ref='-186' />
    341     <nd ref='-191' />
    342     <nd ref='-180' />
    343     <nd ref='-177' />
    344     <nd ref='-190' />
    345     <nd ref='-179' />
    346     <nd ref='-188' />
    347     <nd ref='-192' />
    348     <tag k='amenity' v='parking' />
    349   </way>
    350   <way id='-225' visible='true'>
     376  <way id='-234' visible='true'>
    351377    <nd ref='-61' />
    352378    <nd ref='-62' />
     
    359385    <tag k='amenity' v='parking' />
    360386  </way>
    361   <way id='-226' visible='true'>
    362     <nd ref='-125' />
    363     <nd ref='-126' />
    364     <tag k='highway' v='motorway' />
    365     <tag k='lanes' v='5' />
    366   </way>
    367   <way id='-227' action='modify' visible='true'>
    368     <nd ref='-185' />
    369     <nd ref='-189' />
    370     <nd ref='-186' />
    371     <nd ref='-191' />
    372     <nd ref='-180' />
    373     <nd ref='-177' />
    374     <nd ref='-190' />
    375     <nd ref='-179' />
    376     <nd ref='-187' />
    377     <nd ref='-185' />
    378     <tag k='amenity' v='parking' />
    379   </way>
    380   <way id='-228' visible='true'>
    381     <nd ref='-25' />
    382     <nd ref='-15' />
    383     <nd ref='-27' />
    384     <tag k='highway' v='footway' />
    385   </way>
    386   <way id='-229' visible='true'>
    387     <nd ref='-22' />
    388     <nd ref='-21' />
    389     <nd ref='-17' />
    390     <nd ref='-20' />
    391     <nd ref='-22' />
    392     <tag k='landuse' v='basin' />
    393   </way>
    394   <way id='-230' visible='true'>
    395     <nd ref='-171' />
    396     <nd ref='-151' />
    397     <nd ref='-147' />
    398     <nd ref='-146' />
    399     <nd ref='-148' />
    400     <nd ref='-145' />
    401     <nd ref='-152' />
    402     <nd ref='-172' />
    403     <nd ref='-150' />
    404     <nd ref='-149' />
    405     <nd ref='-171' />
    406     <tag k='name' v='Thing in the Middle' />
    407   </way>
    408   <way id='-231' visible='true'>
    409     <nd ref='-18' />
    410     <nd ref='-50' />
    411     <nd ref='-49' />
    412     <nd ref='-53' />
    413     <nd ref='-54' />
    414     <nd ref='-56' />
    415     <nd ref='-55' />
    416     <nd ref='-51' />
    417     <nd ref='-14' />
    418     <nd ref='-15' />
    419     <nd ref='-18' />
    420     <tag k='parking' v='surface' />
    421     <tag k='amenity' v='parking' />
    422   </way>
    423   <way id='-232' visible='true'>
    424     <nd ref='-71' />
    425     <nd ref='-72' />
    426     <nd ref='-77' />
    427     <nd ref='-75' />
    428     <nd ref='-74' />
    429     <nd ref='-71' />
    430     <tag k='parking' v='surface' />
    431     <tag k='amenity' v='parking' />
    432   </way>
    433   <way id='-233' visible='true'>
    434     <nd ref='-130' />
    435     <nd ref='-129' />
    436     <nd ref='-132' />
    437     <nd ref='-131' />
    438     <nd ref='-130' />
    439   </way>
    440   <way id='-234' visible='true'>
    441     <nd ref='-159' />
    442     <nd ref='-135' />
    443     <nd ref='-134' />
    444     <nd ref='-157' />
    445     <nd ref='-159' />
    446   </way>
    447387  <way id='-235' visible='true'>
    448     <nd ref='-69' />
    449     <nd ref='-65' />
    450     <nd ref='-66' />
    451     <nd ref='-67' />
    452     <nd ref='-68' />
    453     <nd ref='-69' />
     388    <nd ref='-81' />
     389    <nd ref='-84' />
     390    <nd ref='-83' />
     391    <nd ref='-94' />
     392    <nd ref='-93' />
     393    <nd ref='-96' />
     394    <nd ref='-95' />
     395    <nd ref='-90' />
     396    <nd ref='-89' />
     397    <nd ref='-92' />
     398    <nd ref='-81' />
    454399    <tag k='parking' v='surface' />
    455400    <tag k='amenity' v='parking' />
    456401  </way>
    457402  <way id='-236' visible='true'>
    458     <nd ref='-99' />
    459     <nd ref='-102' />
    460     <nd ref='-101' />
    461     <nd ref='-111' />
    462     <nd ref='-99' />
    463     <tag k='parking' v='surface' />
    464     <tag k='amenity' v='parking' />
    465   </way>
    466   <way id='-237' visible='true'>
    467     <nd ref='-120' />
    468     <nd ref='-118' />
    469     <nd ref='-128' />
    470     <nd ref='-114' />
    471     <nd ref='-120' />
    472     <tag k='parking' v='surface' />
    473     <tag k='amenity' v='parking' />
    474   </way>
    475   <way id='-238' visible='true'>
    476     <nd ref='-115' />
    477     <nd ref='-113' />
    478     <nd ref='-127' />
    479     <nd ref='-119' />
    480     <nd ref='-115' />
    481   </way>
    482   <way id='-239' visible='true'>
    483     <nd ref='-32' />
    484     <nd ref='-17' />
    485     <nd ref='-30' />
    486     <tag k='highway' v='footway' />
    487   </way>
    488   <way id='-240' visible='true'>
    489     <nd ref='-1' />
    490     <nd ref='-2' />
    491     <nd ref='-3' />
    492     <nd ref='-4' />
    493     <nd ref='-1' />
    494     <tag k='parking' v='surface' />
    495     <tag k='amenity' v='parking' />
    496   </way>
    497   <way id='-241' visible='true'>
    498     <nd ref='-10' />
    499     <nd ref='-11' />
    500     <nd ref='-12' />
    501     <nd ref='-13' />
    502     <nd ref='-10' />
    503     <tag k='parking' v='surface' />
    504     <tag k='amenity' v='parking' />
    505   </way>
    506   <way id='-242' visible='true'>
    507     <nd ref='-164' />
    508     <nd ref='-163' />
    509     <nd ref='-166' />
    510     <nd ref='-165' />
    511     <nd ref='-164' />
    512     <tag k='parking' v='surface' />
    513     <tag k='name' v='Outer blob' />
    514     <tag k='amenity' v='parking' />
    515   </way>
    516   <way id='-243' visible='true'>
    517     <nd ref='-91' />
    518     <nd ref='-103' />
    519     <nd ref='-104' />
    520   </way>
    521   <way id='-244' visible='true'>
    522     <nd ref='-112' />
    523     <nd ref='-97' />
    524     <nd ref='-100' />
    525     <nd ref='-98' />
    526     <nd ref='-112' />
    527   </way>
    528   <way id='-245' visible='true'>
    529     <nd ref='-28' />
    530     <nd ref='-39' />
    531     <nd ref='-34' />
    532     <nd ref='-37' />
    533     <nd ref='-40' />
    534     <nd ref='-35' />
    535     <nd ref='-31' />
    536     <nd ref='-33' />
    537     <nd ref='-36' />
    538     <nd ref='-29' />
    539     <nd ref='-28' />
    540     <tag k='parking' v='surface' />
    541     <tag k='amenity' v='parking' />
    542   </way>
    543   <way id='-246' visible='true'>
    544403    <nd ref='-44' />
    545404    <nd ref='-46' />
     
    556415    <tag k='amenity' v='parking' />
    557416  </way>
    558   <way id='-247' visible='true'>
    559     <nd ref='-142' />
    560     <nd ref='-123' />
    561     <nd ref='-138' />
    562     <nd ref='-122' />
    563     <nd ref='-142' />
    564     <tag k='parking' v='surface' />
     417  <way id='-237' visible='true'>
     418    <nd ref='-112' />
     419    <nd ref='-97' />
     420    <nd ref='-100' />
     421    <nd ref='-98' />
     422    <nd ref='-112' />
     423  </way>
     424  <way id='-238' visible='true'>
     425    <nd ref='-120' />
     426    <nd ref='-118' />
     427    <nd ref='-128' />
     428    <nd ref='-114' />
     429    <nd ref='-120' />
     430    <tag k='parking' v='surface' />
     431    <tag k='amenity' v='parking' />
     432  </way>
     433  <way id='-239' visible='true'>
     434    <nd ref='-78' />
     435    <nd ref='-79' />
     436    <tag k='highway' v='motorway' />
     437    <tag k='lanes' v='5' />
     438  </way>
     439  <way id='-240' visible='true'>
     440    <nd ref='-25' />
     441    <nd ref='-15' />
     442    <nd ref='-27' />
     443    <tag k='highway' v='footway' />
     444  </way>
     445  <way id='-241' visible='true'>
     446    <nd ref='-125' />
     447    <nd ref='-126' />
     448    <tag k='highway' v='motorway' />
     449    <tag k='lanes' v='5' />
     450  </way>
     451  <way id='-242' action='modify' visible='true'>
     452    <nd ref='-192' />
     453    <nd ref='-189' />
     454    <nd ref='-186' />
     455    <nd ref='-191' />
     456    <nd ref='-180' />
     457    <nd ref='-177' />
     458    <nd ref='-190' />
     459    <nd ref='-179' />
     460    <nd ref='-188' />
     461    <nd ref='-192' />
     462    <tag k='amenity' v='parking' />
     463  </way>
     464  <way id='-243' visible='true'>
     465    <nd ref='-60' />
     466    <nd ref='-59' />
     467    <nd ref='-58' />
     468    <nd ref='-57' />
     469    <nd ref='-60' />
     470    <tag k='parking' v='surface' />
     471    <tag k='amenity' v='parking' />
     472  </way>
     473  <way id='-244' visible='true'>
     474    <nd ref='-91' />
     475    <nd ref='-103' />
     476    <nd ref='-104' />
     477  </way>
     478  <way id='-245' action='modify' visible='true'>
     479    <nd ref='-208' />
     480    <nd ref='-221' />
     481    <nd ref='-222' />
     482    <nd ref='-220' />
     483    <nd ref='-208' />
     484    <tag k='parking' v='surface' />
     485    <tag k='amenity' v='parking' />
     486  </way>
     487  <way id='-246' visible='true'>
     488    <nd ref='-22' />
     489    <nd ref='-21' />
     490    <nd ref='-17' />
     491    <nd ref='-20' />
     492    <nd ref='-22' />
     493    <tag k='landuse' v='basin' />
     494  </way>
     495  <way id='-247' action='modify' visible='true'>
     496    <nd ref='-185' />
     497    <nd ref='-189' />
     498    <nd ref='-186' />
     499    <nd ref='-191' />
     500    <nd ref='-180' />
     501    <nd ref='-177' />
     502    <nd ref='-190' />
     503    <nd ref='-179' />
     504    <nd ref='-187' />
     505    <nd ref='-185' />
    565506    <tag k='amenity' v='parking' />
    566507  </way>
    567508  <way id='-248' visible='true'>
    568     <nd ref='-70' />
    569     <nd ref='-77' />
    570     <nd ref='-73' />
    571     <nd ref='-76' />
    572     <nd ref='-70' />
    573     <tag k='parking' v='surface' />
    574     <tag k='amenity' v='parking' />
    575   </way>
    576   <way id='-249' visible='true'>
    577     <nd ref='-161' />
    578     <nd ref='-162' />
    579     <nd ref='-167' />
    580     <nd ref='-168' />
    581     <nd ref='-161' />
    582     <tag k='parking' v='surface' />
    583     <tag k='amenity' v='parking' />
     509    <nd ref='-5' />
     510    <nd ref='-6' />
     511    <nd ref='-7' />
     512    <nd ref='-8' />
     513    <nd ref='-9' />
     514    <nd ref='-5' />
     515    <tag k='parking' v='surface' />
     516    <tag k='amenity' v='parking' />
     517  </way>
     518  <way id='-249' timestamp='2008-06-18T15:47:24Z' visible='true'>
     519    <nd ref='-216' />
     520    <nd ref='-210' />
     521    <nd ref='-213' />
     522    <nd ref='-212' />
     523    <nd ref='-216' />
     524    <tag k='created_by' v='Potlatch 0.9c' />
     525    <tag k='building' v='yes' />
    584526  </way>
    585527  <way id='-250' action='modify' visible='true'>
     
    600542  </way>
    601543  <way id='-251' visible='true'>
    602     <nd ref='-109' />
    603     <nd ref='-110' />
    604     <nd ref='-107' />
    605     <nd ref='-108' />
    606     <nd ref='-109' />
    607   </way>
    608   <way id='-252' visible='true'>
    609     <nd ref='-85' />
    610     <nd ref='-88' />
     544    <nd ref='-87' />
     545    <nd ref='-82' />
    611546    <tag k='highway' v='motorway' />
    612547    <tag k='lanes' v='5' />
    613548  </way>
     549  <way id='-252' visible='true'>
     550    <nd ref='-153' />
     551    <nd ref='-154' />
     552    <nd ref='-133' />
     553    <nd ref='-156' />
     554    <nd ref='-153' />
     555  </way>
    614556  <way id='-253' visible='true'>
    615     <nd ref='-5' />
    616     <nd ref='-6' />
    617     <nd ref='-7' />
    618     <nd ref='-8' />
    619     <nd ref='-9' />
    620     <nd ref='-5' />
    621     <tag k='parking' v='surface' />
    622     <tag k='amenity' v='parking' />
     557    <nd ref='-130' />
     558    <nd ref='-129' />
     559    <nd ref='-132' />
     560    <nd ref='-131' />
     561    <nd ref='-130' />
    623562  </way>
    624563  <way id='-254' visible='true'>
    625     <nd ref='-81' />
    626     <nd ref='-84' />
    627     <nd ref='-83' />
    628     <nd ref='-94' />
    629     <nd ref='-93' />
    630     <nd ref='-96' />
    631     <nd ref='-95' />
    632     <nd ref='-90' />
    633     <nd ref='-89' />
    634     <nd ref='-92' />
    635     <nd ref='-81' />
    636     <tag k='parking' v='surface' />
    637     <tag k='amenity' v='parking' />
     564    <nd ref='-115' />
     565    <nd ref='-113' />
     566    <nd ref='-127' />
     567    <nd ref='-119' />
     568    <nd ref='-115' />
    638569  </way>
    639570  <way id='-255' visible='true'>
     571    <nd ref='-137' />
     572    <nd ref='-144' />
     573    <nd ref='-124' />
     574    <nd ref='-139' />
     575    <nd ref='-137' />
     576  </way>
     577  <way id='-256' visible='true'>
     578    <nd ref='-32' />
     579    <nd ref='-17' />
     580    <nd ref='-30' />
     581    <tag k='highway' v='footway' />
     582  </way>
     583  <way id='-257' timestamp='2008-06-17T03:52:47Z' visible='true'>
     584    <nd ref='-210' />
     585    <nd ref='-217' />
     586    <nd ref='-218' />
     587    <nd ref='-215' />
     588    <nd ref='-214' />
     589    <nd ref='-213' />
     590    <nd ref='-212' />
     591    <nd ref='-209' />
     592    <nd ref='-211' />
     593    <nd ref='-219' />
     594    <nd ref='-223' />
     595    <nd ref='-216' />
     596    <nd ref='-210' />
     597    <tag k='created_by' v='Merkaartor 0.10' />
     598    <tag k='building' v='yes' />
     599  </way>
     600  <way id='-258' visible='true'>
     601    <nd ref='-161' />
     602    <nd ref='-162' />
     603    <nd ref='-167' />
     604    <nd ref='-168' />
     605    <nd ref='-161' />
     606    <tag k='parking' v='surface' />
     607    <tag k='amenity' v='parking' />
     608  </way>
     609  <way id='-259' action='modify' visible='true'>
     610    <nd ref='-206' />
     611    <nd ref='-207' />
     612    <nd ref='-208' />
     613    <nd ref='-220' />
     614    <nd ref='-206' />
     615    <tag k='parking' v='surface' />
     616    <tag k='amenity' v='parking' />
     617  </way>
     618  <way id='-260' visible='true'>
     619    <nd ref='-169' />
     620    <nd ref='-170' />
     621    <nd ref='-173' />
     622    <nd ref='-174' />
     623    <nd ref='-169' />
     624    <tag k='parking' v='surface' />
     625    <tag k='amenity' v='parking' />
     626  </way>
     627  <way id='-261' visible='true'>
     628    <nd ref='-159' />
     629    <nd ref='-135' />
     630    <nd ref='-134' />
     631    <nd ref='-157' />
     632    <nd ref='-159' />
     633  </way>
     634  <way id='-262' visible='true'>
    640635    <nd ref='-141' />
    641636    <nd ref='-143' />
     
    644639    <nd ref='-141' />
    645640  </way>
    646   <way id='-256' action='modify' visible='true'>
    647     <nd ref='-206' />
    648     <nd ref='-207' />
    649     <nd ref='-208' />
    650     <nd ref='-209' />
    651     <nd ref='-206' />
    652     <tag k='parking' v='surface' />
    653     <tag k='amenity' v='parking' />
    654   </way>
    655   <way id='-257' action='modify' visible='true'>
    656     <nd ref='-208' />
    657     <nd ref='-210' />
    658     <nd ref='-211' />
    659     <nd ref='-209' />
    660     <nd ref='-208' />
    661     <tag k='parking' v='surface' />
    662     <tag k='amenity' v='parking' />
    663   </way>
    664   <relation id='-258' visible='true'>
    665     <member type='way' ref='-238' role='inner' />
    666     <member type='way' ref='-237' role='outer' />
     641  <way id='-263' visible='true'>
     642    <nd ref='-18' />
     643    <nd ref='-50' />
     644    <nd ref='-49' />
     645    <nd ref='-53' />
     646    <nd ref='-54' />
     647    <nd ref='-56' />
     648    <nd ref='-55' />
     649    <nd ref='-51' />
     650    <nd ref='-14' />
     651    <nd ref='-15' />
     652    <nd ref='-18' />
     653    <tag k='parking' v='surface' />
     654    <tag k='amenity' v='parking' />
     655  </way>
     656  <way id='-264' visible='true'>
     657    <nd ref='-176' />
     658    <nd ref='-175' />
     659    <tag k='highway' v='motorway' />
     660    <tag k='lanes' v='5' />
     661  </way>
     662  <way id='-265' visible='true'>
     663    <nd ref='-26' />
     664    <nd ref='-16' />
     665    <nd ref='-19' />
     666    <nd ref='-24' />
     667    <nd ref='-23' />
     668    <nd ref='-26' />
     669    <tag k='landuse' v='retail' />
     670  </way>
     671  <way id='-266' visible='true'>
     672    <nd ref='-71' />
     673    <nd ref='-72' />
     674    <nd ref='-77' />
     675    <nd ref='-75' />
     676    <nd ref='-74' />
     677    <nd ref='-71' />
     678    <tag k='parking' v='surface' />
     679    <tag k='amenity' v='parking' />
     680  </way>
     681  <way id='-267' visible='true'>
     682    <nd ref='-85' />
     683    <nd ref='-88' />
     684    <tag k='highway' v='motorway' />
     685    <tag k='lanes' v='5' />
     686  </way>
     687  <way id='-268' visible='true'>
     688    <nd ref='-80' />
     689    <nd ref='-86' />
     690    <tag k='highway' v='motorway' />
     691    <tag k='lanes' v='5' />
     692  </way>
     693  <way id='-269' visible='true'>
     694    <nd ref='-142' />
     695    <nd ref='-123' />
     696    <nd ref='-138' />
     697    <nd ref='-122' />
     698    <nd ref='-142' />
     699    <tag k='parking' v='surface' />
     700    <tag k='amenity' v='parking' />
     701  </way>
     702  <way id='-270' visible='true'>
     703    <nd ref='-69' />
     704    <nd ref='-65' />
     705    <nd ref='-66' />
     706    <nd ref='-67' />
     707    <nd ref='-68' />
     708    <nd ref='-69' />
     709    <tag k='parking' v='surface' />
     710    <tag k='amenity' v='parking' />
     711  </way>
     712  <way id='-271' visible='true'>
     713    <nd ref='-1' />
     714    <nd ref='-2' />
     715    <nd ref='-3' />
     716    <nd ref='-4' />
     717    <nd ref='-1' />
     718    <tag k='parking' v='surface' />
     719    <tag k='amenity' v='parking' />
     720  </way>
     721  <relation id='-272' visible='true'>
     722    <member type='way' ref='-224' role='inner' />
     723    <member type='way' ref='-225' role='outer' />
     724    <tag k='name' v='6.' />
     725    <tag k='type' v='multipolygon' />
     726  </relation>
     727  <relation id='-273' visible='true'>
     728    <member type='way' ref='-252' role='inner' />
     729    <member type='way' ref='-261' role='inner' />
     730    <member type='way' ref='-228' role='outer' />
     731    <tag k='name' v='5.' />
     732    <tag k='type' v='multipolygon' />
     733  </relation>
     734  <relation id='-274' visible='true'>
     735    <member type='way' ref='-262' role='inner' />
     736    <member type='way' ref='-269' role='outer' />
     737    <tag k='name' v='4. a' />
     738    <tag k='type' v='multipolygon' />
     739  </relation>
     740  <relation id='-275' visible='true'>
     741    <member type='way' ref='-237' role='inner' />
     742    <member type='way' ref='-232' role='outer' />
     743    <tag k='name' v='2.' />
     744    <tag k='type' v='multipolygon' />
     745  </relation>
     746  <relation id='-276' visible='true'>
     747  </relation>
     748  <relation id='-277' visible='true'>
     749    <member type='way' ref='-253' role='' />
     750    <member type='way' ref='-255' role='' />
     751    <tag k='name ' v='4. b' />
     752  </relation>
     753  <relation id='-278' visible='true'>
     754    <member type='way' ref='-254' role='inner' />
     755    <member type='way' ref='-238' role='outer' />
    667756    <tag k='name' v='3.' />
    668757    <tag k='type' v='multipolygon' />
    669758  </relation>
    670   <relation id='-259' visible='true'>
    671     <member type='way' ref='-244' role='inner' />
    672     <member type='way' ref='-236' role='outer' />
    673     <tag k='name' v='2.' />
    674     <tag k='type' v='multipolygon' />
    675   </relation>
    676   <relation id='-260' visible='true'>
    677     <member type='way' ref='-254' role='area' />
     759  <relation id='-279' visible='true'>
     760    <member type='way' ref='-235' role='area' />
    678761    <member type='node' ref='-93' role='node in area' />
    679762    <member type='node' ref='-95' role='node in area' />
    680     <member type='way' ref='-243' role='some other way' />
     763    <member type='way' ref='-244' role='some other way' />
    681764    <member type='node' ref='-90' role='to be deleted node in area' />
    682765    <tag k='name' v='1.' />
    683766  </relation>
    684   <relation id='-261' visible='true'>
    685     <member type='way' ref='-255' role='inner' />
    686     <member type='way' ref='-247' role='outer' />
    687     <tag k='name' v='4. a' />
    688     <tag k='type' v='multipolygon' />
    689   </relation>
    690   <relation id='-262' visible='true'>
    691     <member type='way' ref='-230' role='inner' />
    692     <member type='way' ref='-242' role='outer' />
    693     <tag k='name' v='6.' />
    694     <tag k='type' v='multipolygon' />
    695   </relation>
    696   <relation id='-263' visible='true'>
    697     <member type='way' ref='-233' role='' />
    698     <member type='way' ref='-219' role='' />
    699     <tag k='name ' v='4. b' />
    700   </relation>
    701   <relation id='-264' visible='true'>
    702     <member type='way' ref='-213' role='inner' />
    703     <member type='way' ref='-234' role='inner' />
    704     <member type='way' ref='-212' role='outer' />
    705     <tag k='name' v='5.' />
    706     <tag k='type' v='multipolygon' />
    707   </relation>
    708   <relation id='-265' visible='true'>
    709   </relation>
    710767</osm>
  • applications/editors/josm/plugins/utilsplugin/src/UtilsPlugin/JoinAreasAction.java

    r13776 r14356  
    11package UtilsPlugin;
    22
     3import static org.openstreetmap.josm.tools.I18n.marktr;
    34import static org.openstreetmap.josm.tools.I18n.tr;
    45import static org.openstreetmap.josm.tools.I18n.trn;
     
    214215        ArrayList<OsmPrimitive> nodes = addIntersections(a, b);
    215216        if(nodes.size() == 0) return hadChanges;
    216         commitCommands("Added node on all intersections");
     217        commitCommands(marktr("Added node on all intersections"));
    217218
    218219        // Remove ways from all relations so ways can be combined/split quietly
     
    238239        if(innerWays != null && innerWays.size() > 0)
    239240            cmds.add(DeleteCommand.delete(innerWays, true));
    240         commitCommands("Delete Ways that are not part of an inner multipolygon");
     241        commitCommands(marktr("Delete Ways that are not part of an inner multipolygon"));
    241242
    242243        // We can attach our new multipolygon relation and pretend it has always been there
    243244        addOwnMultigonRelation(newInnerWays, outerWay, relations);
    244245        fixRelations(relations, outerWay);
    245         commitCommands("Fix relations");
     246        commitCommands(marktr("Fix relations"));
    246247
    247248        stripTags(newInnerWays);
    248249        makeCommitsOneAction(
    249             a.equals(b)
    250                 ? "Joined self-overlapping area " + a.getName()
    251                 : "Joined overlapping areas " + a.getName() + " and " + b.getName()
     250            same
     251                ? marktr("Joined self-overlapping area")
     252                : marktr("Joined overlapping areas")
    252253        );
    253254
     
    328329        cmds.add(new ChangeCommand(a, ax));
    329330        cmds.add(new ChangeCommand(b, bx));
    330         commitCommands("Fix tag conflicts");
     331        commitCommands(marktr("Fix tag conflicts"));
    331332        return false;
    332333    }
     
    477478        }
    478479
    479         commitCommands("Removed Element from Relations");
     480        commitCommands(marktr("Removed Element from Relations"));
    480481        return result;
    481482    }
     
    542543            for(Node n: multigonNodes) {
    543544                if(!((Way)w).nodes.contains(n) && poly.contains(latlonToXY(n.coor.lat()), latlonToXY(n.coor.lon()))) {
    544                     innerWays.addAll(getWaysByNode(multigonWays, n));
     545                    getWaysByNode(innerWays, multigonWays, n);
    545546                }
    546547            }
     
    557558    /**
    558559     * Finds all ways that contain the given node.
    559      * @param Collection<OsmPrimitive> A collection of OsmPrimitives, but only ways will be honored
     560     * @param Collection<Way> A list to which matching ways will be added
     561     * @param Collection<Way> A list of ways to check
    560562     * @param Node The node the ways should be checked against
    561      * @return Collection<Way> A list of ways that contain the given node
    562      */
    563     private Collection<Way> getWaysByNode(Collection<Way> w, Node n) {
    564         Collection<Way> deletedWays = new ArrayList<Way>();
     563     */
     564    private void getWaysByNode(Collection<Way> innerWays, Collection<Way> w, Node n) {
    565565        for(Way way : w) {
    566566            if(!((Way)way).nodes.contains(n)) continue;
    567             if(!deletedWays.contains(way)) deletedWays.add(way); // Will need this later for multigons
    568         }
    569         return deletedWays;
     567            if(!innerWays.contains(way)) innerWays.add(way); // Will need this later for multigons
     568        }
    570569    }
    571570
     
    588587        }
    589588
    590         commitCommands("Join Areas: Remove Short Ways");
    591         return joinWays(join);
     589        commitCommands(marktr("Join Areas: Remove Short Ways"));
     590        return closeWay(joinWays(join));
     591    }
     592
     593    /**
     594     * Ensures a way is closed. If it isn't, last and first node are connected.
     595     * @param Way the way to ensure it's closed
     596     * @return Way The joined way.
     597     */
     598    private Way closeWay(Way w) {
     599        if(w.isClosed())
     600            return w;
     601        Main.ds.setSelected(w);
     602        Way wnew = new Way(w);
     603        wnew.addNode(wnew.firstNode());
     604        cmds.add(new ChangeCommand(w, wnew));
     605        commitCommands(marktr("Closed Way"));
     606        return (Way)(Main.ds.getSelectedWays().toArray())[0];
    592607    }
    593608
     
    599614    private Way joinWays(ArrayList<Way> ways) {
    600615        if(ways.size() < 2) return ways.get(0);
    601         //Main.ds.setSelected(ways);
    602616
    603617        // This will turn ways so all of them point in the same direction and CombineAction won't bug
     
    618632        }
    619633        Main.ds.setSelected(ways);
     634        // TODO: It might be possible that a confirmation dialog is presented even after reversing (for
     635        // "strange" ways). If the user cancels this, makeCommitsOneAction will wrongly consume a previous
     636        // action. Make CombineWayAction either silent or expose its combining capabilities.
    620637        new CombineWayAction().actionPerformed(null);
    621638        cmdsCount++;
     
    641658        // inner multigon part will have at least two ways, so we can use this to find which ways do
    642659        // belong to the multigon.
    643         Collection<Way> possibleWays = new ArrayList<Way>();
     660        ArrayList<Way> possibleWays = new ArrayList<Way>();
    644661        wayIterator: for(Way w : uninterestingWays) {
    645662            boolean hasInnerNodes = false;
     
    648665                if(!hasInnerNodes && innerNodes.contains(n)) hasInnerNodes = true;
    649666            }
    650             if(!hasInnerNodes && w.nodes.size() >= 2) continue;
     667            if(!hasInnerNodes || w.nodes.size() < 2) continue;
    651668            possibleWays.add(w);
    652669        }
     670
     671        // This removes unnecessary ways that might have been added.
     672        removeAlmostAlikeWays(possibleWays);
     673        removePartlyUnconnectedWays(possibleWays);
    653674
    654675        // Join all ways that have one start/ending node in common
     
    685706        } while(joined != null);
    686707        return newInnerWays;
     708    }
     709
     710    /**
     711     * Removes almost alike ways (= ways that are on top of each other for all nodes)
     712     * @param ArrayList<Way> the ways to remove almost-duplicates from
     713     */
     714    private void removeAlmostAlikeWays(ArrayList<Way> ways) {
     715        Collection<Way> removables = new ArrayList<Way>();
     716        outer: for(int i=0; i < ways.size(); i++) {
     717            Way a = ways.get(i);
     718            for(int j=i+1; j < ways.size(); j++) {
     719                Way b = ways.get(j);
     720                List<Node> revNodes = new ArrayList<Node>(b.nodes);
     721                Collections.reverse(revNodes);
     722                if(a.nodes.equals(b.nodes) || a.nodes.equals(revNodes)) {
     723                    removables.add(a);
     724                    continue outer;
     725                }
     726            }
     727        }
     728        ways.removeAll(removables);
     729    }
     730
     731    /**
     732     * Removes ways from the given list whose starting or ending node doesn't
     733     * connect to other ways from the same list (it's like removing spikes).
     734     * @param ArrayList<Way> The list of ways to remove "spikes" from
     735     */
     736    private void removePartlyUnconnectedWays(ArrayList<Way> ways) {
     737        List<Way> removables = new ArrayList<Way>();
     738        for(Way a : ways) {
     739            if(a.isClosed()) continue;
     740            boolean connectedStart = false;
     741            boolean connectedEnd = false;
     742            for(Way b : ways) {
     743                if(a.equals(b))
     744                    continue;
     745                if(b.isFirstLastNode(a.firstNode()))
     746                    connectedStart = true;
     747                if(b.isFirstLastNode(a.lastNode()))
     748                    connectedEnd = true;
     749            }
     750            if(!connectedStart || !connectedEnd)
     751                removables.add(a);
     752        }
     753        ways.removeAll(removables);
    687754    }
    688755
     
    803870    private void stripTags(Collection<Way> ways) {
    804871        for(Way w: ways) stripTags(w);
    805         commitCommands("Remove tags from inner ways");
     872        commitCommands(marktr("Remove tags from inner ways"));
    806873    }
    807874
     
    825892        UndoRedoHandler ur = Main.main.undoRedo;
    826893        cmds.clear();
    827         for(int i = ur.commands.size() - cmdsCount; i < ur.commands.size(); i++)
     894        int i = Math.max(ur.commands.size() - cmdsCount, 0);
     895        for(; i < ur.commands.size(); i++)
    828896            cmds.add(ur.commands.get(i));
    829897
    830         for(int i = 0; i < cmdsCount; i++)
     898        for(i = 0; i < cmds.size(); i++)
    831899            ur.undo();
    832900
    833         commitCommands(message == null ? "Join Areas Function" : message);
     901        commitCommands(message == null ? marktr("Join Areas Function") : message);
    834902        cmdsCount = 0;
    835903    }
Note: See TracChangeset for help on using the changeset viewer.