To create a point bean
public class Point {private double lat;private double lon;public Double Getlat () {return lat;} public void Setlat (double lat) {This.lat = lat;} Public double Getlon () {return lon;} public void Setlon (double lon) {This.lon = lon;}}
Determine if the point is in the graph
public static Boolean Contains (list<point> Points,point point) {Boolean result = false;for (int i =0; i<points.siz E () -1;i++) {if ((((Points.get (i+1). Getlon () <=point.getlon ()) && (Point.getlon () <points.get (i). Getlon ()))|| ((Points.get (i). Getlon () <=point.getlon ()) && (Point.getlon () <points.get (i+1). Getlon ()))) && (Point.getlat () < (Points.get (i). Getlat ()-points.get (i+1). Getlat ()) * (Point.getlon ()-points.get (i+1) . Getlon ())/(Points.get (i). Getlon ()-points.get (i+1). Getlon ()) +points.get (i+1). Getlat ()) {result =! result;}} return result;}
This article is from the "write down on the right" blog, please be sure to keep this source http://jueshizhanhun.blog.51cto.com/4372226/1769584
Coordinate drawing, emission line to determine whether the point in the graph