
Hi WanMil,
Date: Mon, 16 Jan 2012 22:40:58 +0100 From: wmgcnfg@web.de To: mkgmap-dev@lists.mkgmap.org.uk Subject: Re: [mkgmap-dev] [Patch v3] LocationHook with new Quadtree
The remaining differences should be errors caused by the
"insideness"
problem of contains().
Problems with the bounding box of the quadtree should be solved by adding +1 to maxlat/maxlong of the java area object.
Hmm, does that mean you want to shift the whole area or only selected points? Which ones? I thought about using the Area.transform() method to blow up the area a little bit, but did not yet find something useful. I think searching the shifted point is easy to implement and this double (or multiple) search will not happen very often.
I think it's much easier: In the constructor of BoundaryQuadTree.Node use the following line: this.bbox = new Rectangle(bbox.getMinLong(), bbox.getMinLat(), bbox.getMaxLong() - bbox.getMinLong() + 1, bbox.getMaxLat() - bbox.getMinLat() + 1);
So just increase the width and height of the (java.awt.geom.Area) bounding box by 1. That should do it(?). I don't think so. The area keeps it's own internal bbox in field cachedBounds, and that is tested first when contains() is called .
I am only talking about the java.awt.geom.Area bbox in the Node class. I am not talking about the area objects of each boundary because you were initially talking about the bounding box of the quadtree (which is a rectangle).
In fact, the problem occures also with the java.awt.geom.Area.contains(co.getLongitude(), co.getLatitude()) Gerd
WanMil _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev