Esempio n. 1
0
        public void DeleteSelection()
        {
            int featuresDeleted = 0;

            for (int i = 0; i < MapControl.SelectTool.FeatureEditors.Count; i++)
            {
                IFeatureEditor featureMutator = MapControl.SelectTool.FeatureEditors[i];
                if (!featureMutator.AllowDeletion())
                {
                    continue;
                }
                featureMutator.Delete();
                featuresDeleted++;
            }
            if (featuresDeleted > 0)
            {
                // Better not to reset the selection if you haven't done anything.
                MapControl.SelectTool.Clear();
            }
        }
Esempio n. 2
0
        public void DeleteSelection()
        {
            if (MapControl.SelectTool.FeatureEditors.Count == 0)
            {
                return;
            }
            int featuresDeleted = 0;

            IEditableObject editableObject = MapControl.SelectTool.FeatureEditors[0].EditableObject;

            for (int i = 0; i < MapControl.SelectTool.FeatureEditors.Count; i++)
            {
                IFeatureEditor featureMutator = MapControl.SelectTool.FeatureEditors[i];
                if (!featureMutator.AllowDeletion())
                {
                    continue;
                }

                if (featuresDeleted == 0 && editableObject != null)
                {
                    editableObject.BeginEdit("Delete feature(s)");
                }

                featureMutator.Delete();
                featuresDeleted++;
            }
            if (featuresDeleted > 0)
            {
                // Better not to reset the selection if you haven't done anything.
                MapControl.SelectTool.Clear();

                if (editableObject != null)
                {
                    editableObject.EndEdit();
                }
            }
        }