private GeoNearOptionsBuilder CreateGeoNearOptions(double maxDistance)
        {
            var options = new GeoNearOptionsBuilder();

            // set the multiplier as miles
            options.SetDistanceMultiplier(MI_MULTIPLIER);

            // set the max distance
            options.SetMaxDistance(maxDistance / MI_MULTIPLIER);

            return(options);
        }
Example #2
0
        private void cmdGeoNear_Click(object sender, EventArgs e)
        {
            GeoNearOptionsBuilder GeoOption = new GeoNearOptionsBuilder();

            GeoOption.SetDistanceMultiplier(double.Parse(NumDistanceMultiplier.Text));
            GeoOption.SetMaxDistance(double.Parse(NumMaxDistance.Text));
            GeoOption.SetSpherical(chkSpherical.Checked);
            try
            {
                BsonDocument mGeoNearAs = SystemManager.GetCurrentCollection().GeoNearAs <BsonDocument>
                                              (null, double.Parse(NumGeoX.Text), double.Parse(NumGeoY.Text), (int)NumResultCount.Value, GeoOption).Response;
                MongoDBHelper.FillDataToTreeView("Result", this.trvGeoResult, mGeoNearAs);
                this.trvGeoResult.DatatreeView.Nodes[0].Expand();
            }
            catch (Exception ex)
            {
                SystemManager.ExceptionDeal(ex);
            }
        }