Return Value
The object tye name.
Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
var map = MapView.Active.Map; if (map.MapType != MapType.LinkChart) return; // find the KG layer var kgLayer = map.GetLayersAsFlattenedList().OfType<KnowledgeGraphLayer>().FirstOrDefault(); if (kgLayer == null) return; // find the first LinkChartFeatureLayer in the KG layer var lcFeatureLayer = kgLayer.GetLayersAsFlattenedList().OfType<LinkChartFeatureLayer>().FirstOrDefault(); if (lcFeatureLayer != null) return; QueuedTask.Run(() => { // get the KG var kg = kgLayer.GetDatastore(); // get the ID set of the KG layer var idSet = kgLayer.GetIDSet(); // get the named object type in the KG that the LinkChartFeatureLayer represents var typeName = lcFeatureLayer.GetTypeName(); // if there are items in the ID Set for this type if (idSet.Contains(typeName)) { // build a new ID set containing only these records var dict = idSet.ToOIDDictionary(); var oids = dict[typeName]; var newDict = new Dictionary<string, List<long>>(); newDict.Add(typeName, oids); var newIDSet = KnowledgeGraphLayerIDSet.FromDictionary(kg, newDict); // now create a new link chart using just this subset of records MapFactory.Instance.CreateLinkChart("subset LinkChart", kg, newIDSet); } });
Target Platforms: Windows 11, Windows 10