コード例 #1
0
		/// <summary>
		/// Create a distance query using
		/// a boundary box wrapper around a more precise
		/// DistanceFilter.
		/// </summary>
		/// <param name="lat">The lat.</param>
		/// <param name="lng">The Lng.</param>
		/// <param name="miles">The miles.</param>
		/// <param name="latField">The lat field.</param>
		/// <param name="lngField">The Lng field.</param>
		/// <param name="tierFieldPrefix">The tier field prefix.</param>
		/// <param name="needPrecise">if set to <c>true</c> [need precise].</param>
		public DistanceQueryBuilder(double lat, double lng, double miles, string latField, string lngField, string tierFieldPrefix, bool needPrecise)
		{
			Lat = lat;
			Lng = lng;
			Miles = miles;

			var cpf = new CartesianPolyFilterBuilder(tierFieldPrefix);
			Filter cartesianFilter = cpf.GetBoundingArea(lat, lng, miles);

			/* create precise distance filter */
			if (needPrecise)
			{
				_filter = DistanceFilter = new LatLongDistanceFilter(cartesianFilter, miles, lat, lng, latField, lngField);
			}
			else
			{
				_filter = cartesianFilter;
				DistanceFilter = null;
			}
		}
コード例 #2
0
        /// <summary>
        /// Create a distance query using
        /// a boundary box wrapper around a more precise
        /// DistanceFilter.
        /// </summary>
        /// <param name="lat">The lat.</param>
        /// <param name="lng">The Lng.</param>
        /// <param name="miles">The miles.</param>
        /// <param name="geoHashFieldPrefix">The geo hash field prefix.</param>
        /// <param name="tierFieldPrefix">The tier field prefix.</param>
        /// <param name="needPrecise">if set to <c>true</c> [need precise].</param>
        public DistanceQueryBuilder(double lat, double lng, double miles, string geoHashFieldPrefix, String tierFieldPrefix, bool needPrecise)
        {
            Lat   = lat;
            Lng   = lng;
            Miles = miles;

            var    cpf             = new CartesianPolyFilterBuilder(tierFieldPrefix);
            Filter cartesianFilter = cpf.GetBoundingArea(lat, lng, miles);

            /* create precise distance filter */
            if (needPrecise)
            {
                _filter = DistanceFilter = new GeoHashDistanceFilter(cartesianFilter, lat, lng, miles, geoHashFieldPrefix);
            }
            else
            {
                _filter        = cartesianFilter;
                DistanceFilter = null;
            }
        }