private void MyDrawSurface_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            ResultsDisplay.Visibility = Visibility.Collapsed;
            MyDrawObject.IsEnabled    = false;
            selectionGraphicslayer.Graphics.Clear();

            QueryTask queryTask = new QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5");

            queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
            queryTask.Failed           += QueryTask_Failed;

            // Bind data grid to query results
            Binding resultFeaturesBinding = new Binding("LastResult.Features");

            resultFeaturesBinding.Source = queryTask;
            QueryDetailsDataGrid.SetBinding(DataGrid.ItemsSourceProperty, resultFeaturesBinding);
            Query query = new ESRI.ArcGIS.Client.Tasks.Query();

            // Specify fields to return from query
            query.OutFields.AddRange(new string[] { "STATE_NAME", "SUB_REGION", "STATE_FIPS", "STATE_ABBR", "POP2000", "POP2007" });
            query.Geometry = args.Geometry;

            // Return geometry with result features
            query.ReturnGeometry      = true;
            query.OutSpatialReference = MyMap.SpatialReference;

            queryTask.ExecuteAsync(query);
        }
        void DrawComplete(object sender, client.DrawEventArgs e)
        {
            // Deactivate the draw object for now.
            if (_drawObject != null)
            {
                _drawObject.IsEnabled     = false;
                _drawObject.DrawComplete -= DrawComplete;
                _mapWidget.Map.KeyDown   -= Map_KeyDown;
            }

            // Remove the cancelation toolbar
            _mapWidget.SetToolbar(null);

            // Get the tracked shape passed in as an argument.
            client.Geometry.Envelope env = e.Geometry as client.Geometry.Envelope;
            if (env != null)
            {
                _mapWidget.Map.Extent = env;

                if (isZoomout == false)
                {
                    // If zoom in, set the Map Extent to be the extent of the drawn geometry.
                    _mapWidget.Map.Extent = env;
                }
                else
                {
                    //Zoom out based on the shorter dimension of the drawm rectangle
                    double shorterRectangleDimension  = env.Height > env.Width ? env.Width : env.Height;
                    double selectedMapExtentDimension = shorterRectangleDimension == env.Width ? _mapWidget.Map.Extent.Width : _mapWidget.Map.Extent.Height;

                    _mapWidget.Map.Zoom(shorterRectangleDimension / selectedMapExtentDimension);
                }
            }
        }
Example #3
0
        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs e)
        {
            ESRI.ArcGIS.Client.Geometry.MapPoint clickPoint = e.Geometry as MapPoint;

            ESRI.ArcGIS.Client.Tasks.IdentifyParameters identifyParams = new IdentifyParameters()
            {
                SpatialReference = MyMap.SpatialReference,
                Geometry         = clickPoint,
                MapExtent        = MyMap.Extent,
                Width            = (int)MyMap.ActualWidth,
                Height           = (int)MyMap.ActualHeight,
                LayerOption      = LayerOption.visible
            };

            IdentifyTask identifyTask = new IdentifyTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer");

            identifyTask.ExecuteCompleted += IdentifyTask_ExecuteCompleted;
            identifyTask.Failed           += IdentifyTask_Failed;
            identifyTask.ExecuteAsync(identifyParams);

            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

            graphicsLayer.ClearGraphics();
            ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
            {
                Geometry = clickPoint,
                Symbol   = LayoutRoot.Resources["DefaultPictureSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol
            };
            graphicsLayer.Graphics.Add(graphic);
        }
Example #4
0
        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs e)
        {
            MyDrawObject.IsEnabled = false;

            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

            graphicsLayer.ClearGraphics();

            Graphic graphic = new Graphic()
            {
                Symbol   = LayoutRoot.Resources["StartMarkerSymbol"] as Symbol,
                Geometry = e.Geometry as MapPoint
            };

            graphicsLayer.Graphics.Add(graphic);

            Geoprocessor geoprocessorTask = new Geoprocessor("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/" +
                                                             "Specialty/ESRI_Currents_World/GPServer/MessageInABottle");

            geoprocessorTask.ExecuteCompleted += GeoprocessorTask_ExecuteCompleted;
            geoprocessorTask.Failed           += GeoprocessorTask_Failed;

            List <GPParameter> parameters = new List <GPParameter>();

            parameters.Add(new GPFeatureRecordSetLayer("Input_Point", e.Geometry as MapPoint));
            parameters.Add(new GPDouble("Days", Convert.ToDouble(DaysTextBox.Text)));

            geoprocessorTask.ExecuteAsync(parameters);
        }
