private void tsmiWordConfig_Click(object sender, EventArgs e) { if (EventStaticObject != null) { frmWordConfig f; if (EventStaticObject.StaticName == "") f = new frmWordConfig(); else f = new frmWordConfig(EventStaticObject.StaticName, EventStaticObject.NameKey); if (f.ShowDialog() == DialogResult.OK) { if (f.ConfigLab.Text != "") { if (EventStaticObject.StaticImage != null) { EventStaticObject.Type = ZzhaControlLibrary.StaticType.ImageAndWord; } EventStaticObject.StaticName = f.ConfigLab.Text; EventStaticObject.StaticFont = f.ConfigLab.Font; EventStaticObject.StaticColor = f.ConfigLab.ForeColor; EventStaticObject.NameKey = f.Key; } MapGis.FlashAll(); } } }
private void AddSelectedStations() { this.MapGis.ClearAllStation(); DataTable stationinfodt = new Graphics_StationInfoBLL().GetStationInfo(); if (stationinfodt != null && stationinfodt.Rows.Count > 0) { for (int i = 0; i < stationinfodt.Rows.Count; i++) { if (((DataGridViewCheckBoxCell)dgvStations.Rows[i].Cells[0]).Value == ((DataGridViewCheckBoxCell)dgvStations.Rows[i].Cells[0]).TrueValue) { string stationID = stationinfodt.Rows[i][0].ToString() + "." + stationinfodt.Rows[i][1].ToString(); string stationName = stationinfodt.Rows[i][2].ToString(); float stationheadx = float.Parse(stationinfodt.Rows[i][3].ToString()); float stationheady = float.Parse(stationinfodt.Rows[i][4].ToString()); if (System.IO.File.Exists(Application.StartupPath + "\\MapGis\\ShineImage\\Signal.gif")) { this.MapGis.AddStation(stationheadx, stationheady, stationName, stationID, "正常", new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\Signal.gif")); } else { MessageBox.Show("系统提供的图形文件已不存在!", "提示", MessageBoxButtons.OK); return; } } } } MapGis.FalshStations(); MapGis.FalshStatics(); MapGis.FlashMap(); }
private void MapGis_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (lsvImg.Visible) { if (lsvImg.SelectedItems.Count > 0) { PointF p = ZzhaControlLibrary.PositionChanger.PositionChange(new PointF(MapGis.MapX, MapGis.MapY), new PointF(0, 0), e.Location); p = ZzhaControlLibrary.PositionChanger.ZoomPositionChange(Convert.ToDouble(MapGis.OldMapWidth) / Convert.ToDouble(MapGis._MapWidth), p); MapGis.AddStaticObj(p.X, p.Y, new Bitmap(Application.StartupPath + imgFileht[lsvImg.SelectedItems[0].Text].ToString()), imgFileht[lsvImg.SelectedItems[0].Text].ToString(), LastSelectNode.Text, ZzhaControlLibrary.StaticType.Image, Label.DefaultFont, Color.Red); } } if (pnlEmp.Visible) { if (trvRealTime.SelectedNode != null) { if (this.trvRealTime.SelectedNode.Name != "bm" && this.trvRealTime.SelectedNode.Name != "gz" && this.trvRealTime.SelectedNode.Name != "qy" && this.trvRealTime.SelectedNode.Name != "cf") { PointF p = ZzhaControlLibrary.PositionChanger.PositionChange(new PointF(MapGis.MapX, MapGis.MapY), new PointF(0, 0), e.Location); p = ZzhaControlLibrary.PositionChanger.ZoomPositionChange(Convert.ToDouble(MapGis.OldMapWidth) / Convert.ToDouble(MapGis._MapWidth), p); MapGis.AddStaticObj(p.X, p.Y, trvRealTime.SelectedNode.Text, trvRealTime.SelectedNode.Name, LastSelectNode.Text, Label.DefaultFont, Color.Red); } } } } }
private void tsmiDel_Click(object sender, EventArgs e) { if (this.EventStaticObject != null) { MapGis.DelStaticObj(this.EventStaticObject); } }
private void AddSelectedStations() { this.MapGis.ClearAllStation(); DataTable stationinfodt = dpicbll.GetStationHeadByFileID(FileID); if (stationinfodt != null && stationinfodt.Rows.Count > 0) { for (int i = 0; i < stationinfodt.Rows.Count; i++) { //if (dgvStations.Rows[i].Cells[0].Value != null && dgvStations.Rows[i].Cells[0].Value.ToString() == "1") //{ string stationID = stationinfodt.Rows[i][0].ToString() + "." + stationinfodt.Rows[i][1].ToString(); string stationName = stationinfodt.Rows[i][2].ToString(); float stationheadx = float.Parse(stationinfodt.Rows[i][3].ToString()); float stationheady = float.Parse(stationinfodt.Rows[i][4].ToString()); if (System.IO.File.Exists(Application.StartupPath + "\\MapGis\\ShineImage\\Signal.gif")) { this.MapGis.AddStation(stationheadx, stationheady, stationName, stationID, "正常", new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\Signal.gif")); } else { MessageBox.Show("系统提供的图形文件已不存在!", "提示", MessageBoxButtons.OK); return; } //} } } MapGis.FalshStations(); MapGis.FalshStatics(); MapGis.FlashMap(); }
private void tsmiClose_Click(object sender, EventArgs e) { if (!isSaveed) { DialogResult result = MessageBox.Show("是否需要保存该图形系统文件?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { this.lnkSave_LinkClicked(this, new LinkLabelLinkClickedEventArgs(lnkSave.Links[0])); } } isSaveed = true; MapGis.ReSet(); MapGis.Refresh(); InitConfigXml(); LastSelectNode = null; MapConfiged = false; this.picMap.Image = null; this.ntbMax.Text = string.Empty; this.ntbMin.Text = string.Empty; this.trvDiv.Nodes.Clear(); if (IsOut) { this.picInOut_Click(this, new EventArgs()); } this.pnlInOut.Visible = false; }
private void tsmiConfig_Click(object sender, EventArgs e) { if (this.EventStaticObject != null) { frmStaticConfig f = new frmStaticConfig(EventStaticObject, MapGis); f.ShowDialog(); MapGis.FlashAll(); } }
private void LoadMapConfig(XmlDocument configXml,byte[] imgBytes) { this.ClearControls(); MapGis.ReSet(); MapGis.Refresh(); XmlNode MapNode = configXml.SelectSingleNode("//Map"); //map.Save(Application.StartupPath + MapNode.InnerText, System.Drawing.Imaging.ImageFormat.Wmf); try { string filename = MapNode.InnerText.Substring(MapNode.InnerText.LastIndexOf("\\")+1); byte[] buffer = bll.GetBackMapByFileName(filename); if (buffer != null) { CreateFile(Application.StartupPath + MapNode.InnerText, buffer); } else { MessageBox.Show(",该配置文件已经过时...", "提示", MessageBoxButtons.OK); return; } } catch(Exception ex) { MessageBox.Show("读取图形系统配置文件发生错误,可能配置文件未完成或已损坏!", "提示", MessageBoxButtons.OK); } if (MapNode != null) { this.MapFilePath = MapNode.InnerText; try { picMap.Image = CreateBitMap(Application.StartupPath + MapNode.InnerText); } catch (Exception ex) { MessageBox.Show("图形系统中部分图片已经不存在", "提示", MessageBoxButtons.OK); } for (int i = 0; i < MapNode.Attributes.Count; i++) { if (i == 0) ntbMin.Text = MapNode.Attributes[i].InnerText; if (i == 1) ntbMax.Text = MapNode.Attributes[i].InnerText; } } XmlNode DivRoot = configXml.SelectSingleNode("//Divs"); if (DivRoot != null) { if (DivRoot.ChildNodes.Count > 0) { foreach (XmlNode node in DivRoot.ChildNodes) { trvDiv.Nodes.Add(node.InnerText, node.InnerText); } } } }
private void LoadMapConfig(XmlDocument configXml) { this.ClearControls(); MapGis.ReSet(); MapGis.Refresh(); XmlNode MapNode = configXml.SelectSingleNode("//Map"); Image img = null; //map.Save(Application.StartupPath + MapNode.InnerText, System.Drawing.Imaging.ImageFormat.Wmf); try { //CreateFile(Application.StartupPath + MapNode.InnerText, imgBytes); DataTable dt = dpicbll.GetBackPicByFileID(MapNode.InnerText); img = this.BytesToImage((byte[])dt.Rows[0][0]); } catch (Exception ex) { MessageBox.Show("读取图形系统配置文件发生错误,可能配置文件未完成或已损坏!", "提示", MessageBoxButtons.OK); } if (MapNode != null) { try { picMap.Image = img; this.FileID = MapNode.InnerText; this.MapConfiged = true; } catch (Exception ex) { MessageBox.Show("图形系统中部分图片已经不存在", "提示", MessageBoxButtons.OK); } for (int i = 0; i < MapNode.Attributes.Count; i++) { if (i == 0) { ntbMin.Text = MapNode.Attributes[i].InnerText; } if (i == 1) { ntbMax.Text = MapNode.Attributes[i].InnerText; } } } XmlNode DivRoot = configXml.SelectSingleNode("//Divs"); if (DivRoot != null) { if (DivRoot.ChildNodes.Count > 0) { foreach (XmlNode node in DivRoot.ChildNodes) { trvDiv.Nodes.Add(node.InnerText, node.InnerText); } } } }
private void lklLoadMap_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { MapGis.ClearAllStation(); MapGis.ClearAllStatic(); new MapXml().LoadAllMapConfig(ConfigXml, MapGis); if (IsOut) { this.picInOut_Click(this, new EventArgs()); } }
/// <summary> /// 开始移动方法 线程安全 /// </summary> private void MapgisStartMoving() { if (MapGis.InvokeRequired) { MapGis.Invoke(new StartMoving(MapGis.StartMoving)); } else { MapGis.StartMoving(); } }
private void labColor_Click(object sender, EventArgs e) { ColorDialog Cdlg = new ColorDialog(); if (Cdlg.ShowDialog() == DialogResult.OK) { labColor.BackColor = Cdlg.Color; MapGis.MoverStrColor = Cdlg.Color; MapGis.FlashAll(); } }
private void LoadMapConfig(XmlDocument configXml, byte[] imgBytes) { this.ClearControls(); MapGis.ReSet(); MapGis.Refresh(); XmlNode MapNode = configXml.SelectSingleNode("//Map"); //map.Save(Application.StartupPath + MapNode.InnerText, System.Drawing.Imaging.ImageFormat.Wmf); try { CreateFile(Application.StartupPath + MapNode.InnerText, imgBytes); } catch (Exception ex) { MessageBox.Show("读取图形系统配置文件发生错误,可能配置文件未完成或已损坏!", "提示", MessageBoxButtons.OK); } if (MapNode != null) { this.MapFilePath = MapNode.InnerText; try { picMap.Image = new Bitmap(Application.StartupPath + MapNode.InnerText); } catch (Exception ex) { MessageBox.Show("图形系统中部分图片已经不存在", "提示", MessageBoxButtons.OK); } for (int i = 0; i < MapNode.Attributes.Count; i++) { if (i == 0) { ntbMin.Text = MapNode.Attributes[i].InnerText; } if (i == 1) { ntbMax.Text = MapNode.Attributes[i].InnerText; } } } XmlNode DivRoot = configXml.SelectSingleNode("//Divs"); if (DivRoot != null) { if (DivRoot.ChildNodes.Count > 0) { foreach (XmlNode node in DivRoot.ChildNodes) { trvDiv.Nodes.Add(node.InnerText, node.InnerText); } } } }
private bool CanShowMap() { try { //this.MapGis.MapFilePath = Application.StartupPath + MapFilePath; try { DataTable dt = dpicbll.GetBackPicByFileID(FileID); byte[] buffer = (byte[])dt.Rows[0][0]; Graphics.Config.FileChanger fc = new KJ128NMainRun.Graphics.Config.FileChanger(); if (!System.IO.Directory.Exists(Application.StartupPath + "\\MapGis\\DMap")) { System.IO.Directory.CreateDirectory(Application.StartupPath + "\\MapGis\\DMap"); } fc.CreateFile(Application.StartupPath + "\\MapGis\\DMap\\" + dt.Rows[0][1].ToString(), buffer); this.MapGis.MapFilePath = Application.StartupPath + "\\MapGis\\DMap\\" + dt.Rows[0][1].ToString(); System.IO.File.Delete(Application.StartupPath + "\\MapGis\\DMap\\" + dt.Rows[0][1].ToString()); } catch (Exception ex) { MessageBox.Show("无法识别的图片!", "提示", MessageBoxButtons.OK); return(false); } try { if (Convert.ToInt32(ntbMin.Text) > Convert.ToInt32(ntbMax.Text)) { throw new Exception(); } this.MapGis.MinWidth = Convert.ToInt32(ntbMin.Text); this.MapGis.MaxWidth = Convert.ToInt32(ntbMax.Text); } catch (Exception ex) { MessageBox.Show("图层显示范围没有配置或配置不正确,请检查!", "提示", MessageBoxButtons.OK); return(false); } } catch (Exception ex) { MessageBox.Show("存取文件异常!", "提示", MessageBoxButtons.OK); return(false); } AddSelectedStations(); //LoadStatic(); HasMonied = true; MapGis.FlashAll(); pnl2.Visible = true; pnl3.Visible = true; return(true); }
void MapGis_MouseMove(object sender, MouseEventArgs e) { if (EventStaticObject != null) { if (StaticCanMove) { PointF p = ZzhaControlLibrary.PositionChanger.PositionChange(new PointF(MapGis.MapX, MapGis.MapY), new PointF(0, 0), e.Location); p = ZzhaControlLibrary.PositionChanger.ZoomPositionChange(Convert.ToDouble(MapGis.OldMapWidth) / Convert.ToDouble(MapGis._MapWidth), p); this.EventStaticObject.StaticPoint = p; MapGis.FalshStatics(); MapGis.FlashMap(); } } }
private void ClearControls() { this.isSaveed = false; MapGis.ReSet(); MapGis.Refresh(); //InitConfigXml(); LastSelectNode = null; MapFilePath = string.Empty; this.picMap.Image = null; this.ntbMax.Text = string.Empty; this.ntbMin.Text = string.Empty; this.trvDiv.Nodes.Clear(); pnlInOut.Visible = true; if (!IsOut) { this.picInOut_Click(this, new EventArgs()); } }
private void tsmiNew_Click(object sender, EventArgs e) { this.isSaveed = false; MapGis.ReSet(); MapGis.Refresh(); InitConfigXml(); LastSelectNode = null; MapConfiged = false; this.picMap.Image = null; this.ntbMax.Text = string.Empty; this.ntbMin.Text = string.Empty; this.trvDiv.Nodes.Clear(); pnlInOut.Visible = true; if (!IsOut) { this.picInOut_Click(this, new EventArgs()); } }
private void LoadStatic() { XmlNode StaticRoot = ConfigXml.SelectSingleNode("//Statics"); if (StaticRoot != null && StaticRoot.ChildNodes.Count > 0) { foreach (XmlNode staticnode in StaticRoot.ChildNodes) { if (staticnode.ChildNodes[0].InnerText.Contains(LastSelectNode.Text + "|")) { float x = float.Parse(staticnode.ChildNodes[2].InnerText); float y = float.Parse(staticnode.ChildNodes[3].InnerText); string filepath = staticnode.ChildNodes[1].InnerText; string divname = LastSelectNode.Text; int width = int.Parse(staticnode.ChildNodes[4].InnerText); int height = int.Parse(staticnode.ChildNodes[5].InnerText); string name = staticnode.ChildNodes[6].InnerText; string key = staticnode.ChildNodes[7].InnerText; ZzhaControlLibrary.StaticType type = ZzhaControlLibrary.StaticType.ImageAndWord; string fontname = staticnode.ChildNodes[9].Attributes[0].InnerText; float size = float.Parse(staticnode.ChildNodes[9].Attributes[1].InnerText); FontStyle fontstyle = (FontStyle)Enum.Parse(typeof(FontStyle), staticnode.ChildNodes[9].Attributes[2].InnerText); Color FontColor = Color.FromArgb(int.Parse(staticnode.ChildNodes[9].InnerText)); System.Drawing.Font staticFont = new Font(fontname, size, fontstyle); if (staticnode.ChildNodes[8].InnerText == "Image") { type = ZzhaControlLibrary.StaticType.Image; MapGis.AddStaticObj(x, y, new Bitmap(Application.StartupPath + filepath), divname, width, height, filepath, name, key, type, staticFont, FontColor); } if (staticnode.ChildNodes[8].InnerText == "ImageAndWord") { type = ZzhaControlLibrary.StaticType.ImageAndWord; MapGis.AddStaticObj(x, y, new Bitmap(Application.StartupPath + filepath), divname, width, height, filepath, name, key, type, staticFont, FontColor); } if (staticnode.ChildNodes[8].InnerText == "Word") { type = ZzhaControlLibrary.StaticType.Word; MapGis.AddStaticObj(x, y, name, key, divname, staticFont, FontColor); } } } } }
private void tsmiClose_Click(object sender, EventArgs e) { if (!isSaveed) { DialogResult result = MessageBox.Show("是否需要保存该图形系统文件?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { this.lnkSave_LinkClicked(this, new LinkLabelLinkClickedEventArgs(lnkSave.Links[0])); } } isSaveed = true; MapGis.ReSet(); MapGis.Refresh(); InitConfigXml(); LastSelectNode = null; MapFilePath = string.Empty; this.picMap.Image = null; this.ntbMax.Text = string.Empty; this.ntbMin.Text = string.Empty; this.trvDiv.Nodes.Clear(); if(IsOut) { this.picInOut_Click(this, new EventArgs()); } //this.pnlInOut.Visible = false; DataTable dt = bll.GetBackMap(); string SafeFileName = dt.Rows[0][0].ToString(); byte[] buffer = (byte[])dt.Rows[0][1]; SaveBackMap(SafeFileName, buffer); this.picMap.Image = CreateBitMap(Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName); this.MapFilePath = Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName; XmlNode node = ConfigXml.SelectSingleNode("//Map"); if (node != null) { node.InnerText = "\\MapGis\\Map\\" + SafeFileName; } else { XmlNode newnode = ConfigXml.CreateElement("Map"); newnode.InnerText = "\\MapGis\\Map\\" + SafeFileName; RootNode.AppendChild(newnode); } }
private void lsbRTRouteEmp_SelectedIndexChanged(object sender, EventArgs e) { MapGis.ClareMover(); MapGis.StopMoving(); SelectedEmpID = lsbRTRouteEmp.SelectedValue; if (grtb.IsEmpInMine(SelectedEmpID)) { DataRow dr; List <string> list = grtb.GetLastHisStationByEmpID(SelectedEmpID, out dr); FlashMoverDT(dr); if (list != null && list.Count == 5) { this.MapGis.AddMover(list[0], list[1], list[2], list[3], list[4], MoverZFilePath, MoverFFilePath); this.LastMovedPlace = list[2]; this.EmpName = list[4]; this.MapGis.StartRTMoving(); this.ismoving = true; } } }
private void btnLoadRoute_Click(object sender, EventArgs e) { if (MapGis.RouteList.Count == 0) { DataTable stationposition = dpicbll.GetStationPositionByFileID(this.FileID); DataTable routedt = dpicbll.GetRouteInfoPositionByFileID(this.FileID); if (routedt.Rows.Count > 0) { this.MapGis.ClareRouteModelList(); this.MapGis.ClearAllStation(); for (int i = 0; i < stationposition.Rows.Count; i++) { string stationname = stationposition.Rows[i][0].ToString(); PointF p = new PointF(float.Parse(stationposition.Rows[i][1].ToString()), float.Parse(stationposition.Rows[i][2].ToString())); MapGis.AddConfigStation(stationname, p); } for (int i = 0; i < routedt.Rows.Count; i++) { if (i % 2 != 0) { ZzhaControlLibrary.RouteModel rm = new RouteModel(); string from = routedt.Rows[i][0].ToString(); string[] fromxy = from.Split(','); rm.From = new PointF(float.Parse(fromxy[0]), float.Parse(fromxy[1])); string to = routedt.Rows[i][1].ToString(); string[] toxy = to.Split(','); rm.To = new PointF(float.Parse(toxy[0]), float.Parse(toxy[1])); rm.RouteLength = int.Parse(routedt.Rows[i][2].ToString()); MapGis.AddConfigRouteModel(rm); } } MapGis.FlashAll(); this.btnCreate.Enabled = true; this.btnLoadRoute.Enabled = false; } else { MessageBox.Show("您尚未配置过路径,无法载入上次路径配置信息...", "提示", MessageBoxButtons.OK); } } }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { if (Convert.ToInt32(ntbMin.Text) > Convert.ToInt32(ntbMax.Text)) { throw new Exception(); } this.MapGis.MinWidth = Convert.ToInt32(ntbMin.Text); this.MapGis.MaxWidth = Convert.ToInt32(ntbMax.Text); this.MapGis.MapFilePath = Application.StartupPath + MapFilePath; } catch (Exception ex) { MessageBox.Show("图层显示范围没有配置或配置不正确,请检查!", "提示", MessageBoxButtons.OK); return; } AddSelectedStations(); LoadStatic(); HasMonied = true; MapGis.FlashAll(); }
private void 载入路径LToolStripMenuItem_Click(object sender, EventArgs e) { if (MapGis.RouteList.Count == 0) { DataTable stationposition = new Graphics_RouteBLL().GetStationHeadPosition(); DataTable routedt = new Graphics_RouteBLL().GetAllRoute(); if (routedt.Rows.Count > 0) { this.MapGis.ClareRouteModelList(); this.MapGis.ClearAllStation(); for (int i = 0; i < stationposition.Rows.Count; i++) { string stationname = stationposition.Rows[i][0].ToString(); PointF p = new PointF(float.Parse(stationposition.Rows[i][1].ToString()), float.Parse(stationposition.Rows[i][2].ToString())); MapGis.AddConfigStation(stationname, p); } for (int i = 0; i < routedt.Rows.Count; i++) { ZzhaControlLibrary.RouteModel rm = new RouteModel(); string from = routedt.Rows[i][0].ToString(); string[] fromxy = from.Split(','); rm.From = new PointF(float.Parse(fromxy[0]), float.Parse(fromxy[1])); string to = routedt.Rows[i][1].ToString(); string[] toxy = to.Split(','); rm.To = new PointF(float.Parse(toxy[0]), float.Parse(toxy[1])); rm.RouteLength = int.Parse(routedt.Rows[i][2].ToString()); MapGis.AddConfigRouteModel(rm); } MapGis.FlashAll(); } else { MessageBox.Show("您尚未配置过路径,无法载入上次路径配置信息...", "提示", MessageBoxButtons.OK); } } }
/// <summary> /// 窗体载入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmRealTime_Load(object sender, EventArgs e) { try { trvRealTime.Nodes.Add("qy", "按区域划分"); trvRealTime.Nodes.Add("gz", "按工种划分"); trvRealTime.Nodes.Add("bm", "按部门划分"); pnlRealTime.Visible = false; LoadGisMapInfo(); if (System.IO.File.Exists(MapFilePath)) { this.MapGis.MapFilePath = MapFilePath; this.MapGis.StationFilePath = StationFilePath; } else { MessageBox.Show("您所配置的图形已经失效,请重新配置后使用..", "提示", MessageBoxButtons.OK); return; } if (isConfiged) { DataTable stationinfodt = new Graphics_StationInfoBLL().GetStationInfo(); if (stationinfodt != null && stationinfodt.Rows.Count > 0) { try { for (int i = 0; i < stationinfodt.Rows.Count; i++) { string stationID = stationinfodt.Rows[i][0].ToString() + "." + stationinfodt.Rows[i][1].ToString(); string stationName = stationinfodt.Rows[i][2].ToString(); float stationheadx = float.Parse(stationinfodt.Rows[i][3].ToString()); float stationheady = float.Parse(stationinfodt.Rows[i][4].ToString()); string stationstate = stationinfodt.Rows[i][5].ToString(); if (this.StationFilePath != null && this.StationFilePath != "") { if (stationstate == "正常") { this.MapGis.AddStation(stationheadx, stationheady, stationName, stationID, "正常", new Bitmap(StationFilePath)); } if (stationstate == "故障") { this.MapGis.AddStation(stationheadx, stationheady, stationName, stationID, stationstate, new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\No-Signal.gif")); } if (stationstate == "休眠") { this.MapGis.AddStation(stationheadx, stationheady, stationName, stationID, stationstate, new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\Station.GIF")); } } } MapGis.FalshStations(); } catch (Exception ex) { MessageBox.Show("图形系统中部分图片已经不存在", "提示", MessageBoxButtons.OK); } } IsOut = true; LoadRealTimeInfo(); IsOut = false; FlashTimer = new Timer(); FlashTimer.Interval = 5000; FlashTimer.Tick += new EventHandler(t_Tick); FlashTimer.Start(); } } catch (ArgumentException ex) { MessageBox.Show("您所配置的图形已经失效,请重新配置后使用..", "提示", MessageBoxButtons.OK); } }
private void frmRealTimeRoute_Load(object sender, EventArgs e) { try { LoadGisMapInfo(); LoadRTempInfo(); this.pnlRTRoute.Left = 0 - picRTRouteInOut.Left; if (System.IO.File.Exists(MapFilePath)) { this.MapGis.MapFilePath = MapFilePath; this.MapGis.StationFilePath = StationFilePath; this.MapGis.MinWidth = 500; this.MapGis.MaxWidth = 20000; } else { MessageBox.Show("您所配置的图形已经失效,请重新配置后使用..", "提示", MessageBoxButtons.OK); return; } if (isConfiged) { DataTable stationinfodt = new Graphics_StationInfoBLL().GetStationInfo(); if (stationinfodt != null && stationinfodt.Rows.Count > 0) { try { for (int i = 0; i < stationinfodt.Rows.Count; i++) { string stationID = stationinfodt.Rows[i][0].ToString() + "." + stationinfodt.Rows[i][1].ToString(); string stationName = stationinfodt.Rows[i][2].ToString(); float stationheadx = float.Parse(stationinfodt.Rows[i][3].ToString()); float stationheady = float.Parse(stationinfodt.Rows[i][4].ToString()); string stationstate = stationinfodt.Rows[i][5].ToString(); if (this.StationFilePath != null && this.StationFilePath != "") { if (stationstate == "正常") { this.MapGis.AddStation(stationheadx, stationheady, stationName, stationID, "正常", new Bitmap(StationFilePath)); } if (stationstate == "故障") { this.MapGis.AddStation(stationheadx, stationheady, stationName, stationID, stationstate, new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\No-Signal.gif")); } if (stationstate == "休眠") { this.MapGis.AddStation(stationheadx, stationheady, stationName, stationID, stationstate, new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\Station.GIF")); } } } MapGis.FalshStations(); } catch (Exception ex) { MessageBox.Show("图形系统中部分图片已经不存在", "提示", MessageBoxButtons.OK); } } } this.cmbRTRouteSpeed.SelectedIndex = 0; pnlRTRoute.Visible = true; this.MapGis.MoveEnded += new ZzhaControlLibrary.ZzhaMapGis.MoveingEnd(MapGis_MoveEnded); Timer t = new Timer(); t.Interval = 10000; t.Tick += new EventHandler(t_Tick); t.Start(); } catch (Exception ex) { MessageBox.Show("图形及轨迹尚未配置完成,请配置后再使用!", "提示", MessageBoxButtons.OK); return; } }