コード例 #1
0
 /// <summary>
 /// Find the nearest four points to a coordinate.
 /// </summary>
 /// <param name="latitude">The reference latitude.</param>
 /// <param name="longitude">The reference longitude.</param>
 /// <param name="searchType">The type of search to perform. Bitwise "or-able".</param>
 /// <returns>An array of the nearest four coordinates sorted by distance.</returns>
 public GridNearestCoordinate[] FindNearestCoordinates(double latitude, double longitude, GribNearestToSame searchType = GribNearestToSame.POINT)
 {
     return(this.Nearest.FindNearestCoordinates(latitude, longitude, searchType));
 }
コード例 #2
0
 /// <summary>
 /// Find the nearest four points to a coordinate.
 /// </summary>
 /// <param name="coord">The reference coordinate.</param>
 /// <param name="searchType">The type of search to perform. Bitwise "or-able".</param>
 /// <returns>An array of the nearest four coordinates sorted by distance.</returns>
 public GridNearestCoordinate[] FindNearestCoordinates(IGridCoordinate coord, GribNearestToSame searchType = GribNearestToSame.POINT)
 {
     return(this.FindNearestCoordinates(coord.Latitude, coord.Longitude, searchType));
 }
コード例 #3
0
        /// <summary>
        /// Find the nearest four points to a coordinate.
        /// </summary>
        /// <param name="latitude">The reference latitude.</param>
        /// <param name="longitude">The reference longitude.</param>
        /// <param name="searchType"> If you are sure that the point you are asking for is not changing from
        /// a call to another you can use POINT. The same is valid for the grid. Flags can be used together
        /// doing a bitwise OR. The distances are given in kilometres.</param>
        /// <returns>An array of the nearest four coordinates sorted by distance.</returns>
        public GridNearestCoordinate[] FindNearestCoordinates(double latitude, double longitude, GribNearestToSame searchType = GribNearestToSame.POINT)
        {
            var latitudes  = new double[] { 0, 0, 0, 0 };
            var longitudes = new double[] { 0, 0, 0, 0 };
            var distances  = new double[] { 0, 0, 0, 0 };
            var values     = new double[] { 0, 0, 0, 0 };
            var indexes    = new int[] { 0, 0, 0, 0 };

            Interop.SizeT len = 4;
            Interop.SWIG.GribApiProxy.GribNearestFind(this.Nearest, this.Handle, latitude, longitude, (uint)searchType,
                                                      latitudes, longitudes, values, distances,
                                                      indexes, ref len);

            var vals = new GridNearestCoordinate[len];

            for (var i = 0; i < len; i++)
            {
                vals[i] = new GridNearestCoordinate(latitudes[i], longitudes[i], values[i], distances[i], indexes[i]);
            }

            Array.Sort(vals, (v1, v2) => v1.Distance.CompareTo(v2.Distance));

            return(vals);
        }