PolygonIntersects Method (LatLon) |
Namespace: Telogis.GeoBase.Geometry
// Create a four sided polygon in Los Angeles, Ca. Telogis.GeoBase.Geometry.Polygon myPolygon = new Telogis.GeoBase.Geometry.Polygon( new Telogis.GeoBase.Geometry.LineString[] { new Telogis.GeoBase.Geometry.LineString( new LatLon(33.694165,-117.956236), new LatLon(33.697935,-117.842219), new LatLon(33.616715,-117.834638), new LatLon(33.625434,-117.937813), new LatLon(33.694165,-117.956236)) } ); // Create a Line that crosses over the polygon Telogis.GeoBase.Geometry.LineString newLine = new Telogis.GeoBase.Geometry.LineString( new Telogis.GeoBase.LatLon[] { new Telogis.GeoBase.LatLon(33.671409,-117.969853), new Telogis.GeoBase.LatLon(33.585837,-117.781247)} ); // Use the Intersects method to test whether the polygon contains, intersects or touches the line Console.WriteLine("Do the polygon and line intersect? {0}", myPolygon.Intersects(newLine.Points)); // 'Do the polygon and line intersect? True'