Re: [Jts-topo-suite-user] question about GeometryNoder
Brought to you by:
dr_jts
|
From: Martin D. <mtn...@te...> - 2012-05-09 05:18:57
|
This is indeed a bug in GeometryNoder (or more accurately
MCIndexSnapRounder). Now fixed in SVN (with better test case logic added).
On 5/8/2012 3:21 AM, Tomas F wrote:
> Hi,
> It looks like GeometryNoder doesn't snap a line to a close endpoint of
> another line. I this correct behaviour?
> I thought that an endpoint of a line is a hot pixel so that all lines
> that crosses the grid-square of that hot pixel
> should snap. The following program illustrates my point:
>
> double scale = 1.0;
> WKTReader reader = new WKTReader();
>
> LineString lineStringA =
> (LineString) reader.read("LINESTRING (0.0 0.0, 2.0 0.0)");
> LineString lineStringB =
> (LineString) reader.read("LINESTRING (0.0 0.0, 10.0 -1.0)");
>
> List<LineString> lineStrings = new ArrayList<LineString>();
> lineStrings.add(lineStringA);
> lineStrings.add(lineStringB);
>
> PrecisionModel precisionModel = new PrecisionModel(scale);
> GeometryFactory geometryFactory = new GeometryFactory(precisionModel);
> GeometryNoder noder =
> new GeometryNoder(geometryFactory.getPrecisionModel());
>
> List list = noder.node(lineStrings);
>
> double distanceToHotPixel =
> lineStringB.distance(lineStringA.getEndPoint());
> System.out.println("Distance between assumed hotpixel and "
> + " lineStringB: " + distanceToHotPixel);
>
> for (Object obj : list)
> {
> LineString lineString = (LineString) obj;
> assert !lineString.equalsExact(lineStringB) :
> "Isn't (2.0, 0.0) a hot pixel and isn't lineStringB "
> + "close enough to be snapped?";
> }
>
> Thanks in advance,
> Tomas
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
> _______________________________________________
> Jts-topo-suite-user mailing list
> Jts...@li...
> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2012.0.1913 / Virus Database: 2425/4983 - Release Date: 05/07/12
>
|