private void cmdGeoNear_Click(object sender, EventArgs e) { BsonDocument mGeoNearAs = null; bool IsHaystack = chkHaystack.Checked; try { if (IsHaystack) { var geoSearchOption = new GeoHaystackSearchArgs() { MaxDistance = double.Parse(NumMaxDistance.Text), Limit = (int)NumResultCount.Value, Near = point }; // GeoHaystackSearch mGeoNearAs = RuntimeMongoDbContext.GetCurrentCollection().GeoHaystackSearchAs <BsonDocument>(geoSearchOption).Response; } else { var geoOption = new GeoNearArgs() { DistanceMultiplier = double.Parse(NumDistanceMultiplier.Text), MaxDistance = double.Parse(NumMaxDistance.Text), Spherical = chkSpherical.Checked, Limit = (int)NumResultCount.Value }; if (radGeoJSON.Checked) { geoOption.Near = new GeoJsonPoint <GeoJson2DCoordinates>(new GeoJson2DCoordinates(point.X, point.Y)); } else { geoOption.Near = point; } //GeoNearAs mGeoNearAs = RuntimeMongoDbContext.GetCurrentCollection().GeoNearAs <BsonDocument>(geoOption).Response; } } catch (Exception ex) { Utility.ExceptionDeal(ex); return; } UiHelper.FillDataToTreeView("Result", trvGeoResult, mGeoNearAs); trvGeoResult.DatatreeView.Nodes[0].Expand(); }
private void cmdGeoNear_Click(object sender, EventArgs e) { var GeoOption = new GeoNearArgs(); GeoOption.DistanceMultiplier = (double.Parse(NumDistanceMultiplier.Text)); GeoOption.MaxDistance = (double.Parse(NumMaxDistance.Text)); GeoOption.Spherical = (chkSpherical.Checked); GeoOption.Limit = (int)(NumResultCount.Value); GeoOption.Near = new XYPoint(double.Parse(NumGeoX.Text), double.Parse(NumGeoY.Text)); try { BsonDocument mGeoNearAs = SystemManager.GetCurrentCollection().GeoNearAs <BsonDocument>(GeoOption).Response; MongoDbHelper.FillDataToTreeView("Result", trvGeoResult, mGeoNearAs); trvGeoResult.DatatreeView.Nodes[0].Expand(); } catch (Exception ex) { SystemManager.ExceptionDeal(ex); } }
private void cmdGeoNear_Click(object sender, EventArgs e) { var geoOption = new GeoNearArgs(); geoOption.DistanceMultiplier = double.Parse(NumDistanceMultiplier.Text); geoOption.MaxDistance = double.Parse(NumMaxDistance.Text); geoOption.Spherical = chkSpherical.Checked; geoOption.Limit = (int)NumResultCount.Value; geoOption.Near = new XYPoint(double.Parse(NumGeoX.Text), double.Parse(NumGeoY.Text)); try { var mGeoNearAs = RuntimeMongoDbContext.GetCurrentCollection().GeoNearAs <BsonDocument>(geoOption).Response; UiHelper.FillDataToTreeView("Result", trvGeoResult, mGeoNearAs); trvGeoResult.DatatreeView.Nodes[0].Expand(); } catch (Exception ex) { Utility.ExceptionDeal(ex); } }