Example #5
0
        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            ClearGraphicsLayers();

            Graphic graphic = new Graphic();

            if (args.Geometry is MapPoint)
            {
                graphic.Symbol = LayoutRoot.Resources["BlueMarkerSymbol"] as SimpleMarkerSymbol;
            }
            else if (args.Geometry is Polyline)
            {
                graphic.Symbol = LayoutRoot.Resources["BlueLineSymbol"] as SimpleLineSymbol;
            }
            else if (args.Geometry is Polygon)
            {
                graphic.Symbol = LayoutRoot.Resources["BlueFillSymbol"] as SimpleFillSymbol;
            }
            else if (args.Geometry is Envelope)
            {
                graphic.Symbol = LayoutRoot.Resources["BlueFillSymbol"] as SimpleFillSymbol;
            }

            if (graphic.Symbol != null)
            {
                graphic.Geometry = args.Geometry;
                _myToJsonGraphicsLayer.Graphics.Add(graphic);
            }

            // Convert from Geometry to ArcGIS REST geometry json
            OutJsonTextBox.Text = args.Geometry.ToJson();
        }
        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs e)
        {
            GraphicsLayer stopsGraphicsLayer = MyMap.Layers["MyStopsGraphicsLayer"] as GraphicsLayer;
            Graphic       stop = new Graphic()
            {
                Geometry = e.Geometry, Symbol = LayoutRoot.Resources["StopSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol
            };

            stopsGraphicsLayer.Graphics.Add(stop);

            if (stopsGraphicsLayer.Graphics.Count > 1)
            {
                RouteTask routeTask = LayoutRoot.Resources["MyRouteTask"] as RouteTask;
                if (routeTask.IsBusy)
                {
                    routeTask.CancelAsync();
                    stopsGraphicsLayer.Graphics.RemoveAt(stopsGraphicsLayer.Graphics.Count - 1);
                }
                routeTask.SolveAsync(new RouteParameters()
                {
                    Stops = stopsGraphicsLayer, UseTimeWindows = false,
                    OutSpatialReference = MyMap.SpatialReference
                });
            }
        }
Example #7
0
 /// <summary>
 /// React on draw complete.
 /// </summary>
 /// <param name="sender">Ignored.</param>
 /// <param name="args">Event args.</param>
 private void _PolygonDrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
 {
     Geometry = (ESRI.ArcGIS.Client.Geometry.Polygon)args.Geometry;
     if (OnComplete != null)
     {
         OnComplete(this, EventArgs.Empty);
     }
 }
Example #8
0
 private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
 {
     ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
     {
         Geometry = args.Geometry,
         Symbol   = _activeSymbol,
     };
     graphicsLayer.Graphics.Add(graphic);
 }
 private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs e)
 {
     if (jobid != null)
     {
         inputPoint = e.Geometry as MapPoint;
         _geoprocessorTask.CancelJobAsync(jobid);
     }
     else
     {
         inputPoint = null;
         SubmitJob(e.Geometry as MapPoint);
     }
 }
        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            if (LayersList.SelectedItem == null)
            {
                MessageBox.Show("Please select layer(s) to extract");
                (MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer).Graphics.Clear();
                return;
            }

            Geometry filterGeometry = args.Geometry;

            if (args.Geometry is Polyline)
            {
                Polyline freehandLine = args.Geometry as Polyline;
                freehandLine.Paths[0].Add(freehandLine.Paths[0][0].Clone());
                filterGeometry = new Polygon()
                {
                    SpatialReference = MyMap.SpatialReference
                };
                (filterGeometry as Polygon).Rings.Add(freehandLine.Paths[0]);
            }

            ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
            {
                Geometry = filterGeometry
            };
            _graphicsLayer.Graphics.Add(graphic);
            _drawObject.IsEnabled = false;

            ProcessingTextBlock.Visibility = Visibility.Visible;
            _processingTimer.Start();

            List <GPParameter> parameters = new List <GPParameter>();

            var strLayerList = new List <GPString>();

            foreach (var itm in LayersList.SelectedItems)
            {
                strLayerList.Add(new GPString(itm.ToString(), itm.ToString()));
            }
            parameters.Add(new GPMultiValue <GPString>("Layers_to_Clip", strLayerList));
            parameters.Add(new GPFeatureRecordSetLayer("Area_of_Interest", _graphicsLayer.Graphics[0].Geometry));
            parameters.Add(new GPString("Feature_Format", Formats.SelectedValue.ToString()));

            _geoprocessorTask.SubmitJobAsync(parameters);
        }
        // ***********************************************************************************
        // * User finished drawing a polyline on the map. Add the polyline
        // * barriers GraphicsLayer.
        // ***********************************************************************************
        void DrawComplete(object sender, client.DrawEventArgs e)
        {
            // Deactivate the draw object for now.
            if (_drawObject != null)
            {
                _drawObject.IsEnabled     = false;
                _drawObject.DrawComplete -= DrawComplete;
            }

            client.Geometry.Polyline barrierGeometry = e.Geometry as client.Geometry.Polyline;
            client.Graphic           barrierGraphic  = new client.Graphic()
            {
                Symbol   = _polylineBarrierSymbol, //(LineSymbol)this.FindResource("routeSymbol")
                Geometry = barrierGeometry
            };

            _polylineBarriersGraphicLayer.Graphics.Add(barrierGraphic);
        }
        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs e)
        {
            MyDrawObject.IsEnabled = false;

            try
            {
                if (Convert.ToDouble(MilesTextBox.Text) > 10)
                {
                    MessageBox.Show("Distance must be 10 miles or less.");
                    return;
                }
            }
            catch
            {
                MessageBox.Show("Distance must be a double.");
                return;
            }

            graphicsLayer.ClearGraphics();

            MapPoint mapPoint = e.Geometry as MapPoint;

            mapPoint.SpatialReference = new SpatialReference(102100);

            Graphic graphic = new Graphic()
            {
                Symbol   = LayoutRoot.Resources["StartMarkerSymbol"] as Symbol,
                Geometry = mapPoint
            };

            graphicsLayer.Graphics.Add(graphic);

            List <GPParameter> parameters = new List <GPParameter>();

            parameters.Add(new GPFeatureRecordSetLayer("Input_Features", mapPoint));
            parameters.Add(new GPString("Height", HeightTextBox.Text));
            parameters.Add(new GPLinearUnit("Distance", esriUnits.esriMiles, Convert.ToDouble(MilesTextBox.Text)));

            _geoprocessorTask.OutputSpatialReference = new SpatialReference(102100);
            WaitGrid.Visibility = Visibility.Visible;

            _geoprocessorTask.SubmitJobAsync(parameters);
        }
