private void GeometryService_AreasAndLengthsCompleted(object sender, AreasAndLengthsEventArgs args) { // convert results from meters into miles and sq meters into sq miles for our display double miles = args.Results.Lengths[0] * 0.0006213700922; double sqmi = Math.Abs(args.Results.Areas[0]) * 0.0000003861003; ResponseTextBlock.Text = String.Format("Polygon area: {0} sq. miles\nPolygon perimeter: {1} miles.", Math.Round(sqmi, 3), Math.Round(miles, 3)); }
private void GeometryService_AreasAndLengthsCompleted(object sender, AreasAndLengthsEventArgs args) { //TODO: Geometry service not returning correct values, area unit seems invalid, may need to use data in //planar coordinate space // convert results from meters into miles and sq meters into sq miles for our display double miles = args.Results.Lengths[0] * 0.0006213700922; double sqmi = Math.Abs(args.Results.Areas[0]) * 0.0000003861003; ResponseTextBlock.Text = String.Format("Polygon area: {0} sq. miles\nPolygon perimeter: {1} miles.", Math.Round(sqmi, 3), Math.Round(miles, 3)); }
void geometryTask_AreasAndLengthsCompleted(object sender, AreasAndLengthsEventArgs e) { //throw new NotImplementedException(); if (e.Results.Lengths.Count <= 0 || e.Results.Areas.Count <= 0) { return; } string strArea = e.Results.Areas[0].ToString("0.0000" + "平方千米"); Graphic gAreaDraw = e.UserState as Graphic; ShowTextSymbolByGraphic(gAreaDraw, strArea); }
// Measure Polygon private void GeometryService_AreasAndLengthsCompleted(object sender, AreasAndLengthsEventArgs args) { for (int i = 0; i < args.Results.Areas.Count; i++) { txtBlkMeasurement.Text = string.Format("Area = {1} sq. feet, \nPerimeter = {2} feet", i, Math.Abs(args.Results.Areas[i]).ToString("#0.00"), Math.Abs(args.Results.Lengths[i]).ToString("#0.00")); } }