Thanattha Bussapak

Thanattha Bussapak

  • NA
  • 20
  • 19.5k

How to create coordinates with Ellipse form database

Dec 11 2013 11:37 AM
I can create my current location but,I want to add coordinates form database.I have function (dot) for create new Ellipse.When I call data form MYSQL I don't know how I use Latitude and Longitude to show with dot.


public void dot(Map MyMap, GeoCoordinate Geoposition)
  {

  Ellipse myCircle2 = new Ellipse();
  myCircle2.Fill = new SolidColorBrush(Colors.Red);
  myCircle2.Height = 100;
  myCircle2.Width = 100;
  myCircle2.Opacity = 0.08;

  MyMap.Center = Geoposition;
  this.mapWithMyLocation.ZoomLevel = 16;

  var overlay1 = new MapOverlay();
  overlay1.Content = myCircle2;
  overlay1.GeoCoordinate = Geoposition;
  overlay1.PositionOrigin = new Point(0.5, 0.5);

  var layer1 = new MapLayer();
  layer1.Add(overlay1);

  //MyMap.Layers.Add(layer1);
  mapWithMyLocation.Layers.Add(layer1);

  }
 
  private void ApplicationBarSearchButton_Click(object sender, EventArgs e)
  {
  //NavigationService.Navigate(new Uri("/RoutePage.xaml", UriKind.Relative));

  dot(mapWithMyLocation, new GeoCoordinate(13.728061, 100.777149));
  dot(mapWithMyLocation, new GeoCoordinate(13.728422, 100.78344));
  }


//////////////////////////////////////////////////////////////////////////////////////////////////////
  private void ShowMyLocationOnTheMap(object sender, UploadStringCompletedEventArgs e)
  {
  //dot(mapWithMyLocation, new GeoCoordinate(13.728061, 100.777149));
 
  //dot(mapWithMyLocation, new GeoCoordinate(13.728422, 100.78344));


  if (e.Cancelled == false && e.Error == null)
  {
  MemoryStream ml = new MemoryStream(Encoding.UTF8.GetBytes(e.Result));
  ObservableCollection<sResult> list = new ObservableCollection<sResult>();
  DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ObservableCollection<sResult>));


  //fuckkkkk
  list = (ObservableCollection<sResult>)serializer.ReadObject(ml);

  List<sResult> myGPS = new List<sResult>();

  foreach (sResult cm in list)
  {
  string sGPS_ID = cm.GPS_ID.ToString();
  string sLatitude = cm.Latitude.ToString();
  string sLongitude = cm.Longitude.ToString();
  string sTimestamp = cm.Timestamp.ToString();

  myGPS.Add(new sResult(sGPS_ID, sLatitude, sLongitude, sTimestamp));
  //string glalg = (sLatitude + sLongitude);

 
  }

  this.resultList.ItemsSource = myGPS;

  prog.IsVisible = false;

  }

  }

  ////}

  [DataContract]
  public class sResult
  {
  [DataMember]
  public string GPS_ID { get; set; }

  [DataMember]
  public string Latitude { get; set; }

  [DataMember]
  public string Longitude { get; set; }

  [DataMember]
  public string Timestamp { get; set; }

  [DataMember]
  public string Status { get; set; }

  public sResult(string strGPS_ID, string strLatitude, string strLongitude, string strTimestamp)
  {
  this.GPS_ID = strGPS_ID;
  this.Latitude = strLatitude;
  this.Longitude = strLongitude;
  this.Timestamp = strTimestamp;

 
  }
  }