private static void SubtractFeatures()
        {
            var ids = SharedViewModel.Instance.EditOverlay.EditShapesLayer.InternalFeatures.Select(f => f.Id).ToArray();

            int  temp             = 0;
            bool allIdsAreNumbers = SharedViewModel.Instance.EditOverlay.EditShapesLayer.InternalFeatures.All(f => int.TryParse(f.Id, out temp));
            IEnumerable <Feature> featuresWithNumberId = null;

            if (!allIdsAreNumbers)
            {
                int numberId = 0;
                featuresWithNumberId = SharedViewModel.Instance.EditOverlay.EditShapesLayer.InternalFeatures.Select(f => new Feature(f.GetWellKnownBinary(), (numberId++).ToString()));
            }
            else
            {
                featuresWithNumberId = SharedViewModel.Instance.EditOverlay.EditShapesLayer.InternalFeatures;
            }

            var subtractedAreas = GeoProcessHelper.SubtractAreas(featuresWithNumberId);

            SharedViewModel.Instance.EditOverlay.EditShapesLayer.InternalFeatures.Clear();

            if (ids.Length == subtractedAreas.Length)
            {
                for (int i = 0; i < ids.Length; i++)
                {
                    SharedViewModel.Instance.EditOverlay.EditShapesLayer.InternalFeatures.Add(new Feature(subtractedAreas[i].GetWellKnownBinary(), ids[i]));
                }
            }

            SharedViewModel.Instance.EditOverlay.EditShapesLayer.BuildIndex();
            GisEditor.ActiveMap.Refresh(SharedViewModel.Instance.EditOverlay);

            SharedViewModel.Instance.EditOverlay.TakeSnapshot();
        }
        private static void UnionFeatures()
        {
            string id = GetId();

            try
            {
                var resultFeature = GeoProcessHelper.UnionAreaFeatures(SharedViewModel.Instance.EditOverlay.EditShapesLayer.InternalFeatures);
                SetFeatrueAttribute(resultFeature);
                SharedViewModel.Instance.EditOverlay.EditShapesLayer.InternalFeatures.Clear();
                AddGeoProcessedFeatureToOverlay(resultFeature, id.ToString());

                SharedViewModel.Instance.EditOverlay.TakeSnapshot();
            }
            catch (Exception ex)
            {
                GisEditorMessageBox box = new GisEditorMessageBox(System.Windows.MessageBoxButton.OK);
                box.Owner = Application.Current.MainWindow;
                box.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                box.Title        = "Error";
                box.Message      = "An error has occurred while trying to union shapes.";
                box.ErrorMessage = ex.ToString();
                box.ShowDialog();
                GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, ex);
            }
        }
        private static void CombineFeatures()
        {
            string id = GetId();

            var resultFeature = GeoProcessHelper.CombineFeatures(SharedViewModel.Instance.EditOverlay.EditShapesLayer.InternalFeatures);

            SetFeatrueAttribute(resultFeature);
            SharedViewModel.Instance.EditOverlay.EditShapesLayer.InternalFeatures.Clear();
            AddGeoProcessedFeatureToOverlay(resultFeature, id);

            SharedViewModel.Instance.EditOverlay.TakeSnapshot();
        }
        private static void IntersectFeatures()
        {
            string id = GetId();

            var resultFeature = GeoProcessHelper.IntersectFeatures(SharedViewModel.Instance.EditOverlay.EditShapesLayer.InternalFeatures);

            if (resultFeature != null)
            {
                SetFeatrueAttribute(resultFeature);
                AddGeoProcessedFeatureToOverlay(resultFeature, id.ToString());
                SubtractFeatures();
                SharedViewModel.Instance.EditOverlay.TakeSnapshot();
            }
        }