Skip to content

Instantly share code, notes, and snippets.

@christopherhouse
Last active December 17, 2015 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christopherhouse/5551489 to your computer and use it in GitHub Desktop.
Save christopherhouse/5551489 to your computer and use it in GitHub Desktop.
private void OnStateSelected(string stateName)
{
if (this.currentStateOverlay != null)
{
this.mainView.MapView.RemoveOverlay(this.currentStateOverlay);
}
State selectedState = this.states.First(state => state.Name == stateName);
this.mainView.MoveMapIntoViewAndPickerOutOfView();
CLLocationCoordinate2D[] stateBoundary = selectedState.Boundary.Select(coord => new CLLocationCoordinate2D(coord.Latitude, coord.Longitude)).ToArray();
this.currentStateOverlay = MKPolygon.FromCoordinates(stateBoundary);
this.currentStateOverlay.Title = selectedState.Name;
this.mainView.MapView.AddOverlay (this.currentStateOverlay);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment