I am using ARCObject SDK 10.1 to develop a Add-in to display time enabled layer. I. following is the code that i used to dispaly time enable data layer on every second.
While my following code is work good . however there is a a problem which is not clear. when i run the following code than i assume that on every second it should display one point , but contrary to this it actually displays two point. I called this method on a timer event with values form 1 to 100. it is working but it is displaying two points as shown in the figure. I have used this code from ESRI samples. Any suggestion please.
public void UpdateCurrentTime(double progress)
{
if (progress <= 0)
progress = 0.05;
else if (progress >= 100)
progress = 0.95;
//Calculate how far into the layer to jump
ITimeDuration offsetToNewCurrentTime = m_myLayerTimeExtent.QueryTimeDuration();
offsetToNewCurrentTime.Scale(progress);
IMxDocument pMxDoc = ArcMap.Document;
IMap pMap = pMxDoc.FocusMap;
IActiveView pActiveView = pMap as IActiveView;
IScreenDisplay pScreenDisplay = pActiveView.ScreenDisplay;
ITimeDisplay pTimeDisplay = pScreenDisplay as ITimeDisplay;
ITime startTime = m_myLayerTimeExtent.StartTime;
ITime endTime = (ITime)((IClone)startTime).Clone();
((ITimeOffsetOperator)endTime).AddDuration(m_layerInterval);
ITimeExtent pTimeExt = new TimeExtentClass();
pTimeExt.SetExtent(startTime, endTime);
pTimeExt.Empty = false;
((ITimeOffsetOperator)pTimeExt).AddDuration(offsetToNewCurrentTime);
pTimeDisplay.TimeValue = pTimeExt as ITimeValue;
pActiveView.Refresh();
}
protected override void OnUpdate()
{
Enabled = true;
}
}
}
While my following code is work good . however there is a a problem which is not clear. when i run the following code than i assume that on every second it should display one point , but contrary to this it actually displays two point. I called this method on a timer event with values form 1 to 100. it is working but it is displaying two points as shown in the figure. I have used this code from ESRI samples. Any suggestion please.
public void UpdateCurrentTime(double progress)
{
if (progress <= 0)
progress = 0.05;
else if (progress >= 100)
progress = 0.95;
//Calculate how far into the layer to jump
ITimeDuration offsetToNewCurrentTime = m_myLayerTimeExtent.QueryTimeDuration();
offsetToNewCurrentTime.Scale(progress);
IMxDocument pMxDoc = ArcMap.Document;
IMap pMap = pMxDoc.FocusMap;
IActiveView pActiveView = pMap as IActiveView;
IScreenDisplay pScreenDisplay = pActiveView.ScreenDisplay;
ITimeDisplay pTimeDisplay = pScreenDisplay as ITimeDisplay;
ITime startTime = m_myLayerTimeExtent.StartTime;
ITime endTime = (ITime)((IClone)startTime).Clone();
((ITimeOffsetOperator)endTime).AddDuration(m_layerInterval);
ITimeExtent pTimeExt = new TimeExtentClass();
pTimeExt.SetExtent(startTime, endTime);
pTimeExt.Empty = false;
((ITimeOffsetOperator)pTimeExt).AddDuration(offsetToNewCurrentTime);
pTimeDisplay.TimeValue = pTimeExt as ITimeValue;
pActiveView.Refresh();
}
protected override void OnUpdate()
{
Enabled = true;
}
}
}