Example #13
0
        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            myDrawObject.IsEnabled = false;

            QueryTask queryTask = new QueryTask("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/Aerial/ImageServer/query");

            queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
            queryTask.Failed           += QueryTask_Failed;

            Query query = new ESRI.ArcGIS.Client.Tasks.Query();

            query.OutFields.Add("*");
            query.Geometry            = args.Geometry;
            query.ReturnGeometry      = true;
            query.OutSpatialReference = MyMap.SpatialReference;
            query.Where = "Category = 1";

            queryTask.ExecuteAsync(query);
        }
        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;

            ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
            {
                Geometry = args.Geometry,
                Symbol   = _activeSymbol,
            };
            graphicsLayer.Graphics.Add(graphic);

            if (args.Geometry is ESRI.ArcGIS.Client.Geometry.Polyline)
            {
                _polyline = args.Geometry as ESRI.ArcGIS.Client.Geometry.Polyline;
            }

            ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = true; // clear
            ((ApplicationBarIconButton)ApplicationBar.Buttons[1]).IsEnabled = true; // show graph
        }
        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            myDrawObject.IsEnabled = false;

            Graphic waypointGraphic = new Graphic()
            {
                Geometry = MyMap.WrapAroundIsActive ? Geometry.NormalizeCentralMeridian(args.Geometry) : args.Geometry,
                Symbol   = LayoutRoot.Resources["UserStopSymbol"] as Symbol
            };

            waypointGraphic.Attributes.Add("StopNumber", waypointGraphicsLayer.Graphics.Count + 1);
            waypointGraphicsLayer.Graphics.Add(waypointGraphic);

            if (waypointGraphicsLayer.Graphics.Count > 1)
            {
                RouteButton.IsEnabled = true;
            }
            myDrawObject.IsEnabled = true;
        }
        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            MyDrawObject.IsEnabled = false;

            ESRI.ArcGIS.Client.Geometry.Polygon polygon = args.Geometry as ESRI.ArcGIS.Client.Geometry.Polygon;
            polygon.SpatialReference = new SpatialReference(4326);
            Graphic graphic = new Graphic()
            {
                Symbol   = LayoutRoot.Resources["DefaultPolygonSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol,
                Geometry = polygon
            };

            graphic.Attributes.Add("X", "Label Point Polygon");
            graphicsLayer.Graphics.Add(graphic);

            List <Graphic> graphicsList = new List <Graphic>();

            graphicsList.Add(graphic);

            geometryService.SimplifyAsync(graphicsList);
        }
        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            myDrawObject.IsEnabled = false;
            Graphic waypointGraphic = new Graphic()
            {
                Geometry = args.Geometry as MapPoint,
                Symbol   = LayoutRoot.Resources["UserStopSymbol"] as Symbol
            };

            waypointGraphic.Attributes.Add("StopNumber", waypointGraphicsLayer.Graphics.Count + 1);
            waypointGraphicsLayer.Graphics.Add(waypointGraphic);

            if (waypointGraphicsLayer.Graphics.Count > 1)
            {
                RouteButton.IsEnabled = true;
            }
            else
            {
                RouteButton.IsEnabled = false;
            }
        }
        private void MyDrawSurface_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            selectionGraphicsLayer.ClearGraphics();

            QueryTask queryTask = new QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5");

            queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
            queryTask.Failed           += QueryTask_Failed;

            Query query = new ESRI.ArcGIS.Client.Tasks.Query()
            {
                Geometry            = args.Geometry,
                OutSpatialReference = MyMap.SpatialReference,
                ReturnGeometry      = true
            };

            // Specify fields to return from query
            query.OutFields.AddRange(new string[] { "STATE_NAME", "POP2000", "POP2007" });

            queryTask.ExecuteAsync(query);
        }
