Re: [OpenMap Users] BoundaryCrossing iterator order

From: Paul Chisholm <pch42_at_tpg.com.au>
Date: Mon, 14 Sep 2009 21:53:43 +1000

Don,

I rendered the regions and path and they display as expected. The
crossing points are also as expected, just not in the expected order.
All my data is expressed as lat/long decimal degrees. I will try to
find some time and trace the execution to see if I can work out what
is happening.

Paul

On 12/09/2009, at 1:54 AM, Don Dietrick wrote:

> Hi Paul,
>
> The boundary crossing should be coming out of the iterator in
> order. That's what I've always seen when using testing with the
> com.bbn.openmap.layer.test.GeoIntersectionLayer.
>
> Have you rendered the regions and intersection points to see if the
> results make sense? You're not working in cartesian space, and you
> might see something you didn't expect when the route and regions are
> rendered.
>
> - Don
>
> On Sep 11, 2009, at 6:28 AM, Paul Chisholm wrote:
>
>> Hi,
>>
>> I am using the BoundaryCrossing feature of OpenMap to determine the
>> polygons that a path crosses. According to the API the
>> BoundaryCrossing.Collector.compact method is "An important method
>> that cleans up the segment/region BoundaryCrossing order, and also
>> resolves the BoundaryCrossing.in/out settings for regions. Must be
>> called before the crossing iterator is retrieved, but the
>> BoundaryCrossing method does that." The
>> BoundaryCrossing.Collector.getCrossings method calls "compact"
>> before generating the iterator. However, I seem to get strange
>> results. When I run the following program
>>
>> import com.bbn.openmap.geo.*;
>> import java.util.*;
>>
>> public class Test {
>> public static void main(String[] args) {
>> List<GeoRegion> regions = new ArrayList();
>> GeoRegion.Impl x = new GeoRegion.Impl(new float[]{10, 10,
>> -10, 10, -10, 20, 10, 20, 10, 10});
>> x.setID("A");
>> regions.add(x);
>> GeoRegion.Impl y = new GeoRegion.Impl(new float[]{10, 30,
>> -10, 30, -10, 40, 10, 40, 10, 30});
>> y.setID("B");
>> regions.add(y);
>> float[] route = {0, 0, 0, 25, 0, 50}; /
>> *****************************/
>> GeoPath.Impl path = new GeoPath.Impl(route);
>> BoundaryCrossing.Collector bcc =
>> BoundaryCrossing.getCrossings(path, regions);
>> Iterator it = bcc.getCrossings();
>> while (it.hasNext()) {
>> BoundaryCrossing o = (BoundaryCrossing) it.next();
>> GeoRegion in = o.getIn();
>> GeoRegion ou = o.getOut();
>> System.out.println(o.getGeo());
>> if (in != null) {
>> System.out.println(" Enter " + in.getID());
>> }
>> if (ou != null) {
>> System.out.println(" Exit " + ou.getID());
>> }
>> }
>> }
>> }
>>
>> I get the output
>>
>> Geo[-0.0,29.999999612082494]
>> Enter B
>> Geo[-0.0,9.999999573437877]
>> Enter A
>> Geo[-0.0,19.999999678147237]
>> Exit A
>> Geo[-0.0,40.00000052659251]
>> Exit B
>>
>> The points I understand, but I expected them to appear in order
>> Enter A, Exit A, Enter B, Exit B
>>
>> When I replace the line labelled
>>
>> /*****************/
>>
>> with
>>
>> float[] route = {0, 50, 0, 25, 0, 0};
>>
>> i.e. reverse the direction of the path, the output is
>>
>> Geo[0.0,19.999999678147237]
>> Enter A
>> Geo[0.0,9.999999573437877]
>> Exit A
>> Geo[0.0,40.00000052659251]
>> Enter B
>> Geo[0.0,29.999999612082494]
>> Exit B
>>
>> Is my understanding of the order in which the iterator returns
>> crossing points incorrect? If so, is there any way to order the
>> crossings in the sequence they are visited along the direction of
>> the path.
>>
>> Thanks,
>> Paul
>>
>> --
>> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
>> with the following text in the BODY of the message "unsubscribe
>> openmap-users"]
>
>

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Sep 14 2009 - 07:54:58 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:09 EDT