Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
 void DisposeCountyLayer(LoadedMapInfo countyInfo = null)
 {
     if (countyInfo == null)
     {
         countyInfo = this.usCountyInfo;
     }
     countyInfo.DestroyStorage();
     countyInfo.DestroyLayer();
 }
Exemplo n.º 3
0
 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();
 }
Exemplo n.º 4
0
 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;
 }