Ticket #13570: 13570_v2.patch

File 13570_v2.patch, 54.5 KB (added by GerdP, 8 years ago)
  • data_nodist/coastlines.osm

     
     1<?xml version='1.0' encoding='UTF-8'?>
     2<osm version='0.6' upload='false' generator='JOSM'>
     3  <bounds minlat='-22.95' minlon='-42.5951367' maxlat='-22.93' maxlon='-42.5878312' origin='JOSM' />
     4  <node id='-11' action='modify' visible='true' lat='-22.93228268641' lon='-42.59325100232'>
     5    <tag k='josm_error_codes' v='1001' />
     6  </node>
     7  <node id='-13' action='modify' visible='true' lat='-22.93220124728' lon='-42.59296747156'>
     8    <tag k='josm_error_codes' v='1001' />
     9  </node>
     10  <node id='-15' action='modify' visible='true' lat='-22.93227880836' lon='-42.59272183847'>
     11    <tag k='josm_error_codes' v='1001' />
     12  </node>
     13  <node id='-17' action='modify' visible='true' lat='-22.9325114913' lon='-42.59257866948'>
     14    <tag k='josm_error_codes' v='1001' />
     15  </node>
     16  <node id='-19' action='modify' visible='true' lat='-22.93260585706' lon='-42.59263481418'>
     17    <tag k='josm_error_codes' v='1001' />
     18  </node>
     19  <node id='-21' action='modify' visible='true' lat='-22.9326368814' lon='-42.59299554391'>
     20    <tag k='josm_error_codes' v='1001' />
     21  </node>
     22  <node id='-23' action='modify' visible='true' lat='-22.93253863762' lon='-42.59334223747'>
     23    <tag k='josm_error_codes' v='1001' />
     24  </node>
     25  <node id='-25' action='modify' visible='true' lat='-22.9308985405' lon='-42.59187037746' />
     26  <node id='-27' action='modify' visible='true' lat='-22.93081710054' lon='-42.5915868467' />
     27  <node id='-29' action='modify' visible='true' lat='-22.9308946624' lon='-42.59134121361' />
     28  <node id='-31' action='modify' visible='true' lat='-22.93112734774' lon='-42.59119804461' />
     29  <node id='-33' action='modify' visible='true' lat='-22.93122171444' lon='-42.59125418932' />
     30  <node id='-35' action='modify' visible='true' lat='-22.93125273911' lon='-42.59161491905' />
     31  <node id='-37' action='modify' visible='true' lat='-22.93115449432' lon='-42.59196161261' />
     32  <node id='-39' action='modify' visible='true' lat='-22.93437682152' lon='-42.59388858684' />
     33  <node id='-41' action='modify' visible='true' lat='-22.93405647565' lon='-42.59357855396' />
     34  <node id='-43' action='modify' visible='true' lat='-22.93405647565' lon='-42.59282237623' />
     35  <node id='-45' action='modify' visible='true' lat='-22.93453003015' lon='-42.59264089357' />
     36  <node id='-47' action='modify' visible='true' lat='-22.93489912293' lon='-42.59262577001' />
     37  <node id='-49' action='modify' visible='true' lat='-22.93485733889' lon='-42.59340463308' />
     38  <node id='-51' action='modify' visible='true' lat='-22.93392299504' lon='-42.59215803098' />
     39  <node id='-53' action='modify' visible='true' lat='-22.93417130306' lon='-42.59193715049' />
     40  <node id='-55' action='modify' visible='true' lat='-22.93655746253' lon='-42.59421578323' />
     41  <node id='-57' action='modify' visible='true' lat='-22.93613266275' lon='-42.59367685707' />
     42  <node id='-59' action='modify' visible='true' lat='-22.93602820357' lon='-42.59291311755' />
     43  <node id='-61' action='modify' visible='true' lat='-22.93602820357' lon='-42.5918620305' />
     44  <node id='-63' action='modify' visible='true' lat='-22.93698922489' lon='-42.59042529279' />
     45  <node id='-65' action='modify' visible='true' lat='-22.93614659062' lon='-42.59114366165' />
     46  <node id='-67' action='modify' visible='true' lat='-22.93633461691' lon='-42.59205863671' />
     47  <node id='-69' action='modify' visible='true' lat='-22.93765648073' lon='-42.59314422735' />
     48  <node id='-71' action='modify' visible='true' lat='-22.93721775257' lon='-42.59208556876' />
     49  <node id='-73' action='modify' visible='true' lat='-22.93738488727' lon='-42.59068662705' />
     50  <node id='-75' action='modify' visible='true' lat='-22.93786539841' lon='-42.59008924113' />
     51  <node id='-77' action='modify' visible='true' lat='-22.93822055771' lon='-42.59129157481' />
     52  <node id='-79' action='modify' visible='true' lat='-22.9322620129' lon='-42.59221337032'>
     53    <tag k='josm_error_codes' v='1001' />
     54  </node>
     55  <node id='-81' action='modify' visible='true' lat='-22.93218057377' lon='-42.59192983956'>
     56    <tag k='josm_error_codes' v='1001' />
     57  </node>
     58  <node id='-83' action='modify' visible='true' lat='-22.93225813485' lon='-42.59168420647'>
     59    <tag k='josm_error_codes' v='1001' />
     60  </node>
     61  <node id='-85' action='modify' visible='true' lat='-22.93249081784' lon='-42.59154103748'>
     62    <tag k='josm_error_codes' v='1001' />
     63  </node>
     64  <node id='-87' action='modify' visible='true' lat='-22.93258518361' lon='-42.59159718218'>
     65    <tag k='josm_error_codes' v='1001' />
     66  </node>
     67  <node id='-89' action='modify' visible='true' lat='-22.93261620795' lon='-42.59195791191'>
     68    <tag k='josm_error_codes' v='1001' />
     69  </node>
     70  <node id='-91' action='modify' visible='true' lat='-22.93251796416' lon='-42.59230460547'>
     71    <tag k='josm_error_codes' v='1001' />
     72  </node>
     73  <node id='-93' action='modify' visible='true' lat='-22.93090875615' lon='-42.59310227407' />
     74  <node id='-95' action='modify' visible='true' lat='-22.93116470997' lon='-42.59319350922' />
     75  <node id='-97' action='modify' visible='true' lat='-22.93126295473' lon='-42.59284681566' />
     76  <node id='-99' action='modify' visible='true' lat='-22.93123193008' lon='-42.59248608593' />
     77  <node id='-101' action='modify' visible='true' lat='-22.93113756337' lon='-42.59242994122' />
     78  <node id='-103' action='modify' visible='true' lat='-22.93090487805' lon='-42.59257311022' />
     79  <node id='-105' action='modify' visible='true' lat='-22.93082731619' lon='-42.59281874331' />
     80  <node id='-107' action='modify' visible='true' lat='-22.93261583737' lon='-42.59101907303'>
     81    <tag k='josm_error_codes' v='1001' />
     82  </node>
     83  <node id='-109' action='modify' visible='true' lat='-22.93251759357' lon='-42.59136576659'>
     84    <tag k='josm_error_codes' v='1001' />
     85  </node>
     86  <node id='-111' action='modify' visible='true' lat='-22.93226164231' lon='-42.59127453144'>
     87    <tag k='josm_error_codes' v='1001' />
     88  </node>
     89  <node id='-113' action='modify' visible='true' lat='-22.93218020319' lon='-42.59099100068'>
     90    <tag k='josm_error_codes' v='1001' />
     91  </node>
     92  <node id='-115' action='modify' visible='true' lat='-22.93225776426' lon='-42.59074536759'>
     93    <tag k='josm_error_codes' v='1001' />
     94  </node>
     95  <node id='-117' action='modify' visible='true' lat='-22.93249044726' lon='-42.5906021986'>
     96    <tag k='josm_error_codes' v='1001' />
     97  </node>
     98  <node id='-119' action='modify' visible='true' lat='-22.93258481303' lon='-42.5906583433'>
     99    <tag k='josm_error_codes' v='1001' />
     100  </node>
     101  <node id='-121' action='modify' visible='true' lat='-22.93025580711' lon='-42.59369056365' />
     102  <node id='-123' action='modify' visible='true' lat='-22.93026515875' lon='-42.59085759197' />
     103  <node id='-125' action='modify' visible='true' lat='-22.93196512453' lon='-42.59086420786' />
     104  <node id='-127' action='modify' visible='true' lat='-22.93195577301' lon='-42.59369717955' />
     105  <node id='-129' action='modify' visible='true' lat='-22.93097091507' lon='-42.58900954097' />
     106  <node id='-131' action='modify' visible='true' lat='-22.93031798639' lon='-42.58740258288' />
     107  <node id='-133' action='modify' visible='true' lat='-22.9315286225' lon='-42.58902726477' />
     108  <node id='-135' action='modify' visible='true' lat='-22.93188228944' lon='-42.58779250653' />
     109  <node id='-137' action='modify' visible='true' lat='-22.93187684841' lon='-42.58742030668' />
     110  <node id='-139' action='modify' visible='true' lat='-22.93617822615' lon='-42.58744883097' />
     111  <node id='-141' action='modify' visible='true' lat='-22.93663525678' lon='-42.58854770672' />
     112  <node id='-143' action='modify' visible='true' lat='-22.93795193164' lon='-42.5883350211' />
     113  <node id='-145' action='modify' visible='true' lat='-22.93795193164' lon='-42.58711798666' />
     114  <node id='-147' action='modify' visible='true' lat='-22.93668966509' lon='-42.58731885642' />
     115  <node id='-149' action='modify' visible='true' lat='-22.9324334361' lon='-42.59600068174'>
     116    <tag k='josm_error_codes' v='904' />
     117  </node>
     118  <node id='-151' action='modify' visible='true' lat='-22.9342254466' lon='-42.59800962863' />
     119  <node id='-153' action='modify' visible='true' lat='-22.93390510037' lon='-42.59769959575' />
     120  <node id='-155' action='modify' visible='true' lat='-22.93390510037' lon='-42.59694341802' />
     121  <node id='-157' action='modify' visible='true' lat='-22.93437865539' lon='-42.59676193536' />
     122  <node id='-159' action='modify' visible='true' lat='-22.93474774859' lon='-42.5967468118' />
     123  <node id='-161' action='modify' visible='true' lat='-22.9347059645' lon='-42.59752567487' />
     124  <node id='-163' action='modify' visible='true' lat='-22.93377161961' lon='-42.59627907277' />
     125  <node id='-165' action='modify' visible='true' lat='-22.9340199279' lon='-42.59605819228' />
     126  <node id='-167' action='modify' visible='true' lat='-22.93617810233' lon='-42.59954161766' />
     127  <node id='-169' action='modify' visible='true' lat='-22.93575330135' lon='-42.59893667547' />
     128  <node id='-171' action='modify' visible='true' lat='-22.93564884189' lon='-42.59817293595' />
     129  <node id='-173' action='modify' visible='true' lat='-22.93564884189' lon='-42.5971218489' />
     130  <node id='-175' action='modify' visible='true' lat='-22.9366098659' lon='-42.59568511119' />
     131  <node id='-177' action='modify' visible='true' lat='-22.93576722926' lon='-42.59640348005' />
     132  <node id='-179' action='modify' visible='true' lat='-22.93595525609' lon='-42.59731845511' />
     133  <node id='-181' action='modify' visible='true' lat='-22.93726192454' lon='-42.598882662' />
     134  <node id='-183' action='modify' visible='true' lat='-22.93682319509' lon='-42.59782400341' />
     135  <node id='-185' action='modify' visible='true' lat='-22.93699033028' lon='-42.5964250617' />
     136  <node id='-187' action='modify' visible='true' lat='-22.93747084282' lon='-42.59582767578' />
     137  <node id='-189' action='modify' visible='true' lat='-22.93782600315' lon='-42.59703000946' />
     138  <node id='-191' action='modify' visible='true' lat='-22.94034396875' lon='-42.59932184915' />
     139  <node id='-193' action='modify' visible='true' lat='-22.93977226185' lon='-42.59979522209' />
     140  <node id='-195' action='modify' visible='true' lat='-22.93884391255' lon='-42.59811556712' />
     141  <node id='-197' action='modify' visible='true' lat='-22.93886094129' lon='-42.59699566966' />
     142  <node id='-199' action='modify' visible='true' lat='-22.93924396283' lon='-42.5963755829' />
     143  <node id='-201' action='modify' visible='true' lat='-22.94007267843' lon='-42.59543789073' />
     144  <node id='-203' action='modify' visible='true' lat='-22.93211063561' lon='-42.59755570876'>
     145    <tag k='josm_error_codes' v='904' />
     146  </node>
     147  <node id='-205' action='modify' visible='true' lat='-22.93202919639' lon='-42.597272178'>
     148    <tag k='josm_error_codes' v='904' />
     149  </node>
     150  <node id='-207' action='modify' visible='true' lat='-22.93210675757' lon='-42.59702654491'>
     151    <tag k='josm_error_codes' v='904' />
     152  </node>
     153  <node id='-209' action='modify' visible='true' lat='-22.93213130914' lon='-42.59859334076'>
     154    <tag k='josm_error_codes' v='1001' />
     155  </node>
     156  <node id='-211' action='modify' visible='true' lat='-22.93233944081' lon='-42.59688337592'>
     157    <tag k='josm_error_codes' v='904' />
     158  </node>
     159  <node id='-213' action='modify' visible='true' lat='-22.93204986993' lon='-42.59830981'>
     160    <tag k='josm_error_codes' v='1001' />
     161  </node>
     162  <node id='-215' action='modify' visible='true' lat='-22.93243380668' lon='-42.59693952062'>
     163    <tag k='josm_error_codes' v='904' />
     164  </node>
     165  <node id='-217' action='modify' visible='true' lat='-22.93212743109' lon='-42.59806417691'>
     166    <tag k='josm_error_codes' v='1001' />
     167  </node>
     168  <node id='-219' action='modify' visible='true' lat='-22.93246483106' lon='-42.59730025035'>
     169    <tag k='josm_error_codes' v='904' />
     170  </node>
     171  <node id='-221' action='modify' visible='true' lat='-22.9323601143' lon='-42.59792100792'>
     172    <tag k='josm_error_codes' v='1001' />
     173  </node>
     174  <node id='-223' action='modify' visible='true' lat='-22.93236658716' lon='-42.59764694391'>
     175    <tag k='josm_error_codes' v='904' />
     176  </node>
     177  <node id='-225' action='modify' visible='true' lat='-22.93245448015' lon='-42.59797715262'>
     178    <tag k='josm_error_codes' v='1001' />
     179  </node>
     180  <node id='-227' action='modify' visible='true' lat='-22.93248550452' lon='-42.59833788235'>
     181    <tag k='josm_error_codes' v='1001' />
     182  </node>
     183  <node id='-229' action='modify' visible='true' lat='-22.93238726065' lon='-42.59868457591'>
     184    <tag k='josm_error_codes' v='1001' />
     185  </node>
     186  <node id='-231' action='modify' visible='true' lat='-22.94125413118' lon='-42.59808265149' />
     187  <node id='-233' action='modify' visible='true' lat='-22.93246446048' lon='-42.59636141147'>
     188    <tag k='josm_error_codes' v='904' />
     189  </node>
     190  <node id='-235' action='modify' visible='true' lat='-22.93236621657' lon='-42.59670810503'>
     191    <tag k='josm_error_codes' v='904' />
     192  </node>
     193  <node id='-237' action='modify' visible='true' lat='-22.93211026502' lon='-42.59661686988'>
     194    <tag k='josm_error_codes' v='904' />
     195  </node>
     196  <node id='-239' action='modify' visible='true' lat='-22.93202882581' lon='-42.59633333912'>
     197    <tag k='josm_error_codes' v='904' />
     198  </node>
     199  <node id='-241' action='modify' visible='true' lat='-22.93210638697' lon='-42.59608770603'>
     200    <tag k='josm_error_codes' v='904' />
     201  </node>
     202  <node id='-243' action='modify' visible='true' lat='-22.93233907023' lon='-42.59594453704'>
     203    <tag k='josm_error_codes' v='904' />
     204  </node>
     205  <node id='-245' action='modify' visible='true' lat='-22.93000020899' lon='-42.59857866731' />
     206  <node id='-247' action='modify' visible='true' lat='-22.93065315927' lon='-42.59799037773' />
     207  <node id='-249' action='modify' visible='true' lat='-22.93000956066' lon='-42.59574569563' />
     208  <node id='-251' action='modify' visible='true' lat='-22.93090911357' lon='-42.59808161288' />
     209  <node id='-253' action='modify' visible='true' lat='-22.93170952965' lon='-42.59575231152' />
     210  <node id='-255' action='modify' visible='true' lat='-22.93100735852' lon='-42.59773491932' />
     211  <node id='-257' action='modify' visible='true' lat='-22.9317001781' lon='-42.59858528321' />
     212  <node id='-259' action='modify' visible='true' lat='-22.9306429436' lon='-42.59675848112' />
     213  <node id='-261' action='modify' visible='true' lat='-22.9309763338' lon='-42.59737418959' />
     214  <node id='-263' action='modify' visible='true' lat='-22.93056150348' lon='-42.59647495036' />
     215  <node id='-265' action='modify' visible='true' lat='-22.93088196692' lon='-42.59731804488' />
     216  <node id='-267' action='modify' visible='true' lat='-22.93064928117' lon='-42.59746121388' />
     217  <node id='-269' action='modify' visible='true' lat='-22.93063906549' lon='-42.59622931727' />
     218  <node id='-271' action='modify' visible='true' lat='-22.93087175126' lon='-42.59608614827' />
     219  <node id='-273' action='modify' visible='true' lat='-22.93057171916' lon='-42.59770684697' />
     220  <node id='-275' action='modify' visible='true' lat='-22.93096611816' lon='-42.59614229298' />
     221  <node id='-277' action='modify' visible='true' lat='-22.93099714287' lon='-42.59650302271' />
     222  <node id='-279' action='modify' visible='true' lat='-22.93089889791' lon='-42.59684971627' />
     223  <node id='-281' action='modify' visible='true' lat='-22.94135559003' lon='-42.59225407414' />
     224  <node id='-283' action='modify' visible='true' lat='-22.93934542319' lon='-42.59054700555' />
     225  <node id='-285' action='modify' visible='true' lat='-22.94017413817' lon='-42.58960931338' />
     226  <node id='-287' action='modify' visible='true' lat='-22.94044542828' lon='-42.59349327181' />
     227  <node id='-289' action='modify' visible='true' lat='-22.93987372182' lon='-42.59396664474' />
     228  <node id='-291' action='modify' visible='true' lat='-22.93894537321' lon='-42.59228698978' />
     229  <node id='-293' action='modify' visible='true' lat='-22.93896240194' lon='-42.59116709231' />
     230  <node id='-295' action='modify' visible='true' lat='-22.93300138853' lon='-42.59817225915' />
     231  <node id='-297' action='modify' visible='true' lat='-22.93274302673' lon='-42.59849287024' />
     232  <node id='-299' action='modify' visible='true' lat='-22.93301984292' lon='-42.59876004615' />
     233  <node id='-301' action='modify' visible='true' lat='-22.93333971871' lon='-42.59848619084' />
     234  <node id='-303' action='modify' visible='true' lat='-22.93278608706' lon='-42.59793180083' />
     235  <node id='-305' action='modify' visible='true' lat='-22.93301369146' lon='-42.59763122793' />
     236  <node id='-307' action='modify' visible='true' lat='-22.93330281001' lon='-42.5977180601' />
     237  <node id='-309' action='modify' visible='true' lat='-22.93299677493' lon='-42.59698666606' />
     238  <node id='-311' action='modify' visible='true' lat='-22.93275686755' lon='-42.5971436319' />
     239  <node id='-313' action='modify' visible='true' lat='-22.93299985066' lon='-42.59746424299' />
     240  <node id='-315' action='modify' visible='true' lat='-22.93326743916' lon='-42.59729057865' />
     241  <node id='-317' action='modify' visible='true' lat='-22.93279992788' lon='-42.59658924189' />
     242  <node id='-319' action='modify' visible='true' lat='-22.93321822752' lon='-42.5968597575' />
     243  <node id='-321' action='modify' visible='true' lat='-22.93309827408' lon='-42.59653246701' />
     244  <node id='-323' action='modify' visible='true' lat='-22.93317362946' lon='-42.59609496646' />
     245  <node id='-325' action='modify' visible='true' lat='-22.9329983128' lon='-42.59595469911' />
     246  <node id='-327' action='modify' visible='true' lat='-22.93279223854' lon='-42.59614172225' />
     247  <node id='-329' action='modify' visible='true' lat='-22.93289373784' lon='-42.59637884087' />
     248  <node id='-331' action='modify' visible='true' lat='-22.93283222312' lon='-42.59572425989' />
     249  <node id='-333' action='modify' visible='true' lat='-22.93314594789' lon='-42.59581109206' />
     250  <node id='-335' action='modify' visible='true' lat='-22.93305367598' lon='-42.59563074832' />
     251  <node id='-337' action='modify' visible='true' lat='-22.93301061573' lon='-42.59139768003' />
     252  <node id='-339' action='modify' visible='true' lat='-22.93294910106' lon='-42.59074309906' />
     253  <node id='-341' action='modify' visible='true' lat='-22.93326282556' lon='-42.59082993123' />
     254  <node id='-343' action='modify' visible='true' lat='-22.93317055373' lon='-42.59064958749' />
     255  <node id='-345' action='modify' visible='true' lat='-22.93311826632' lon='-42.59319109832' />
     256  <node id='-347' action='modify' visible='true' lat='-22.93285990475' lon='-42.59351170941' />
     257  <node id='-349' action='modify' visible='true' lat='-22.9331367207' lon='-42.59377888531' />
     258  <node id='-351' action='modify' visible='true' lat='-22.93345659622' lon='-42.59350503001' />
     259  <node id='-353' action='modify' visible='true' lat='-22.93290296504' lon='-42.59295064' />
     260  <node id='-355' action='modify' visible='true' lat='-22.93313056924' lon='-42.5926500671' />
     261  <node id='-357' action='modify' visible='true' lat='-22.93341968754' lon='-42.59273689927' />
     262  <node id='-359' action='modify' visible='true' lat='-22.93311365273' lon='-42.59200550522' />
     263  <node id='-361' action='modify' visible='true' lat='-22.93287374556' lon='-42.59216247107' />
     264  <node id='-363' action='modify' visible='true' lat='-22.93311672846' lon='-42.59248308216' />
     265  <node id='-365' action='modify' visible='true' lat='-22.93338431672' lon='-42.59230941782' />
     266  <node id='-367' action='modify' visible='true' lat='-22.93291680585' lon='-42.59160808106' />
     267  <node id='-369' action='modify' visible='true' lat='-22.93333510513' lon='-42.59187859667' />
     268  <node id='-371' action='modify' visible='true' lat='-22.9332905071' lon='-42.59111380563' />
     269  <node id='-373' action='modify' visible='true' lat='-22.93311519059' lon='-42.59097353828' />
     270  <node id='-375' action='modify' visible='true' lat='-22.93321515179' lon='-42.59155130618' />
     271  <node id='-377' action='modify' visible='true' lat='-22.93290911651' lon='-42.59116056142' />
     272  <way id='-379' action='modify' visible='true'>
     273    <nd ref='-11' />
     274    <nd ref='-13' />
     275    <nd ref='-15' />
     276    <nd ref='-17' />
     277    <nd ref='-19' />
     278    <nd ref='-21' />
     279    <nd ref='-23' />
     280    <nd ref='-11' />
     281    <tag k='josm_error_codes' v='1001' />
     282    <tag k='name' v='01- inside - land on left side' />
     283    <tag k='natural' v='coastline' />
     284  </way>
     285  <way id='-381' action='modify' visible='true'>
     286    <nd ref='-25' />
     287    <nd ref='-37' />
     288    <nd ref='-35' />
     289    <nd ref='-33' />
     290    <nd ref='-31' />
     291    <nd ref='-29' />
     292    <nd ref='-27' />
     293    <nd ref='-25' />
     294    <tag k='description' v='good' />
     295    <tag k='josm_error_codes' v='none' />
     296    <tag k='natural' v='coastline' />
     297  </way>
     298  <way id='-383' action='modify' visible='true'>
     299    <nd ref='-39' />
     300    <nd ref='-49' />
     301    <nd ref='-47' />
     302    <nd ref='-45' />
     303    <nd ref='-43' />
     304    <nd ref='-41' />
     305    <nd ref='-39' />
     306    <tag k='josm_error_codes' v='901' />
     307    <tag k='name' v='01-inside-closed-connected-to-unclosed-in-2-nodes' />
     308    <tag k='natural' v='coastline' />
     309  </way>
     310  <way id='-385' action='modify' visible='true'>
     311    <nd ref='-47' />
     312    <nd ref='-53' />
     313    <nd ref='-51' />
     314    <nd ref='-43' />
     315    <tag k='josm_error_codes' v='901' />
     316    <tag k='name' v='02-inside-closed-connected-to-unclosed-in-2-nodes' />
     317    <tag k='natural' v='coastline' />
     318  </way>
     319  <way id='-387' action='modify' visible='true'>
     320    <nd ref='-61' />
     321    <nd ref='-59' />
     322    <nd ref='-57' />
     323    <nd ref='-55' />
     324    <tag k='josm_error_codes' v='901,903' />
     325    <tag k='name' v='inside-left-unconnected' />
     326    <tag k='natural' v='coastline' />
     327  </way>
     328  <way id='-389' action='modify' visible='true'>
     329    <nd ref='-63' />
     330    <nd ref='-65' />
     331    <nd ref='-61' />
     332    <tag k='josm_error_codes' v='901,903' />
     333    <tag k='name' v='inside-right-unconnected' />
     334    <tag k='natural' v='coastline' />
     335  </way>
     336  <way id='-391' action='modify' visible='true'>
     337    <nd ref='-65' />
     338    <nd ref='-67' />
     339    <nd ref='-57' />
     340    <tag k='josm_error_codes' v='901' />
     341    <tag k='name' v='inside-unclosed-connected-to-unclosed' />
     342    <tag k='natural' v='coastline' />
     343  </way>
     344  <way id='-393' action='modify' visible='true'>
     345    <nd ref='-69' />
     346    <nd ref='-71' />
     347    <nd ref='-73' />
     348    <nd ref='-75' />
     349    <tag k='josm_error_codes' v='901' />
     350    <tag k='name' v='inside-bad-unordered1-2' />
     351    <tag k='natural' v='coastline' />
     352  </way>
     353  <way id='-395' action='modify' visible='true'>
     354    <nd ref='-69' />
     355    <nd ref='-77' />
     356    <nd ref='-75' />
     357    <tag k='josm_error_codes' v='901' />
     358    <tag k='name' v='inside-bad-unordered2-2' />
     359    <tag k='natural' v='coastline' />
     360  </way>
     361  <way id='-397' action='modify' visible='true'>
     362    <nd ref='-81' />
     363    <nd ref='-83' />
     364    <nd ref='-85' />
     365    <nd ref='-87' />
     366    <nd ref='-89' />
     367    <tag k='josm_error_codes' v='904' />
     368    <tag k='name' v='badpart2' />
     369    <tag k='natural' v='coastline' />
     370  </way>
     371  <way id='-399' action='modify' visible='true'>
     372    <nd ref='-97' />
     373    <nd ref='-99' />
     374    <nd ref='-101' />
     375    <nd ref='-103' />
     376    <nd ref='-105' />
     377    <tag k='description' v='goodpart2' />
     378    <tag k='josm_error_codes' v='none' />
     379    <tag k='natural' v='coastline' />
     380  </way>
     381  <way id='-401' action='modify' visible='true'>
     382    <nd ref='-89' />
     383    <nd ref='-91' />
     384    <nd ref='-79' />
     385    <nd ref='-81' />
     386    <tag k='josm_error_codes' v='904' />
     387    <tag k='name' v='badpart1' />
     388    <tag k='natural' v='coastline' />
     389  </way>
     390  <way id='-403' action='modify' visible='true'>
     391    <nd ref='-105' />
     392    <nd ref='-93' />
     393    <nd ref='-95' />
     394    <nd ref='-97' />
     395    <tag k='description' v='goodpart1' />
     396    <tag k='josm_error_codes' v='none' />
     397    <tag k='natural' v='coastline' />
     398  </way>
     399  <way id='-405' action='modify' visible='true'>
     400    <nd ref='-107' />
     401    <nd ref='-109' />
     402    <nd ref='-111' />
     403    <nd ref='-113' />
     404    <tag k='josm_error_codes' v='904' />
     405    <tag k='name' v='badpart1' />
     406    <tag k='natural' v='coastline' />
     407  </way>
     408  <way id='-407' action='modify' visible='true'>
     409    <nd ref='-113' />
     410    <nd ref='-115' />
     411    <nd ref='-117' />
     412    <nd ref='-119' />
     413    <tag k='josm_error_codes' v='904' />
     414    <tag k='name' v='badpart2' />
     415    <tag k='natural' v='coastline' />
     416  </way>
     417  <way id='-409' action='modify' visible='true'>
     418    <nd ref='-119' />
     419    <nd ref='-107' />
     420    <tag k='josm_error_codes' v='904' />
     421    <tag k='name' v='badpart3' />
     422    <tag k='natural' v='coastline' />
     423  </way>
     424  <way id='-411' action='modify' visible='true'>
     425    <nd ref='-121' />
     426    <nd ref='-123' />
     427    <nd ref='-125' />
     428    <nd ref='-127' />
     429    <nd ref='-121' />
     430    <tag k='barrier' v='fence' />
     431    <tag k='name' v='good' />
     432  </way>
     433  <way id='-413' action='modify' visible='true'>
     434    <nd ref='-137' />
     435    <nd ref='-135' />
     436    <nd ref='-133' />
     437    <nd ref='-129' />
     438    <nd ref='-131' />
     439    <tag k='josm_error_codes' v='none' />
     440    <tag k='name' v='partly outside-okay' />
     441    <tag k='natural' v='coastline' />
     442  </way>
     443  <way id='-415' action='modify' visible='true'>
     444    <nd ref='-139' />
     445    <nd ref='-141' />
     446    <nd ref='-143' />
     447    <nd ref='-145' />
     448    <tag k='josm_error_codes' v='901' />
     449    <tag k='name' v='partly outside' />
     450    <tag k='natural' v='coastline' />
     451  </way>
     452  <way id='-417' action='modify' visible='true'>
     453    <nd ref='-147' />
     454    <nd ref='-145' />
     455    <tag k='josm_error_codes' v='901' />
     456    <tag k='name' v='fully outside' />
     457    <tag k='natural' v='coastline' />
     458  </way>
     459  <way id='-419' action='modify' visible='true'>
     460    <nd ref='-209' />
     461    <nd ref='-213' />
     462    <nd ref='-217' />
     463    <nd ref='-221' />
     464    <nd ref='-225' />
     465    <nd ref='-227' />
     466    <nd ref='-229' />
     467    <nd ref='-209' />
     468    <tag k='josm_error_codes' v='1001' />
     469    <tag k='name' v='01- outside - land on left side' />
     470    <tag k='natural' v='coastline' />
     471  </way>
     472  <way id='-421' action='modify' visible='true'>
     473    <nd ref='-151' />
     474    <nd ref='-161' />
     475    <nd ref='-159' />
     476    <nd ref='-157' />
     477    <nd ref='-155' />
     478    <nd ref='-153' />
     479    <nd ref='-151' />
     480    <tag k='josm_error_codes' v='901' />
     481    <tag k='name' v='01-outside-closed-connected-to-unclosed-in-2-nodes' />
     482    <tag k='natural' v='coastline' />
     483  </way>
     484  <way id='-423' action='modify' visible='true'>
     485    <nd ref='-159' />
     486    <nd ref='-165' />
     487    <nd ref='-163' />
     488    <nd ref='-155' />
     489    <tag k='josm_error_codes' v='901' />
     490    <tag k='name' v='02-outside-closed-connected-to-unclosed-in-2-nodes' />
     491    <tag k='natural' v='coastline' />
     492  </way>
     493  <way id='-425' action='modify' visible='true'>
     494    <nd ref='-173' />
     495    <nd ref='-171' />
     496    <nd ref='-169' />
     497    <nd ref='-167' />
     498    <tag k='josm_error_codes' v='901' />
     499    <tag k='name' v='outside-left-unconnected' />
     500    <tag k='natural' v='coastline' />
     501  </way>
     502  <way id='-427' action='modify' visible='true'>
     503    <nd ref='-175' />
     504    <nd ref='-177' />
     505    <nd ref='-173' />
     506    <tag k='josm_error_codes' v='901' />
     507    <tag k='name' v='outside-right-unconnected' />
     508    <tag k='natural' v='coastline' />
     509  </way>
     510  <way id='-429' action='modify' visible='true'>
     511    <nd ref='-177' />
     512    <nd ref='-179' />
     513    <nd ref='-169' />
     514    <tag k='josm_error_codes' v='901' />
     515    <tag k='name' v='outside-unclosed-connected-to-unclosed' />
     516    <tag k='natural' v='coastline' />
     517  </way>
     518  <way id='-431' action='modify' visible='true'>
     519    <nd ref='-181' />
     520    <nd ref='-183' />
     521    <nd ref='-185' />
     522    <nd ref='-187' />
     523    <tag k='josm_error_codes' v='901' />
     524    <tag k='name' v='outside-bad-unordered1-2' />
     525    <tag k='natural' v='coastline' />
     526  </way>
     527  <way id='-433' action='modify' visible='true'>
     528    <nd ref='-181' />
     529    <nd ref='-189' />
     530    <nd ref='-187' />
     531    <tag k='josm_error_codes' v='901' />
     532    <tag k='name' v='outside-bad-unordered2-2' />
     533    <tag k='natural' v='coastline' />
     534  </way>
     535  <way id='-435' action='modify' visible='true'>
     536    <nd ref='-191' />
     537    <nd ref='-193' />
     538    <nd ref='-195' />
     539    <tag k='josm_error_codes' v='901' />
     540    <tag k='name' v='outside-left-connected-to-reversed' />
     541    <tag k='natural' v='coastline' />
     542  </way>
     543  <way id='-437' action='modify' visible='true'>
     544    <nd ref='-197' />
     545    <nd ref='-199' />
     546    <nd ref='-201' />
     547    <nd ref='-231' />
     548    <nd ref='-191' />
     549    <tag k='josm_error_codes' v='901' />
     550    <tag k='name' v='outside-right--connected-to-reversed' />
     551    <tag k='natural' v='coastline' />
     552  </way>
     553  <way id='-439' action='modify' visible='true'>
     554    <nd ref='-197' />
     555    <nd ref='-195' />
     556    <tag k='josm_error_codes' v='902' />
     557    <tag k='name' v='outside-reversed-part' />
     558    <tag k='natural' v='coastline' />
     559  </way>
     560  <way id='-441' action='modify' visible='true'>
     561    <nd ref='-205' />
     562    <nd ref='-207' />
     563    <nd ref='-211' />
     564    <nd ref='-215' />
     565    <nd ref='-219' />
     566    <tag k='josm_error_codes' v='904' />
     567    <tag k='name' v='badpart2' />
     568    <tag k='natural' v='coastline' />
     569  </way>
     570  <way id='-443' action='modify' visible='true'>
     571    <nd ref='-219' />
     572    <nd ref='-223' />
     573    <nd ref='-203' />
     574    <nd ref='-205' />
     575    <tag k='josm_error_codes' v='904' />
     576    <tag k='name' v='badpart1' />
     577    <tag k='natural' v='coastline' />
     578  </way>
     579  <way id='-445' action='modify' visible='true'>
     580    <nd ref='-233' />
     581    <nd ref='-235' />
     582    <nd ref='-237' />
     583    <nd ref='-239' />
     584    <tag k='josm_error_codes' v='904' />
     585    <tag k='name' v='badpart1' />
     586    <tag k='natural' v='coastline' />
     587  </way>
     588  <way id='-447' action='modify' visible='true'>
     589    <nd ref='-239' />
     590    <nd ref='-241' />
     591    <nd ref='-243' />
     592    <nd ref='-149' />
     593    <tag k='josm_error_codes' v='904' />
     594    <tag k='name' v='badpart2' />
     595    <tag k='natural' v='coastline' />
     596  </way>
     597  <way id='-449' action='modify' visible='true'>
     598    <nd ref='-149' />
     599    <nd ref='-233' />
     600    <tag k='josm_error_codes' v='904' />
     601    <tag k='name' v='badpart3' />
     602    <tag k='natural' v='coastline' />
     603  </way>
     604  <way id='-451' action='modify' visible='true'>
     605    <nd ref='-259' />
     606    <nd ref='-279' />
     607    <nd ref='-277' />
     608    <nd ref='-275' />
     609    <nd ref='-271' />
     610    <nd ref='-269' />
     611    <nd ref='-263' />
     612    <nd ref='-259' />
     613    <tag k='description' v='good' />
     614    <tag k='josm_error_codes' v='none' />
     615    <tag k='natural' v='coastline' />
     616  </way>
     617  <way id='-453' action='modify' visible='true'>
     618    <nd ref='-255' />
     619    <nd ref='-261' />
     620    <nd ref='-265' />
     621    <nd ref='-267' />
     622    <nd ref='-273' />
     623    <tag k='description' v='goodpart2' />
     624    <tag k='josm_error_codes' v='none' />
     625    <tag k='natural' v='coastline' />
     626  </way>
     627  <way id='-455' action='modify' visible='true'>
     628    <nd ref='-273' />
     629    <nd ref='-247' />
     630    <nd ref='-251' />
     631    <nd ref='-255' />
     632    <tag k='description' v='goodpart1' />
     633    <tag k='josm_error_codes' v='none' />
     634    <tag k='natural' v='coastline' />
     635  </way>
     636  <way id='-457' action='modify' visible='true'>
     637    <nd ref='-245' />
     638    <nd ref='-249' />
     639    <nd ref='-253' />
     640    <nd ref='-257' />
     641    <nd ref='-245' />
     642    <tag k='barrier' v='fence' />
     643    <tag k='name' v='good' />
     644  </way>
     645  <way id='-459' action='modify' visible='true'>
     646    <nd ref='-287' />
     647    <nd ref='-289' />
     648    <nd ref='-291' />
     649    <tag k='josm_error_codes' v='901' />
     650    <tag k='name' v='inside-left-connected-to-reversed' />
     651    <tag k='natural' v='coastline' />
     652  </way>
     653  <way id='-461' action='modify' visible='true'>
     654    <nd ref='-293' />
     655    <nd ref='-283' />
     656    <nd ref='-285' />
     657    <nd ref='-281' />
     658    <nd ref='-287' />
     659    <tag k='josm_error_codes' v='901' />
     660    <tag k='name' v='inside-right--connected-to-reversed' />
     661    <tag k='natural' v='coastline' />
     662  </way>
     663  <way id='-463' action='modify' visible='true'>
     664    <nd ref='-293' />
     665    <nd ref='-291' />
     666    <tag k='josm_error_codes' v='902' />
     667    <tag k='name' v='inside-reversed-part' />
     668    <tag k='natural' v='coastline' />
     669  </way>
     670  <way id='-465' action='modify' visible='true'>
     671    <nd ref='-295' />
     672    <nd ref='-297' />
     673    <nd ref='-299' />
     674    <nd ref='-301' />
     675    <nd ref='-295' />
     676    <tag k='josm_error_codes' v='901' />
     677    <tag k='name' v='01outside--connected at start node' />
     678    <tag k='natural' v='coastline' />
     679  </way>
     680  <way id='-467' action='modify' visible='true'>
     681    <nd ref='-295' />
     682    <nd ref='-307' />
     683    <nd ref='-305' />
     684    <nd ref='-303' />
     685    <nd ref='-295' />
     686    <tag k='josm_error_codes' v='901' />
     687    <tag k='name' v='01outside--connected at start node' />
     688    <tag k='natural' v='coastline' />
     689  </way>
     690  <way id='-469' action='modify' visible='true'>
     691    <nd ref='-309' />
     692    <nd ref='-311' />
     693    <nd ref='-313' />
     694    <nd ref='-315' />
     695    <nd ref='-309' />
     696    <tag k='josm_error_codes' v='901' />
     697    <tag k='name' v='02outside.-connected at start node' />
     698    <tag k='natural' v='coastline' />
     699  </way>
     700  <way id='-471' action='modify' visible='true'>
     701    <nd ref='-317' />
     702    <nd ref='-309' />
     703    <nd ref='-319' />
     704    <nd ref='-321' />
     705    <nd ref='-317' />
     706    <tag k='josm_error_codes' v='901' />
     707    <tag k='name' v='02-outside-connected at 2nd node' />
     708    <tag k='natural' v='coastline' />
     709  </way>
     710  <way id='-473' action='modify' visible='true'>
     711    <nd ref='-323' />
     712    <nd ref='-325' />
     713    <nd ref='-327' />
     714    <nd ref='-329' />
     715    <nd ref='-323' />
     716    <tag k='josm_error_codes' v='901' />
     717    <tag k='name' v='03-outside-connected at 2nd node' />
     718    <tag k='natural' v='coastline' />
     719  </way>
     720  <way id='-475' action='modify' visible='true'>
     721    <nd ref='-331' />
     722    <nd ref='-325' />
     723    <nd ref='-333' />
     724    <nd ref='-335' />
     725    <nd ref='-331' />
     726    <tag k='josm_error_codes' v='901' />
     727    <tag k='name' v='03-outside-connected at 2nd node' />
     728    <tag k='natural' v='coastline' />
     729  </way>
     730  <way id='-477' action='modify' visible='true'>
     731    <nd ref='-339' />
     732    <nd ref='-373' />
     733    <nd ref='-341' />
     734    <nd ref='-343' />
     735    <nd ref='-339' />
     736    <tag k='josm_error_codes' v='901' />
     737    <tag k='name' v='03-inside-connected at 2nd node' />
     738    <tag k='natural' v='coastline' />
     739  </way>
     740  <way id='-479' action='modify' visible='true'>
     741    <nd ref='-345' />
     742    <nd ref='-347' />
     743    <nd ref='-349' />
     744    <nd ref='-351' />
     745    <nd ref='-345' />
     746    <tag k='josm_error_codes' v='901' />
     747    <tag k='name' v='01-inside-connected at start node' />
     748    <tag k='natural' v='coastline' />
     749  </way>
     750  <way id='-481' action='modify' visible='true'>
     751    <nd ref='-345' />
     752    <nd ref='-357' />
     753    <nd ref='-355' />
     754    <nd ref='-353' />
     755    <nd ref='-345' />
     756    <tag k='josm_error_codes' v='901' />
     757    <tag k='name' v='01-inside-connected at start node' />
     758    <tag k='natural' v='coastline' />
     759  </way>
     760  <way id='-483' action='modify' visible='true'>
     761    <nd ref='-359' />
     762    <nd ref='-361' />
     763    <nd ref='-363' />
     764    <nd ref='-365' />
     765    <nd ref='-359' />
     766    <tag k='josm_error_codes' v='901' />
     767    <tag k='name' v='02-inside-connected at start node' />
     768    <tag k='natural' v='coastline' />
     769  </way>
     770  <way id='-485' action='modify' visible='true'>
     771    <nd ref='-367' />
     772    <nd ref='-359' />
     773    <nd ref='-369' />
     774    <nd ref='-375' />
     775    <nd ref='-367' />
     776    <tag k='josm_error_codes' v='901' />
     777    <tag k='name' v='02-inside-connected at 2nd node' />
     778    <tag k='natural' v='coastline' />
     779  </way>
     780  <way id='-487' action='modify' visible='true'>
     781    <nd ref='-371' />
     782    <nd ref='-373' />
     783    <nd ref='-377' />
     784    <nd ref='-337' />
     785    <nd ref='-371' />
     786    <tag k='josm_error_codes' v='901' />
     787    <tag k='name' v='03-inside-connected at 2nd node' />
     788    <tag k='natural' v='coastline' />
     789  </way>
     790</osm>
  • src/org/openstreetmap/josm/data/validation/tests/Coastlines.java

     
    77import java.util.ArrayList;
    88import java.util.Collection;
    99import java.util.Collections;
     10import java.util.HashSet;
    1011import java.util.Iterator;
    1112import java.util.LinkedList;
    1213import java.util.List;
     14import java.util.Set;
    1315
    1416import org.openstreetmap.josm.Main;
    1517import org.openstreetmap.josm.command.ChangeCommand;
     
    2224import org.openstreetmap.josm.data.validation.TestError;
    2325import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2426import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     27import org.openstreetmap.josm.tools.Geometry;
    2528
    2629/**
    2730 * Check coastlines for errors
     
    2831 *
    2932 * @author frsantos
    3033 * @author Teemu Koskinen
     34 * @author Gerd Petermann
    3135 */
    3236public class Coastlines extends Test {
    3337
     
    3438    protected static final int UNORDERED_COASTLINE = 901;
    3539    protected static final int REVERSED_COASTLINE = 902;
    3640    protected static final int UNCONNECTED_COASTLINE = 903;
     41    protected static final int WRONG_ORDER_COASTLINE = 904;
    3742
    3843    private List<Way> coastlines;
    3944
     
    6267
    6368    @Override
    6469    public void endTest() {
    65         for (Way c1 : coastlines) {
    66             Node head = c1.firstNode();
    67             Node tail = c1.lastNode();
     70        checkConnections();
     71        CheckDirection();
     72        coastlines = null;
     73        downloadedArea = null;
    6874
    69             if (c1.getNodesCount() == 0 || head.equals(tail)) {
    70                 continue;
    71             }
     75        super.endTest();
     76    }
    7277
    73             int headWays = 0;
    74             int tailWays = 0;
    75             boolean headReversed = false;
    76             boolean tailReversed = false;
    77             boolean headUnordered = false;
    78             boolean tailUnordered = false;
    79             Way next = null;
    80             Way prev = null;
    81 
    82             for (Way c2 : coastlines) {
    83                 if (c1 == c2) {
    84                     continue;
    85                 }
    86 
    87                 if (c2.containsNode(head)) {
    88                     headWays++;
    89                     next = c2;
    90 
    91                     if (head.equals(c2.firstNode())) {
    92                         headReversed = true;
    93                     } else if (!head.equals(c2.lastNode())) {
    94                         headUnordered = true;
     78    /**
     79     * Check connections between coastline ways.
     80     * The nodes of a coastline way have to fullfil these rules:
     81     * 1) the first node must be connected to the last node of a coastline way (which might be the same way)
     82     * 2) the last node must be connected to the first node of a coastline way (which might be the same way)
     83     * 3) all other nodes must not be connected to a coastline way
     84     * 4) the number of referencing coastline ways must be 1 or 2
     85     * Nodes outside the download area are special cases, we may not know enough about the connected ways.
     86     *
     87     */
     88    private void checkConnections() {
     89        for (Way w : coastlines) {
     90            int numNodes = w.getNodesCount();
     91            for (int i = 0; i < numNodes; i++) {
     92                Node n = w.getNode(i);
     93                List<OsmPrimitive> refs = n.getReferrers();
     94                Set<Way> connectedWays = new HashSet<>();
     95                for (OsmPrimitive p : refs) {
     96                    if (p != w && isCoastline(p)) {
     97                        connectedWays.add((Way) p);
    9598                    }
    9699                }
    97 
    98                 if (c2.containsNode(tail)) {
    99                     tailWays++;
    100                     prev = c2;
    101 
    102                     if (tail.equals(c2.lastNode())) {
    103                         tailReversed = true;
    104                     } else if (!tail.equals(c2.firstNode())) {
    105                         tailUnordered = true;
     100                if (i == 0) {
     101                    if (connectedWays.isEmpty() && n != w.lastNode() && n.getCoor().isIn(downloadedArea)) {
     102                        addError(UNCONNECTED_COASTLINE, w, null, n);
    106103                    }
    107                 }
    108             }
    109 
    110             // To avoid false positives on upload (only modified primitives
    111             // are visited), we have to check possible connection to ways
    112             // that are not in the set of validated primitives.
    113             if (headWays == 0) {
    114                 Collection<OsmPrimitive> refs = head.getReferrers();
    115                 for (OsmPrimitive ref : refs) {
    116                     if (ref != c1 && isCoastline(ref)) {
    117                         // ref cannot be in <code>coastlines</code>, otherwise we would
    118                         // have picked it up already
    119                         headWays++;
    120                         next = (Way) ref;
    121 
    122                         if (head.equals(next.firstNode())) {
    123                             headReversed = true;
    124                         } else if (!head.equals(next.lastNode())) {
    125                             headUnordered = true;
    126                         }
     104                    if (connectedWays.size() == 1 && n != connectedWays.iterator().next().lastNode()) {
     105                        checkIfReversed(w, connectedWays.iterator().next(), n);
    127106                    }
     107                    if (connectedWays.size() == 1 && w.isClosed() &&  connectedWays.iterator().next().isClosed()) {
     108                        addError(UNORDERED_COASTLINE, w, connectedWays, n);
     109                    }
     110                } else if (i == numNodes - 1) {
     111                    if (connectedWays.isEmpty() && n != w.firstNode() && n.getCoor().isIn(downloadedArea)) {
     112                        addError(UNCONNECTED_COASTLINE, w, null, n);
     113                    }
     114                    if (connectedWays.size() == 1 && n != connectedWays.iterator().next().firstNode()) {
     115                        checkIfReversed(w, connectedWays.iterator().next(), n);
     116                    }
     117                } else if (!connectedWays.isEmpty()) {
     118                    addError(UNORDERED_COASTLINE, w, connectedWays, n);
    128119                }
    129120            }
    130             if (tailWays == 0) {
    131                 Collection<OsmPrimitive> refs = tail.getReferrers();
    132                 for (OsmPrimitive ref : refs) {
    133                     if (ref != c1 && isCoastline(ref)) {
    134                         tailWays++;
    135                         prev = (Way) ref;
     121        }
     122    }
    136123
    137                         if (tail.equals(prev.lastNode())) {
    138                             tailReversed = true;
    139                         } else if (!tail.equals(prev.firstNode())) {
    140                             tailUnordered = true;
     124    /**
     125     * Check if two or more coastline ways form a closed clockwise way
     126     */
     127    private void CheckDirection() {
     128        HashSet<Way> done = new HashSet<>();
     129        for (Way w : coastlines) {
     130            if (done.contains(w))
     131                continue;
     132            List<Way> visited = new ArrayList<>();
     133            done.add(w);
     134            visited.add(w);
     135            List<Node> nodes = new ArrayList<>(w.getNodes());
     136            Way curr = w;
     137            while (nodes.get(0) != nodes.get(nodes.size()-1)) {
     138                boolean foundContinuation = false;
     139                for (OsmPrimitive p : curr.lastNode().getReferrers()) {
     140                    if (p != curr && isCoastline(p)) {
     141                        Way other = (Way) p;
     142                        if (done.contains(other))
     143                            continue;
     144                        if (other.firstNode() == curr.lastNode()) {
     145                            foundContinuation = true;
     146                            curr = other;
     147                            done.add(curr);
     148                            visited.add(curr);
     149                            nodes.remove(nodes.size()-1); // remove duplicate connection node
     150                            nodes.addAll(curr.getNodes());
     151                            break;
    141152                        }
    142153                    }
    143154                }
     155                if (!foundContinuation)
     156                    break;
    144157            }
    145 
    146             List<OsmPrimitive> primitives = new ArrayList<>();
    147             primitives.add(c1);
    148 
    149             if (headWays == 0 || tailWays == 0) {
    150                 List<OsmPrimitive> highlight = new ArrayList<>();
    151 
    152                 if (headWays == 0 && head.getCoor().isIn(downloadedArea)) {
    153                     highlight.add(head);
     158            // simple closed ways are reported by WronglyOrderedWays
     159            if(visited.size() > 1 && nodes.get(0) == nodes.get(nodes.size()-1)) {
     160                if (Geometry.isClockwise(nodes)) {
     161                    errors.add(new TestError(this, Severity.WARNING, tr("Reversed coastline: land not on left side"), WRONG_ORDER_COASTLINE, visited));
    154162                }
    155                 if (tailWays == 0 && tail.getCoor().isIn(downloadedArea)) {
    156                     highlight.add(tail);
    157                 }
    158 
    159                 if (!highlight.isEmpty()) {
    160                     errors.add(new TestError(this, Severity.ERROR, tr("Unconnected coastline"),
    161                             UNCONNECTED_COASTLINE, primitives, highlight));
    162                 }
    163163            }
     164        }
     165    }
    164166
    165             boolean unordered = false;
    166             boolean reversed = headWays == 1 && headReversed && tailWays == 1 && tailReversed;
    167 
    168             if (headWays > 1 || tailWays > 1) {
    169                 unordered = true;
    170             } else if (headUnordered || tailUnordered) {
    171                 unordered = true;
    172             } else if (reversed && next == prev) {
    173                 unordered = true;
    174             } else if ((headReversed || tailReversed) && headReversed != tailReversed) {
    175                 unordered = true;
    176             }
    177 
    178             if (unordered) {
    179                 List<OsmPrimitive> highlight = new ArrayList<>();
    180 
    181                 if (headWays > 1 || headUnordered || headReversed || reversed) {
    182                     highlight.add(head);
     167    /**
     168     * Check if a reversed way would fit, if yes, add fixable "reversed" error, "unordered" else
     169     * @param w way that might be reversed
     170     * @param other other way that is connected to w
     171     * @param n1 node at which w and other are connected
     172     */
     173    private void checkIfReversed(Way w, Way other, Node n1) {
     174        boolean headFixedWithReverse = false;
     175        boolean tailFixedWithReverse = false;
     176        int otherCoastlineWays = 0;
     177        Way connectedToFirst = null;
     178        for (int i = 0; i < 2; i++) {
     179            Node n = (i == 0) ? w.firstNode() : w.lastNode();
     180            List<OsmPrimitive> refs = n.getReferrers();
     181            for (OsmPrimitive p : refs) {
     182                if (p != w && isCoastline(p)) {
     183                    Way cw = (Way) p;
     184                    if (i == 0 && cw.firstNode() == n) {
     185                        headFixedWithReverse = true;
     186                        connectedToFirst = cw;
     187                    }
     188                    else if (i == 1 && cw.lastNode() == n) {
     189                        if (cw != connectedToFirst)
     190                            tailFixedWithReverse = true;
     191                    }
     192                    else
     193                        otherCoastlineWays++;
    183194                }
    184                 if (tailWays > 1 || tailUnordered || tailReversed || reversed) {
    185                     highlight.add(tail);
    186                 }
    187 
    188                 errors.add(new TestError(this, Severity.ERROR, tr("Unordered coastline"),
    189                         UNORDERED_COASTLINE, primitives, highlight));
    190             } else if (reversed) {
    191                 errors.add(new TestError(this, Severity.ERROR, tr("Reversed coastline"),
    192                         REVERSED_COASTLINE, primitives));
    193195            }
    194196        }
     197        if (otherCoastlineWays == 0 && headFixedWithReverse && tailFixedWithReverse)
     198            addError(REVERSED_COASTLINE, w, null, null);
     199        else
     200            addError(UNORDERED_COASTLINE, w, Collections.singletonList(other), n1);
    195201
    196         coastlines = null;
    197         downloadedArea = null;
     202    }
    198203
    199         super.endTest();
     204    /**
     205     * Add error if not already done
     206     * @param errCode the error code
     207     * @param w the way that is in error
     208     * @param otherWays collection of other ways in error or null
     209     * @param n the node to be highlighted or null
     210     */
     211    private void addError(int errCode, Way w, Collection<Way> otherWays, Node n) {
     212        String msg = null;
     213        switch (errCode) {
     214        case UNCONNECTED_COASTLINE:
     215            msg = tr("Unconnected coastline");
     216            break;
     217        case UNORDERED_COASTLINE:
     218            msg = tr("Unordered coastline");
     219            break;
     220        case REVERSED_COASTLINE:
     221            msg = tr("Reversed coastline");
     222            break;
     223        default:
     224            msg = tr("invalid coastline"); // should not happen
     225        }
     226        Set<OsmPrimitive> primitives = new HashSet<>();
     227        primitives.add(w);
     228        if (otherWays != null)
     229            primitives.addAll(otherWays);
     230        // check for repeated error
     231        for (TestError e : errors) {
     232            if (e.getCode() != errCode)
     233                continue;
     234            if (errCode != REVERSED_COASTLINE && e.getHighlighted().contains(n) == false)
     235                continue;
     236            if (e.getPrimitives().size() != primitives.size())
     237                continue;
     238            if (e.getPrimitives().containsAll(primitives) == false)
     239                continue;
     240            return; // we already know this error
     241        }
     242        if (errCode != REVERSED_COASTLINE)
     243            errors.add(new TestError(this, Severity.ERROR, msg, errCode, primitives, Collections.singletonList(n)));
     244        else
     245            errors.add(new TestError(this, Severity.ERROR, msg, errCode, primitives));
    200246    }
    201247
    202248    @Override
  • test/unit/org/openstreetmap/josm/data/validation/tests/CoastlinesTest.java

     
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.data.validation.tests;
     3
     4import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertTrue;
     6import static org.junit.Assert.fail;
     7
     8import java.io.FileInputStream;
     9import java.io.InputStream;
     10import java.util.ArrayList;
     11import java.util.Arrays;
     12import java.util.List;
     13import java.util.Set;
     14import java.util.TreeSet;
     15
     16import org.junit.BeforeClass;
     17import org.junit.Rule;
     18import org.junit.Test;
     19import org.openstreetmap.josm.JOSMFixture;
     20import org.openstreetmap.josm.Main;
     21import org.openstreetmap.josm.data.osm.DataSet;
     22import org.openstreetmap.josm.data.osm.Way;
     23import org.openstreetmap.josm.data.validation.TestError;
     24import org.openstreetmap.josm.gui.DefaultNameFormatter;
     25import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     26import org.openstreetmap.josm.io.OsmReader;
     27import org.openstreetmap.josm.testutils.JOSMTestRules;
     28
     29import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     30
     31/**
     32 * JUnit Test of coastline validation test.
     33 */
     34public class CoastlinesTest {
     35
     36    private static final Coastlines COASTLINES = new Coastlines();
     37    private static final WronglyOrderedWays WRONGLY_ORDERED_WAYS = new WronglyOrderedWays();
     38
     39    /**
     40     * Setup test.
     41     */
     42    @Rule
     43    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     44    public JOSMTestRules test = new JOSMTestRules().commands();
     45
     46    @BeforeClass
     47    public static void setUpBeforeClass() {
     48        JOSMFixture.createUnitTestFixture().init(true);
     49    }
     50
     51    /**
     52     * Test all error cases manually created in coastline.osm.
     53     * @throws Exception in case of error
     54     */
     55    @Test
     56    public void testCoastlineFile() throws Exception {
     57
     58        try (InputStream is = new FileInputStream("data_nodist/coastlines.osm")) {
     59            DataSet ds = OsmReader.parseDataSet(is, null);
     60            OsmDataLayer layer = new OsmDataLayer(ds, "", null);
     61            try {
     62                Main.getLayerManager().addLayer(layer);
     63
     64                for (Way w: ds.getWays()) {
     65                    String name = DefaultNameFormatter.getInstance().format(w);
     66                    if ("coastline".equals(w.get("natural")) == false)
     67                        continue;
     68                    String codes = w.get("josm_error_codes");
     69                    if (codes != null) {
     70                        List<TestError> errors = new ArrayList<>();
     71                        for (org.openstreetmap.josm.data.validation.Test test : Arrays.asList(COASTLINES, WRONGLY_ORDERED_WAYS)) {
     72                            test.initialize();
     73                            test.startTest(null);
     74                            test.visit(w);
     75                            test.endTest();
     76                            errors.addAll(test.getErrors());
     77                        }
     78                        Set<Integer> expectedCodes = new TreeSet<>();
     79                        if ("none".equals(codes) == false) {
     80                            for (String code : codes.split(",")) {
     81                                expectedCodes.add(Integer.parseInt(code));
     82                            }
     83                        }
     84                        Set<Integer> actualCodes = new TreeSet<>();
     85                        for (TestError error : errors) {
     86                            Integer code = error.getCode();
     87                            assertTrue(name + " does not expect JOSM error code " + code + ": " + error.getDescription(),
     88                                    expectedCodes.contains(code));
     89                            actualCodes.add(code);
     90                        }
     91                        assertEquals(name + " " + expectedCodes + " => " + actualCodes,
     92                                expectedCodes.size(), actualCodes.size());
     93                    } else if (w.hasKey("name")) {
     94                        fail(name + " lacks josm_error_codes tag");
     95                    }
     96                }
     97            } finally {
     98                Main.getLayerManager().removeLayer(layer);
     99            }
     100        }
     101    }
     102}