为什么飞行路线停止站点名显示为初始站点名?调试时查看飞行路线站点信息时发现站点信息包括“原始视图”(在m_flyManager.Routes.CurrentRoute.Stops的属性中找到m_RouteStops),为什么会存在“原始视图”?
private void MainForm_Load(object sender, EventArgs e)
{
//计时器 SceneTimerTickHandler事件20毫秒更新一次
m_sceneControl.Scene.Timer.Tick += new EventHandler(SceneTimerTickHandler);
}
private void SceneTimerTickHandler(object sender, EventArgs e)
{
if (m_flyManager.Routes.CurrentRouteIndex != 0) return;
FormMain form = (FormMain)m_sceneControl.Parent.Parent;
if (form == null) return;
RouteStops stops =m_flyManager.Routes.CurrentRoute.Stops;
int nIndex = m_flyManager.CurrentStopIndex;
if(nIndex >= 0 && nIndex <stops.Count)
{ //strStopName--stops--nIndex--CurrentStopIndex
string strStopName = stops[nIndex].Name;
if( !StrIsInt(strStopName) )
{
form.m_LabelCurrStop.Visible = true;
form.m_LabelCurrStop.Text = "您的当前位置:" + strStopName;
}
else
{
form.m_LabelCurrStop.Visible = false;
}
}
}
//判断站点名字是否为数字,若站点为数字则不显示该站点
public static bool StrIsInt(string Str)
{
bool flag = true;
if (Str != "")
{
for (int i = 0; i < Str.Length; i++)
{
if (!Char.IsNumber(Str, i))
{
flag = false;
break;
}
}
}
else
{
flag = false;
}
return flag;
}