Example #19
0
        void targetAreaDraw_DrawComplete(object sender, client.DrawEventArgs e)
        {
            try
            {
                if (_graphicsLayerPoly == null)
                {
                    _graphicsLayerPoly    = new client.GraphicsLayer();
                    _graphicsLayerPoly.ID = "AircraftCommunicationGraphicsPoly";
                    client.AcceleratedDisplayLayers aclyrs = _mapWidget.Map.Layers.FirstOrDefault(lyr => lyr is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers;
                    if (aclyrs.Count() > 0)
                    {
                        aclyrs.ChildLayers.Add(_graphicsLayerPoly);
                    }
                }
                ResourceDictionary mydictionary = new ResourceDictionary();
                mydictionary.Source = new Uri("/AircraftCommunicationCoverageAddin;component/SymbolDictionary.xaml", UriKind.RelativeOrAbsolute);

                WebMercator    mercator = new ESRI.ArcGIS.Client.Projection.WebMercator();
                client.Graphic g        = new client.Graphic();
                //g.Geometry = mercator.ToGeographic(e.Geometry) as client.Geometry.Polygon;
                //g.Symbol = mydictionary["BasicFillSymbol_Yellow_Trans_6"] as client.Symbols.SimpleFillSymbol;
                g.Geometry = e.Geometry as client.Geometry.Polygon;
                g.Symbol   = mydictionary["BasicFillSymbol_Yellow_Trans_6"] as client.Symbols.SimpleFillSymbol;
                _graphicsLayerPoly.Graphics.Add(g);
                targetAreaDraw.DrawMode = client.DrawMode.None;
                if (_graphicsLayer != null && _graphicsLayerPoly != null)
                {
                    if (_graphicsLayer.Graphics.Count() > 0 && _graphicsLayerPoly.Graphics.Count() > 0)
                    {
                        RunButton.IsEnabled = true;
                    }
                }

                targetAreaDraw.IsEnabled = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in draw complete: " + ex.Message);
            }
        }
Example #20
0
        private void MyDrawSurface_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            GraphicsLayer selectionGraphicslayer = Map.Layers["MySelectionGraphicsLayer"] as GraphicsLayer;

            selectionGraphicslayer.ClearGraphics();

            // Bind data grid to query results
            Binding resultFeaturesBinding = new Binding("LastResult.Features");

            resultFeaturesBinding.Source = _queryTask;
            QueryDetailsDataGrid.SetBinding(DataGrid.ItemsSourceProperty, resultFeaturesBinding);

            Query query = new ESRI.ArcGIS.Client.Tasks.Query();

            query.OutFields.AddRange(new string[] { "state_name", "pop2000", "sub_region" });
            query.OutSpatialReference = Map.SpatialReference;
            query.Geometry            = args.Geometry;
            query.SpatialRelationship = SpatialRelationship.esriSpatialRelIntersects;
            query.ReturnGeometry      = true;

            _queryTask.ExecuteAsync(query);
        }
        private void MyDrawSurface_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            ResultsDisplay.Visibility = Visibility.Collapsed;
            MyDrawObject.IsEnabled    = false;
            selectionGraphicslayer.Graphics.Clear();

            // Bind data grid to query results
            Binding resultFeaturesBinding = new Binding("LastResult.Features");

            resultFeaturesBinding.Source = MyQueryTask;
            QueryDetailsDataGrid.SetBinding(DataGrid.ItemsSourceProperty, resultFeaturesBinding);

            Query query = new ESRI.ArcGIS.Client.Tasks.Query();

            query.OutFields.AddRange(new string[] { "STATE_NAME", "POP2000", "SUB_REGION" });
            query.OutSpatialReference = MyMap.SpatialReference;
            query.Geometry            = args.Geometry;
            query.SpatialRelationship = SpatialRelationship.esriSpatialRelIntersects;
            query.ReturnGeometry      = true;

            MyQueryTask.ExecuteAsync(query);
        }
