-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStoreButton.cs
More file actions
46 lines (44 loc) · 1.46 KB
/
Copy pathStoreButton.cs
File metadata and controls
46 lines (44 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using ArcGIS.Core.CIM;
using ArcGIS.Core.Data;
using ArcGIS.Core.Geometry;
using ArcGIS.Desktop.Catalog;
using ArcGIS.Desktop.Core;
using ArcGIS.Desktop.Editing;
using ArcGIS.Desktop.Extensions;
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Framework.Dialogs;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.KnowledgeGraph;
using ArcGIS.Desktop.Layouts;
using ArcGIS.Desktop.Mapping;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CycleSelection
{
internal class StoreButton : Button
{
protected override void OnClick()
{
QueuedTask.Run(() =>
{
MapView activeMap = MapView.Active;
if (activeMap == null )
return;
Module1.SelectionSet = activeMap.Map.GetSelection();
Dictionary<MapMember, List<long>> selection = Module1.SelectionSet.ToDictionary();
List<(MapMember, long)> selectionList = selection.SelectMany( kvp => kvp.Value.Select( oid => (kvp.Key, oid) ) ).ToList();
if (selectionList.Count > 0)
{
Module1.SelectedFeatures = selectionList;
Module1.ActivateState("CycleSelection_StoredSelection");
}
else
Module1.ClearFeatures();
});
}
}
}