示例#1
0
        /// <summary>
        /// A simple interface for computing the area of a geodesic polygon.
        /// </summary>
        /// <param name="g">The geod_geodesic object specifying the ellipsoid.</param>
        /// <param name="lats">An array of latitudes of the polygon vertices (degrees).</param>
        /// <param name="lons">An array of longitudes of the polygon vertices (degrees).</param>
        /// <param name="n">The number of vertices.</param>
        /// <param name="pA">The area of the polygon (square meters).</param>
        /// <param name="pP">The perimeter of the polygon (meters).</param>
        /// <remarks>
        /// lats should be in the range [-90deg, 90deg]; lons should be in the range [-540deg, 540deg).
        ///
        /// Only simple polygons (which are not self-intersecting) are allowed.
        /// There's no need to "close" the polygon by repeating the first vertex. The
        /// area returned is signed with counter-clockwise traversal being treated as
        /// positive.
        /// </remarks>
        public static void geod_polygonarea(geod_geodesic g, double[] lats, double[] lons, int n, out double pA, out double pP)
        {
            geod_polygon p = new geod_polygon(false);

            for (int i = 0; i < n; ++i)
            {
                p.geod_polygon_addpoint(g, lats[i], lons[i]);
            }
            p.geod_polygon_compute(g, false, true, out pA, out pP);
        }
示例#2
0
 /// <summary>
 /// A simple interface for computing the area of a geodesic polygon.
 /// </summary>
 /// <param name="g">The geod_geodesic object specifying the ellipsoid.</param>
 /// <param name="lats">An array of latitudes of the polygon vertices (degrees).</param>
 /// <param name="lons">An array of longitudes of the polygon vertices (degrees).</param>
 /// <param name="n">The number of vertices.</param>
 /// <param name="pA">The area of the polygon (square meters).</param>
 /// <param name="pP">The perimeter of the polygon (meters).</param>
 /// <remarks>
 /// lats should be in the range [-90deg, 90deg]; lons should be in the range [-540deg, 540deg).
 ///
 /// Only simple polygons (which are not self-intersecting) are allowed.
 /// There's no need to "close" the polygon by repeating the first vertex. The
 /// area returned is signed with counter-clockwise traversal being treated as
 /// positive.
 /// </remarks>
 public static void geod_polygonarea(geod_geodesic g, double[] lats, double[] lons, int n, out double pA, out double pP)
 {
     geod_polygon p=new geod_polygon(false);
     for(int i=0; i<n; ++i) p.geod_polygon_addpoint(g, lats[i], lons[i]);
     p.geod_polygon_compute(g, false, true, out pA, out pP);
 }