Beispiel #1
0
 private void frmDivConfig_Load(object sender, EventArgs e)
 {
     if (this.LastSelectNode != null)
         txtDivName.Text = LastSelectNode.Text;
     DataTable stationdt = new Graphics_StationInfoBLL().GetStationInfo();
     for (int i = 0; i < stationdt.Columns.Count; i++)
     {
         if (stationdt.Columns[i].ColumnName != "StationHeadPlace")
         {
             stationdt.Columns.RemoveAt(i);
             i--;
         }
     }
     this.dgvStations.DataSource = stationdt;
     LoadDivConfig();
     LoadOtherImage(); 
     LoadRealTimeInfo();
 }
Beispiel #2
0
        public bool LoadAllMapConfig(XmlDocument xmldoc, ZzhaControlLibrary.ZzhaMapGis mapgis)
        {
            //MapGis.ClearAllStation();
            //MapGis.ClearAllStatic();
            XmlNode MapNode = xmldoc.SelectSingleNode("//Map");            
            if (MapNode.Attributes.Count == 0)
            {
                MessageBox.Show("全图范围尚未配置,请先配置全图范围后再模拟全图", "提示", MessageBoxButtons.OK);
                return false;
            }
            //mapgis.MapFilePath = Application.StartupPath + MapNode.InnerText;
            try
            {
                DataTable dt = dpicbll.GetBackPicByFileID(MapNode.InnerText);
                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);
                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;
            }
            mapgis.MinWidth = int.Parse(MapNode.Attributes["MinWidth"].InnerText);
            mapgis.MaxWidth = int.Parse(MapNode.Attributes["MaxWidth"].InnerText);
            XmlNode DivRoot = xmldoc.SelectSingleNode("//Divs");
            foreach (XmlNode divnode in DivRoot)
            {
                mapgis.AddDiv(divnode.InnerText, int.Parse(divnode.Attributes["MinWidth"].InnerText), int.Parse(divnode.Attributes["MaxWidth"].InnerText));
            }
            //加到DIV结束
            XmlNode StaticRoot = xmldoc.SelectSingleNode("//Statics");
            if (StaticRoot != null && StaticRoot.ChildNodes.Count > 0)
            {
                foreach (XmlNode staticnode in StaticRoot.ChildNodes)
                {
                    float x = float.Parse(staticnode.ChildNodes[2].InnerText);
                    float y = float.Parse(staticnode.ChildNodes[3].InnerText);
                    string filepath =staticnode.ChildNodes[1].InnerText;
                    string divname = staticnode.ChildNodes[0].InnerText;
                    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);
                    }
                }
            }
            XmlNode StationRoot = xmldoc.SelectSingleNode("//Stations");
            if (StationRoot != null && StationRoot.ChildNodes.Count > 0)
            {
                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();
                            XmlNode stationnode = xmldoc.GetElementById(stationName);
                            if (stationnode != null)
                            {
                                string stationdivname = stationnode.InnerText;

                                if (stationstate == "正常" || stationstate == "未初始化")
                                    mapgis.AddStation(stationheadx, stationheady, stationName, stationID, "正常", new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\Signal.gif"), stationdivname);
                                if (stationstate == "故障")
                                    mapgis.AddStation(stationheadx, stationheady, stationName, stationID, stationstate, new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\No-Signal.gif"), stationdivname);
                                if (stationstate == "休眠")
                                    mapgis.AddStation(stationheadx, stationheady, stationName, stationID, stationstate, new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\Station.GIF"), stationdivname);

                            }
                        }
                        mapgis.FalshStations();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("图形系统中部分图片已经不存在", "提示", MessageBoxButtons.OK);
                        return false;
                    }
                }
            }
            mapgis.FlashAll();
            return true;
        }
        private void FlashStationInfo()
        {
            if (!IsHis)
            {
                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();
                            string empnum;
                            if (isRealTime)
                            {
                                try
                                {
                                    empnum = "共" + new Graphics_RealTimeBLL().GetRealTimeInStationByStationInfo(stationID,chkMine.Checked).Rows.Count.ToString() + "人";
                                }
                                catch (Exception ex)
                                {
                                    empnum = "共0人";
                                }
                            }
                            else
                                empnum = "共" + ghepb.GetHisStationHeadEmpNum(hisStartTime, hisEndTime, stationID) + "人次";
                            if (this.StationFilePath != null && this.StationFilePath != "")
                            {
                                if (stationstate == "正常")
                                    this.MapGis.ChangeStationState(stationID, stationstate, empnum, new Bitmap(StationFilePath));
                                if (stationstate == "故障")
                                    this.MapGis.ChangeStationState(stationID, stationstate, empnum, new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\No-Signal.gif"));
                                if (stationstate == "休眠")
                                    this.MapGis.ChangeStationState(stationID, stationstate, empnum, new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\Station.GIF"));
                            }
                        }
                        for (int i = 0; i < MapGis.StaticList.Count; i++)
                        {
                            if (MapGis.StaticList[i].Type != ZzhaControlLibrary.StaticType.Image)
                            {
                                string key = MapGis.StaticList[i].NameKey;
                                try
                                {
                                    if (key == "zong")
                                    {
                                        MapGis.StaticList[i].StaticName = labTitle.Text;
                                    }
                                    else
                                    {

                                        if (key != "null")
                                        {
                                            if (key.Substring(0, 2) == "cf")
                                            {
                                                string text = trvStation.Nodes[key.Substring(0, 2)].Nodes[key].Text;
                                                MapGis.StaticList[i].StaticName = text;
                                            }
                                            else
                                            {
                                                string text = trvRealTime.Nodes[key.Substring(0, 2)].Nodes[key].Text;
                                                MapGis.StaticList[i].StaticName = text;
                                            }
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    MapGis.StaticList[i].StaticName = "已失效";
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        return;
                    }
                }
            }
        }
 private void LoadRealTimeStation()
 {
     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);
         }
     }
 }
 private void LoadHisInfo()
 {
     try
     {
         dtpStart.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
         dtpEnd.Value = DateTime.Now;
         //LoadGisMapInfo();
         //if (System.IO.File.Exists(MapFilePath))
         //{
         //    this.MapGis.MapFilePath = MapFilePath;
         //    this.MapGis.StationFilePath = StationFilePath;
         //}
         //else
         //{
         //    MessageBox.Show("您所配置的图形已经失效,请重新配置后使用..", "提示", MessageBoxButtons.OK);
         //    return;
         //}
         //this.MapGis.UseGif = true;
         DataTable stationinfodt = new Graphics_StationInfoBLL().GetStationInfo();
         if (stationinfodt != null && stationinfodt.Rows.Count > 0)
         {
             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());
                 //if (StationFilePath != null && StationFilePath != "")
                 //    this.MapGis.AddStation(stationheadx, stationheady, stationName, stationID, "正常", new Bitmap(StationFilePath));
                 this.MapGis.ChangeStationState(stationID,"正常","",new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\Signal.gif"));
             }
             this.MapGis.FalshStations();
         }
         BanDeptDt = new Graphics_RealTimeBLL().GetAllDept();
         if (BanDeptDt != null && BanDeptDt.Rows.Count > 0)
         {
             if (cmbDept.Items.Count > 0)
             {
                 cmbDept.Items.Clear();
             }
             if (cmbBanDept.Items.Count > 0)
             {
                 cmbBanDept.Items.Clear(); 
             }
             cmbDept.Items.Add("全部部门");
             cmbDept.SelectedIndex = 0;
             for (int i = 0; i < BanDeptDt.Rows.Count; i++)
             {
                 cmbDept.Items.Add(BanDeptDt.Rows[i][0]);
             }
             for (int i = 0; i < BanDeptDt.Rows.Count; i++)
             {
                 cmbBanDept.Items.Add(BanDeptDt.Rows[i][0]);
             }
             cmbBanDept.SelectedIndex = 0;
             cmbSpeed.SelectedIndex = 0;
         }
         this.MapGis.MoveEnded += new ZzhaControlLibrary.ZzhaMapGis.MoveingEnd(MapGis_MoveEnded);
         EmpDt = new Graphics_RealTimeBLL().GetAllEmp();
     }
     catch (ArgumentException ex)
     {
         MessageBox.Show("您所配置的图形已经失效,请重新配置后使用..", "提示", MessageBoxButtons.OK);
     }
 }