Example #22
0
        private void DrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs e)
        {
            if (this.DrawWidget == this.GetType())
            {
                MapPoint point = e.Geometry as MapPoint;
                if (!this.IsOpen)
                {
                    this.IsOpen = true;
                }
                else
                {
                    this.Focus();
                }

                if (widgetConfig != null)
                {
                    DoIdentification(point);
                }
                else // Wait for configuration file is loaded
                {
                    identifyPoint = point;
                }
            }
        }
Example #23
0
        private void MyDrawObject_DrawComplete(object sender, ESRI.ArcGIS.Client.DrawEventArgs args)
        {
            Type     geometryType              = args.Geometry.GetType();
            Geometry wgs84Geometry             = _mercator.ToGeographic(args.Geometry);
            Geometry mercatorDensifiedGeometry = null;
            Geometry densifiedGeometry         = null;
            int      originalVerticeCount      = 0;
            int      densifiedVerticeCount     = 0;

            if (geometryType == typeof(Polygon))
            {
                // Values returned in meters
                if (RadioButtonGeodesic.IsChecked.Value)
                {
                    TextBlockLength.Text = (ESRI.ArcGIS.Client.Geometry.Geodesic.Length(wgs84Geometry as Polygon)
                                            * 0.000621371192).ToString("#0.000") + " mi";
                    TextBlockArea.Text = (Math.Abs(ESRI.ArcGIS.Client.Geometry.Geodesic.Area(wgs84Geometry as Polygon))
                                          * 3.86102159e-7).ToString("#0.000") + " sq mi";
                }
                else
                {
                    TextBlockLength.Text = (ESRI.ArcGIS.Client.Geometry.Euclidian.Length(args.Geometry as Polygon)
                                            * 0.000621371192).ToString("#0.000") + " mi";
                    TextBlockArea.Text = (Math.Abs(ESRI.ArcGIS.Client.Geometry.Euclidian.Area(args.Geometry as Polygon))
                                          * 3.86102159e-7).ToString("#0.000") + " sq mi";
                }

                foreach (PointCollection ring in (args.Geometry as Polygon).Rings)
                {
                    foreach (MapPoint mp in ring)
                    {
                        originalVerticeCount++;
                        verticesGraphicsLayer.Graphics.Add(new ESRI.ArcGIS.Client.Graphic()
                        {
                            Geometry = mp,
                            Symbol   = LayoutRoot.Resources["OriginalMarkerSymbol"] as Symbol
                        });
                    }
                }

                if (RadioButtonGeodesic.IsChecked.Value)
                {
                    densifiedGeometry =
                        ESRI.ArcGIS.Client.Geometry.Geodesic.Densify(wgs84Geometry, MyMap.Resolution * 10);
                    mercatorDensifiedGeometry = _mercator.FromGeographic(densifiedGeometry);
                }
                else
                {
                    mercatorDensifiedGeometry =
                        ESRI.ArcGIS.Client.Geometry.Euclidian.Densify(args.Geometry, MyMap.Resolution * 10);
                }

                foreach (PointCollection ring in (mercatorDensifiedGeometry as Polygon).Rings)
                {
                    foreach (MapPoint mp in ring)
                    {
                        densifiedVerticeCount++;
                        verticesGraphicsLayer.Graphics.Add(new ESRI.ArcGIS.Client.Graphic()
                        {
                            Geometry = mp,
                            Symbol   = LayoutRoot.Resources["NewMarkerSymbol"] as Symbol
                        });
                    }
                }
            }
            else // Polyline
            {
                // Value returned in meters
                if (RadioButtonGeodesic.IsChecked.Value)
                {
                    TextBlockLength.Text = (ESRI.ArcGIS.Client.Geometry.Geodesic.Length(wgs84Geometry as Polyline)
                                            * 0.000621371192).ToString("#0.000") + " mi";
                }
                else
                {
                    TextBlockLength.Text = (ESRI.ArcGIS.Client.Geometry.Euclidian.Length(args.Geometry as Polyline)
                                            * 0.000621371192).ToString("#0.000") + " mi";
                }

                TextBlockArea.Text = "NA";

                foreach (PointCollection path in (args.Geometry as Polyline).Paths)
                {
                    foreach (MapPoint mp in path)
                    {
                        originalVerticeCount++;
                        verticesGraphicsLayer.Graphics.Add(new ESRI.ArcGIS.Client.Graphic()
                        {
                            Geometry = mp,
                            Symbol   = LayoutRoot.Resources["OriginalMarkerSymbol"] as Symbol
                        });
                    }
                }

                if (RadioButtonGeodesic.IsChecked.Value)
                {
                    densifiedGeometry =
                        ESRI.ArcGIS.Client.Geometry.Geodesic.Densify(wgs84Geometry, MyMap.Resolution * 10);
                    mercatorDensifiedGeometry = _mercator.FromGeographic(densifiedGeometry);
                }
                else
                {
                    mercatorDensifiedGeometry =
                        ESRI.ArcGIS.Client.Geometry.Euclidian.Densify(args.Geometry, MyMap.Resolution * 10);
                }

                foreach (PointCollection path in (mercatorDensifiedGeometry as Polyline).Paths)
                {
                    foreach (MapPoint mp in path)
                    {
                        densifiedVerticeCount++;
                        verticesGraphicsLayer.Graphics.Add(new ESRI.ArcGIS.Client.Graphic()
                        {
                            Geometry = mp,
                            Symbol   = LayoutRoot.Resources["NewMarkerSymbol"] as Symbol
                        });
                    }
                }
            }

            featureGraphicsLayer.Graphics.Add(new ESRI.ArcGIS.Client.Graphic()
            {
                Geometry = mercatorDensifiedGeometry,
                Symbol   = geometryType == typeof(Polygon) ?
                           LayoutRoot.Resources["ResultFillSymbol"] as Symbol :
                           LayoutRoot.Resources["ResultLineSymbol"] as Symbol
            });

            TextBlockVerticesBefore.Text = originalVerticeCount.ToString();
            TextBlockVerticesAfter.Text  = densifiedVerticeCount.ToString();
        }