コード例 #1
0
 void RestoreMapView(MapControl map, MapViewData data, bool animated = true)
 {
     if (data == null)
     {
         return;
     }
     map.ZoomLevel = data.Zoom;
     map.SetCenterPoint(data.CenterPoint, animated);
 }
コード例 #2
0
 void ShowCountyMap(StateInfo state, bool forceFullMap = false)
 {
     if (electionData == null)
     {
         return;
     }
     if (state == null && !forceFullMap)
     {
         return;
     }
     this.mapData = null;
     if (!IsCountyMode)
     {
         this.mapData = SaveMapView(mapControl);
     }
     DisposeCountyLayer();
     if (state != null)
     {
         var voteInfo = electionData.Votes.FirstOrDefault(q => q.State == state.State);
         if (voteInfo == null || !voteInfo.HasCountyVotes)
         {
             XtraMessageBox.Show(this, string.Format("{0} state doesn't has detailed county data", state.Name));
             return;
         }
     }
     this.mapControl.EnableScrolling = true;
     this.activeStateCounty          = state;
     isCountyMode = true;
     UpdateListSource();
     btBackToStates2.Visible = btBackToStates.Visible = true;
     btBackToStates.BringToFront();
     LoadCountyShape(state == null ? null : state.FIPS, usCountyInfo);
     foreach (var item in usStateInfo.VisibleItems)
     {
         item.SelectedFill = item.HighlightedFill = item.Fill = Color.FromArgb(100, item.Fill);// Color.LightGray; //todo
     }
     mapControl.Layers.Add(usCountyInfo.Layer);
     mapControl.ZoomToFit(usCountyInfo.VisibleItems);
 }