Beispiel #6
0
 /// <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);
     }
 }
Beispiel #7
0
 private void FlashStationInfo()
 {
     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();
                 string empnum = "共" + new Graphics_RealTimeBLL().GetRealTimeInStationByStationInfo(stationID,true).Rows.Count.ToString() + "人";
                 if (this.StationFilePath != null && this.StationFilePath != "")
                 {
                     if (stationstate == "正常")
                         this.MapGis.ChangeStationState(stationID, stationstate, empnum, new Bitmap(StationFilePath));
                     if (stationstate == "故障")
                         this.MapGis.ChangeStationState(stationID, stationstate, empnum, new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\No-Signal.gif"));
                     if (stationstate == "休眠")
                         this.MapGis.ChangeStationState(stationID, stationstate, empnum, new Bitmap(Application.StartupPath + "\\MapGis\\ShineImage\\Station.GIF"));
                 }
             }
         }
         catch (Exception ex)
         {
             return;
         }
     }
 }
 /// <summary>
 /// 窗体载入
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FrmHistroyRoute_Load(object sender, EventArgs e)
 {
     try
     {
         dtpStart.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
         LoadGisMapInfo();
         if (System.IO.File.Exists(MapFilePath))
         {
             this.MapGis.MapFilePath = MapFilePath;
             this.MapGis.StationFilePath = StationFilePath;
         }
         else
         {
             MessageBox.Show("您所配置的图形已经失效,请重新配置后使用..", "提示", MessageBoxButtons.OK);
             return;
         }
         //this.MapGis.UseGif = true;
         DataTable stationinfodt = new Graphics_StationInfoBLL().GetStationInfo();
         if (stationinfodt != null && stationinfodt.Rows.Count > 0)
         {
             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());
                 if (StationFilePath != null && StationFilePath != "")
                     this.MapGis.AddStation(stationheadx, stationheady, stationName, stationID,"正常", new Bitmap(StationFilePath));
             }
             this.MapGis.FalshStations();
         }
         BanDeptDt = new Graphics_RealTimeBLL().GetAllDept();
         if (BanDeptDt != null && BanDeptDt.Rows.Count > 0)
         {
             cmbDept.Items.Add("全部部门");
             cmbDept.SelectedIndex = 0;
             for (int i = 0; i < BanDeptDt.Rows.Count; i++)
             {
                 cmbDept.Items.Add(BanDeptDt.Rows[i][0]);
             }
             for (int i = 0; i < BanDeptDt.Rows.Count; i++)
             {
                 cmbBanDept.Items.Add(BanDeptDt.Rows[i][0]);
             }
             cmbBanDept.SelectedIndex = 0;
             cmbSpeed.SelectedIndex = 0;
         }
         this.MapGis.MoveEnded += new ZzhaControlLibrary.ZzhaMapGis.MoveingEnd(MapGis_MoveEnded);
         EmpDt = new Graphics_RealTimeBLL().GetAllEmp();
     }
     catch (ArgumentException ex)
     {
         MessageBox.Show("您所配置的图形已经失效,请重新配置后使用..", "提示", MessageBoxButtons.OK);
     }
 }
 private void FrmRouteConfig_Load(object sender, EventArgs e)
 {
     try
     {
         OpenFileDialog ofd = new OpenFileDialog();
         ofd.InitialDirectory = Application.StartupPath + "\\MapGis\\Map";
         ofd.Filter = "所有图片文件(*.wmf;*.bmp;*.gif;*.jpg)|*.wmf;*.bmp;*.gif;*.jpg|图元(*.wmf)|*.wmf|位图(*.bmp)|*.bmp|动态图片(*.gif)|*.gif|静态图片(*.jpg)|*.jpg";
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             string SafeFileName = ofd.FileName.Substring(ofd.FileName.LastIndexOf("\\") + 1);
             if (!System.IO.Directory.Exists(Application.StartupPath + "\\MapGis\\Map"))
                 System.IO.Directory.CreateDirectory(Application.StartupPath + "\\MapGis\\Map");
             if (System.IO.File.Exists(Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName))
             {
                 if ((Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName) != ofd.FileName)
                 {
                     if (MessageBox.Show("文件已经存在,是否替换?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                     {
                         System.IO.File.Delete(Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName);
                         System.IO.File.Copy(ofd.FileName, Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName);
                     }
                 }
             }
             else
             {
                 System.IO.File.Copy(ofd.FileName, Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName);
             }
             try
             {
                 this.MapFilePath = Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName;
                 XmlDocument xmldoc = new XmlDocument();
                 XmlDeclaration xmldec = xmldoc.CreateXmlDeclaration("1.0", "", "yes");
                 xmldoc.AppendChild(xmldec);
                 XmlNode rootnode = xmldoc.CreateElement("Config");
                 XmlNode node = xmldoc.CreateElement("底图");
                 node.InnerText = SafeFileName;
                 rootnode.AppendChild(node);
                 xmldoc.AppendChild(rootnode);
                 xmldoc.Save(Application.StartupPath + "\\MapGis\\GraphicsConfig.xml");
             }
             catch (Exception ex)
             {
                 SetBtnEnabel(false);
                 MessageBox.Show("无法识别的图片!", "提示", MessageBoxButtons.OK);
                 return;
             }
         }
         else
         {
             //this.Close();
             this.btnRollback.Enabled = false;
             this.btnSave.Enabled = false;
             this.btnCreate.Enabled = false;
             return;
         }
         if (System.IO.File.Exists(MapFilePath))
         {
             this.MapGis.MapFilePath = MapFilePath;
             this.MapGis.StationFilePath = StationFilePath;
         }
         else
         {
             SetBtnEnabel(false);
             MessageBox.Show("您所配置的图形加载失败,请重新配置后使用..", "提示", MessageBoxButtons.OK);
             return;
         }
         if (isConfiged)
         {
             DataTable stationdt = new Graphics_StationInfoBLL().GetStationInfo();
             if (stationdt != null && stationdt.Rows.Count > 0)
             {
                 AddStationToMapGis(stationdt);
             }
             this.MapGis.StartSetting();
         }
     }
     catch (ArgumentException ex)
     {
         SetBtnEnabel(false);
         MessageBox.Show("您所配置的图形加载失败,请重新配置后使用..", "提示", MessageBoxButtons.OK);
     }
 }
