public static Tuple <LegendItemKey, ILegendItem>[] GetLegendItemsForLayer(LayerVM layer) { Dictionary <LegendItemKey, ILegendItem> resultDict = new Dictionary <LegendItemKey, ILegendItem>(); if (layer is MultiClassificationLayerIconPresentingVM) { PropertyRepresentation representation = PropertyRepresentation.SvgIcon; MultiClassificationLayerIconPresentingVM mclipVM = (MultiClassificationLayerIconPresentingVM)layer; if (mclipVM.ClassificationVM.CurrentClasses == null) { return(new Tuple <LegendItemKey, ILegendItem> [0]); } var classes = mclipVM.ClassificationVM.CurrentClasses.ToArray(); foreach (var c in classes) { LegendItemKey key = new LegendItemKey(mclipVM.ClassificationVM.PropertyName, c.ID, representation); if (!resultDict.ContainsKey(key)) { resultDict.Add(key, new SvgIconLegendItem(c)); } } } return(resultDict.Select(kvp => Tuple.Create(kvp.Key, kvp.Value)).ToArray()); }
public LegendItemKey(string propID, string classID, PropertyRepresentation representation) { PropID = propID; ClassID = classID; Representation = representation; }