Hi ,
I'm trying the map suite web edition (MapSuite.Core4.5.0, WebEdition4.5.0), and i'm facing difficulties in the markers implementation. I've modified the samples (that usually works with SimpleMarkerOverlay), and i'm adding features directly in the Map.MarkerOverlay, but sometimes the autorefresh don't work.
this code is in the load event inside an If (!Page.IsPostBack):
Map1.MarkerOverlay.AutoRefreshInterval = TimeSpan.FromMilliseconds(500);//
Map1.MarkerOverlay.Tick += new EventHandler<EventArgs>(markerOverlay_Tick);//
WebImage imgMark = new WebImage("Imagenes/PointerGreen.png");//
Map1.MarkerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage = imgMark;
Map1.MarkerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.Width = 100;
Map1.MarkerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.Height = 20;
Map1.MarkerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.IsVisible = false;
Map1.MarkerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.AutoPan = true;
Map1.MarkerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
Map1.MarkerOverlay.FeatureSource.Open();
Map1.MarkerOverlay.Columns.Add(new FeatureSourceColumn("posId"));
Map1.MarkerOverlay.FeatureSource.Close();
Map1.MarkerOverlay.Features.Add("mark", mark);
and this is my tick_handler code:
con = Convert.ToInt32(hdnFld.Value);
lstPos = objPos.SelectAllPositions(1, Convert.ToDateTime("2010-12-20 17:03:00"), Convert.ToDateTime("2011-01-05 18:43:00"));
if (!posLoaded)
{
foreach (PositionsInfo posInf in lstPos)
{
updaterPoints.Add(new PointShape(posInf.Longitude, posInf.Latitude));
}
posLoaded = true;
}
InMemoryMarkerOverlay markOverlay = Map1.MarkerOverlay;
PointShape markers = (PointShape)markOverlay.Features["mark"].GetShape();
markOverlay.Features["mark"].ColumnValues["posId"] = lstPos[con].PositionId.ToString();
if (htmlMarcadores == null)
{
htmlMarcadores.Append(popupContent.Value);
}
htmlMar.Append(htmlMarcadores);
htmlMar.Append(lstPos[con].PositionId.ToString());
htmlMar.Append("");
markOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.ContentHtml = htmlMar.ToString();
htmlMar.Clear();
markers = updaterPoints[con];++con;
hdnFld.Value = con.ToString();
And finally i've forced the event using this intruction in the page.Load event(because it didn't auto-refresh):
markerOverlay_Tick(Map1.MarkerOverlay, new EventArgs());
So, i'm wrong and should use an InMemoryMarkerOverlay instead the Map.MarkerOverlay?(and now it isn't autorefreshing again!)