RE: [OpenMap Users] Lat/Lon Visibility ?

From: Chapman, Martin <MChapman@sanz.com>
Date: Tue Mar 02 2004 - 15:02:40 EST

Brian,

You could do your own point in polygon function if you have the extents
of your map. The following c++ function returns 1 if the point exists
within your polygon.

Params:
int npol = number of points in your polygon.
double *xp = array of x points;
double *xp = array of y points;
double x = the x value of the point your testing.
double y = the y value of the point your testing.

Returns:
1 if intersects.
0 if not.

int CIntersectDlgDlg::pointnpolygon(int npol, double *xp, double *yp,
double x, double y)
{
    int i, j, c = 0;

    for ( i = 0, j = npol - 1; i < npol; j = i++ )
    {
        if ((((yp[i] <= y) && (y < yp[j])) || ((yp[j] <= y) && (y <
yp[i]))) &&
            (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) +
xp[i]))
                {
                      c = !c;
                }
    }
    
    return c;
}

Martin

-----Original Message-----
From: Sperlongano Brian M NPRI [mailto:SperlonganoBM@Npt.NUWC.Navy.Mil]
Sent: Tuesday, March 02, 2004 12:33 PM
To: openmap-users@bbn.com
Subject: [OpenMap Users] Lat/Lon Visibility ?

This is probably a really simple question, but is there a way to
determine if a particular Lat/Lon is visible on a MapBean or Projection?

Thanks,
 Brian

--
[To unsubscribe to this list send an email to "majdart@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@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Mar 2 15:03:28 2004

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT