/// <summary> /// 演示中被挂载在obj开始编辑事件中,产生objshallenddemo事件让外部停止演示 /// </summary> /// <param name="ObjectID"></param> /// <param name="Action"></param> public void planestartedit(string ObjectID, IAction65 Action) { //开始编辑事件 if ((Action.Code == ActionCode.AC_EDIT_STARTED)&& ((ObjectID == this.Tplaneobj.ID)|| ((ObjectID == this.Rplaneobj.ID)))) { if (Tplaneobj.Pause == false)//在演示中 { endscandemo(); SARSYS.objshallenddemo(SARSYS.SARsyslist.IndexOf(this)); } } }
/// <summary> /// plane编辑完成后重新编辑一下各个obj,挂载在编辑完成事件上 /// </summary> /// <param name="ObjectID"></param> /// <param name="Action"></param> public void planeedit(string ObjectID, IAction65 Action) { //编辑完成事件,只对飞机编辑完成事件触发 if ((Action.Code == ActionCode.AC_EDIT_FINISHED)&& ((ObjectID == this.Tplaneobj.ID)|| ((ObjectID == this.Rplaneobj.ID)))) { //开始编辑事件会让所有演示停止 updataradar(); //更新雷达扫描区域显示 //wholescanarea[0].Geometry不可在onframe事件中更新后同时在编辑完成事件中又被更新 //应保证编辑时没有在演示 clearradararea(); newradararea(); //更新飞机尾迹 newtrack(); } }
/// <summary> /// 飞机到达waypoint时触发的事件 /// 注意,此事件处理函数是在演示中被触发,因此要做好同步措施(lock) /// 处理track,处理wholescanarea /// </summary> /// <param name="ObjectID"></param> /// <param name="Action"></param> public void planereachwaypoint(string ObjectID, IAction65 Action) { if(Action.Code==ActionCode.AC_WAYPOINT_REACHED) { if (ObjectID == this.Tplaneobj.ID)//发射机 { //编辑已飞行轨迹 ILineString tmplinestr; lock (Tplanetrack.Geometry) { tmplinestr = (ILineString)Tplanetrack.Geometry; tmplinestr.StartEdit(); tmplinestr.EndPoint.X = Tplaneobj.Position.X; tmplinestr.EndPoint.Y = Tplaneobj.Position.Y; tmplinestr.EndPoint.Z = Tplaneobj.Position.Altitude; tmplinestr.Points.AddPoint(Tplaneobj.Position.X, Tplaneobj.Position.Y, Tplaneobj.Position.Altitude); tmplinestr.EndEdit(); } } else if (ObjectID == this.Rplaneobj.ID)//接收机 { ILineString tmplinestr; lock (Rplanetrack.Geometry) { tmplinestr = (ILineString)Rplanetrack.Geometry; tmplinestr.StartEdit(); tmplinestr.EndPoint.X = Rplaneobj.Position.X; tmplinestr.EndPoint.Y = Rplaneobj.Position.Y; tmplinestr.EndPoint.Z = Rplaneobj.Position.Altitude; tmplinestr.Points.AddPoint(Rplaneobj.Position.X, Rplaneobj.Position.Y, Rplaneobj.Position.Altitude); tmplinestr.EndEdit(); } //强制迅速转弯,编辑已扫描区域 lock(wholescanarea) { IRouteWaypoint65 tmpwaypoint = (IRouteWaypoint65)Rplaneobj.Waypoints[Rplaneobj.Waypoints.Current + 1]; IPosition65 tmppos = sgworld.Creator.CreatePosition(tmpwaypoint.X, tmpwaypoint.Y, tmpwaypoint.Altitude, Rplaneobj.AltitudeType); Rplaneobj.Position = Rplaneobj.Position.AimTo(tmppos); updataradar(); initradararea(Rplaneobj.Waypoints.Current); } } } }
/// <summary> /// 挂在删除group事件上 /// 只有结束演示后才可以删除 /// </summary> /// <param name="del_id"></param> /// <param name="actcode"></param> public void groupdel(string del_id, IAction65 actcode) { if ((actcode.Code == ActionCode.AC_DELETE) && (del_id==groupid))//这个group被删了 { sgworld.OnObjectAction -= planestartedit; sgworld.OnProjectTreeAction -= this.groupdel; sgworld.OnObjectAction -= this.planeedit; sgworld.OnFrame -= sgworld_OnFrame_wave; SARsyslist.Remove(this); SARSYS.sarsysnumchanged(SARSYS.SARsyslist.IndexOf(this)); } }