Beispiel #10
0
 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();
 }
Beispiel #11
0
 private void A_frmDivConfig_Shown(object sender, EventArgs e)
 {
     dmc.Add(pnlInOut, true);
     dmc.Add(pnlPic);
     dmc.Add(pnlWord);
     dmc.LeftPartResize();
     if (this.LastSelectNode != null)
         txtDivName.Text = LastSelectNode.Text;
     DataTable stationdt = new Graphics_StationInfoBLL().GetStationInfo();
     for (int i = 0; i < stationdt.Columns.Count; i++)
     {
         if (stationdt.Columns[i].ColumnName != "StationHeadPlace")
         {
             stationdt.Columns.RemoveAt(i);
             i--;
         }
     }
     this.dgvStations.DataSource = stationdt;
     LoadDivConfig();
     LoadOtherImage();
     LoadRealTimeInfo();
     fcc.DockState = Wilson.Controls.Docking.DockState.Hidden;
 }
 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;
     }
 }
 private void btnUseMap_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("如果您使用新的底图,将会对您已配置的路径和图形配置文件产生影响,你确定要使用?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             string SafeFileName = txtFilePath.Text.Substring(txtFilePath.Text.LastIndexOf("\\") + 1);
             System.IO.FileStream fs = new System.IO.FileStream(txtFilePath.Text, System.IO.FileMode.Open);
             byte[] buffer = new byte[fs.Length];
             fs.Read(buffer, 0, buffer.Length);
             fs.Close();
             bll.InsertBackMap(SafeFileName, buffer);
             buffer = bll.GetBackMapByFileName(SafeFileName);
             if (SaveBackMap(SafeFileName, buffer))
             {
                 MapFilePath = Application.StartupPath + "\\MapGis\\Map\\" + SafeFileName;
                 MapGis.StationFilePath = StationFilePath;
                 MapGis.MapFilePath = MapFilePath;
             }
             else
             {
                 SetBtnEnabel(false);
                 MessageBox.Show("无法识别的图片!", "提示", MessageBoxButtons.OK);
             }
             DataTable stationdt = new Graphics_StationInfoBLL().GetStationInfo();
             if (stationdt != null && stationdt.Rows.Count > 0)
             {
                 AddStationToMapGis(stationdt);
             }
             this.MapGis.StartSetting();
             SetBtnEnabel(true);
         }
     }
     catch (Exception ex)
     {
         SetBtnEnabel(false);
         MessageBox.Show("无法识别的图片!", "提示", MessageBoxButtons.OK);
     }
     
 }