void LoadCountyShape(string county, LoadedMapInfo countyInfo) { countyInfo.VisibleItems = new List <MapItem>(); if (county != null) { foreach (var item in countyInfo.AllItems) { var stateAttr = item.Attributes["STATEFP"]; if (stateAttr != null && stateAttr.Value.ToString() == county) { if (IsSkipGeoid(item.Attributes["GEOID"])) { continue; } countyInfo.VisibleItems.Add(item); } } ; } else { countyInfo.VisibleItems.AddRange(countyInfo.AllItems); } colorizer.ColorizeCountyItems(electionData, countyInfo.VisibleItems); DisposeCountyLayer(); countyInfo.Layer = new VectorItemsLayer() { ToolTipPattern = "tooltip" }; countyInfo.SetupVisibleItemsLayerStorage(); }
void DisposeCountyLayer(LoadedMapInfo countyInfo = null) { if (countyInfo == null) { countyInfo = this.usCountyInfo; } countyInfo.DestroyStorage(); countyInfo.DestroyLayer(); }
void LoadUSShape(LoadedMapInfo info, ElectionData electionData, bool colorize = true) { info.DestroyStorage(); info.AllItems = LoadMapShapeItems(Helpers.GetUSMap()); info.VisibleItems = new List <MapItem>(info.AllItems); if (colorize) { colorizer.ColorizeStateItems(electionData, info.AllItems); } if (info.Layer == null) { info.Layer = new VectorItemsLayer(); } info.SetupVisibleItemsLayerStorage(); }
public Map() { InitializeComponent(); this.mapControl.EnableScrolling = EnableMapScrollingInStateView; this.usStateInfo = new LoadedMapInfo() { Layer = this.stateLayer }; this.usCountyInfo = new LoadedMapInfo(); LoadUSCountyShapes(); this.electionResults = ElectionResults.e2012; LoadElectionData(); CreateColorLegend(); switchResults.Visible = true; }