Hi, I am trying to add markers with lables using SimpleMarkerOverlay class. This is the code that I add markers on map.
private void AddSimpleVehicleMarkers()
{
int rid = Convert.ToInt32(Request.QueryString["rid"]);
int userid = Convert.ToInt32(Request.QueryString["uid"].ToString());
string filter = Request.QueryString["flt"];
GetVehicleData(rid == 0 ? currentFleet : 0, rid, userid, filter, groupId); // fill the static DataTable
SimpleMarkerOverlay smMarkerOverlay = (SimpleMarkerOverlay)Map1.CustomOverlays["simplevehiclelayer"];
smMarkerOverlay.Markers.Clear();
for (int i = 0; i < staticDt.Rows.Count; i++)
{
if ((Convert.ToDouble(staticDt.Rows["X"].ToString()) != 0) && (Convert.ToDouble(staticDt.Rows["Y"].ToString()) != 0))
{
string uid = staticDt.Rows["CIHAZID"].ToString();
string plaka = staticDt.Rows["PLAKA"].ToString();
string hiz = staticDt.Rows["SPEED"].ToString();
string tarih = staticDt.Rows["DATE"].ToString();
string adres = HttpContext.Current.Server.HtmlEncode(staticDt.Rows["LOCATION"].ToString());
double xCoord = 0;
double.TryParse(staticDt.Rows["X"].ToString(), out xCoord);
double yCoord = 0;
double.TryParse(staticDt.Rows["Y"].ToString(), out yCoord);
int kontak = (int)staticDt.Rows["KONTAK"];
int aractip = (int)staticDt.Rows["ARACTIPID"];
bool rolanti = (bool)staticDt.Rows["ROLANTI"];
bool status = Convert.ToInt32(staticDt.Rows["STATUS"]) != 0;
DateTime InsertDate = Convert.ToDateTime(staticDt.Rows["INSERTDATE"].ToString());
int iStatus = 0;
TimeSpan tm = DateTime.Now - InsertDate;
if ((!status) && (tm.TotalMinutes >= 60))
{
iStatus = 4;
}
else
{
if (kontak == 1 && !rolanti) iStatus = 1;
else if (kontak == 1 && rolanti) iStatus = 2;
else if (kontak == 0) iStatus = 3;
}
string vStatus = String.Format("{0:000}", iStatus);
string vFolder = (aractip > 0) ? aractip.ToString() + "/" : "";
string imagePath = String.Format("images/vTypes/{0}{1}.gif", vFolder, vStatus);
Vertex v = MapGlobals.ConvertCoord(xCoord, yCoord, true);
Marker vm = new Marker(v.X, v.Y);
vm.WebImage = new WebImage(imagePath);
vm.Popup = GetPopupStyle(uid, plaka, hiz, adres, tarih);
vm.Popup.HasCloseButton = false;
vm.Popup.IsVisible = false;
smMarkerOverlay.Markers.Add(vm);
}
}
}
How can I add labels for each markers?
thanks.