<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi WanMil,<br><br>I agree that also Coord.equals() is a method which has to be handled with <br>great care. The meaning of "p1.equals(p2) == true" <br>is that both points have coordinates that were rounded<br>to equal map unit values. The original OSM points can have a<br>distance of > 2m, on the other hand, two points with a <br>distance < 0.2m can have different map unit coordinates.<br><br>I know one case where the Coord.equals() has a meaning:<br>When creating the road network, we must make sure that <br>a RouteArc connects two points that have different coordinates.<br>(high prec branch r2861 still contains an error here)<br><br>I think equals() should be <b>avoided </b>in all algos that try to calculate <br>something. problem is that we use Coord.equals() whenever we use collections<br>like Map<Coord,xyz> or even List<Coord> in combinations with List.contains().<br>Most of these usages are candidates for errors when input data allows that<br>p1.equals(p2) == true and p1 != p2.<br><br>The higher precision values in the high prec branch are no solution for that, they <br>just make it less likely to happen.<br><br>Maybe a good way to find potential errors in the code is to create test data <br>that contains these special cases ?<br><br>Gerd<br><br><br><br><div>> Date: Thu, 5 Dec 2013 21:59:42 +0100<br>> From: wmgcnfg@web.de<br>> To: mkgmap-dev@lists.mkgmap.org.uk<br>> Subject: Re: [mkgmap-dev] Way.isClosed()<br>> <br>> Hi Gerd,<br>> <br>> I've gone through all calls of isClosed(). I am quite sure all in all <br>> calls it should be checked for identity.<br>> <br>> But there are some other changes that need to be done (not complete!!):<br>> SeaGenerator<br>> beginMap (line 770) need to be IdentityHashMap<br>> <br>> BoundaryRelation<br>> line 387 should be an IdentityHashMap?<br>> line 474+477: Coord.equals(..) maybe check for identity?<br>> <br>> MultipolgyonRelation<br>> line 468 should be an IdentityHashMap?<br>> line 553+556: Coord.equals(..) maybe check for identity?<br>> <br>> I guess there are a lot of other places where Coord.equals is used <br>> instead of identity.<br>> <br>> WanMil<br>> <br>> <br>> <br>> > Hi WanMil,<br>> ><br>> > > Before fixing that all calls to this method need to be checked if they<br>> > > rely on the current behaviour.<br>> ><br>> > I agree. The problem is that the method is used in rather complex<br>> > algos, so it's difficult for me to answer this question, esp.<br>> > when we also have to consider the changes in the high prec branch.<br>> ><br>> > Gerd<br>> ><br>> ><br>> > _______________________________________________<br>> > mkgmap-dev mailing list<br>> > mkgmap-dev@lists.mkgmap.org.uk<br>> > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev<br>> ><br>> <br>> _______________________________________________<br>> mkgmap-dev mailing list<br>> mkgmap-dev@lists.mkgmap.org.uk<br>> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev<br></div>                                            </div></body>
</html>