/** * A test program for the GeographicLib.PolygonArea class **********************************************************************/importjava.util.*;importnet.sf.geographiclib.*;/** * Compute the area of a geodesic polygon. * * This program reads lines with lat, lon for each vertex of a polygon. At the * end of input, the program prints the number of vertices, the perimeter of * the polygon and its area (for the WGS84 ellipsoid). **********************************************************************/publicclassPlanimeter{publicstaticvoidmain(String[]args){PolygonAreap=newPolygonArea(Geodesic.WGS84,false);try{Scannerin=newScanner(System.in);while(true){doublelat=in.nextDouble(),lon=in.nextDouble();p.AddPoint(lat,lon);}}catch(Exceptione){}PolygonResultr=p.Compute();System.out.println(r.num+" "+r.perimeter+" "+r.area);}}