示例#1
0
 /// <summary>
 /// 点击分站事件
 /// </summary>
 /// <param name="EventStation"></param>
 void MapGis_StationClick(ZzhaControlLibrary.Station EventStation)
 {
     if (EventStation.StationState == "正常")
     {
         DataTable dt = new Graphics_RealTimeBLL().GetRealTimeInStationByStationInfo(EventStation.StationID,true);
         cpStationHead.CaptionTitle = EventStation.StationName + "  共检测到" + dt.Rows.Count.ToString() + "人";
         dgvRealTime.DataSource = dt;
         pnlRealTime.Visible = true;
         pnlRealTime.Location = Point.Round(EventStation.StationNowPoint);
     }
 }
示例#2
0
 /// <summary>
 /// 点击分站事件
 /// </summary>
 /// <param name="EventStation"></param>
 void MapGis_StationClick(ZzhaControlLibrary.Station EventStation)
 {
     if (ShowStationDgv)
     {
         if (EventStation.StationState == "正常" && EventStation.HasShowed)
         {
             DataTable dt;
             if (isRealTime)
             {
                 dt = new Graphics_RealTimeBLL().GetRealTimeInStationByStationInfo(EventStation.StationID,true);
                 cpStationHead.CaptionTitle = EventStation.StationName + "  共检测到" + dt.Rows.Count.ToString() + "人";
             }
             else
             {
                 dt = ghepb.GetHisStationHeadInfo(hisStartTime, hisEndTime, EventStation.StationID);
                 cpStationHead.CaptionTitle = EventStation.StationName + "  共检测到" + dt.Rows.Count.ToString() + "人次";
             }
             dgvRealTime.DataSource = dt;
             pnlRealTime.Visible = true;
             pnlRealTime.Location = Point.Round(EventStation.StationNowPoint);
         }
     }
 }
示例#3
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;
        }
示例#4
0
 private void AddStatic(XmlNode pntNode, string divname, ZzhaControlLibrary.StaticObject sobj)
 {
     string nodename ="Static" + sobj.StaticPoint.X.ToString() + sobj.StaticPoint.Y.ToString();
     XmlNode node = ConfigXml.SelectSingleNode("//" + nodename);
     if (node != null)
     {
         node.ChildNodes[0].InnerText = node.ChildNodes[0].InnerText + divname+"|";
         node.ChildNodes[2].InnerText = sobj.StaticPoint.X.ToString();
         node.ChildNodes[3].InnerText = sobj.StaticPoint.Y.ToString();
         node.ChildNodes[4].InnerText = sobj.StaticWidth.ToString();
         node.ChildNodes[5].InnerText = sobj.StaticHeight.ToString();
         node.ChildNodes[6].InnerText = sobj.StaticName.ToString();
     }
     else
     {
         node = ConfigXml.CreateElement(nodename);
         XmlNode newnode = ConfigXml.CreateElement("Divname");
         newnode.InnerText = divname+"|";
         node.AppendChild(newnode);
         newnode = ConfigXml.CreateElement("Path");
         newnode.InnerText = sobj.StaticState;
         node.AppendChild(newnode);
         newnode = ConfigXml.CreateElement("X");
         newnode.InnerText = sobj.StaticPoint.X.ToString();
         node.AppendChild(newnode);
         newnode = ConfigXml.CreateElement("Y");
         newnode.InnerText = sobj.StaticPoint.Y.ToString();
         node.AppendChild(newnode);
         newnode = ConfigXml.CreateElement("Width");
         newnode.InnerText = sobj.StaticWidth.ToString();
         node.AppendChild(newnode);
         newnode = ConfigXml.CreateElement("Height");
         newnode.InnerText = sobj.StaticHeight.ToString();
         node.AppendChild(newnode);
         newnode = ConfigXml.CreateElement("Word");
         newnode.InnerText = sobj.StaticName;
         node.AppendChild(newnode);
         newnode = ConfigXml.CreateElement("Key");
         newnode.InnerText = sobj.NameKey;
         node.AppendChild(newnode);
         newnode = ConfigXml.CreateElement("Type");
         newnode.InnerText = sobj.Type.ToString();
         node.AppendChild(newnode);
         newnode = ConfigXml.CreateElement("Font");
         #region[字体]
         string FontName = sobj.StaticFont.Name;
         string FontSize = sobj.StaticFont.Size.ToString();
         string Fontstyle = sobj.StaticFont.Style.ToString();
         string FontColor = sobj.StaticColor.ToArgb().ToString();
         XmlAttribute fontnode = ConfigXml.CreateAttribute("Name");
         fontnode.InnerText = FontName;
         newnode.Attributes.Append(fontnode);
         fontnode = ConfigXml.CreateAttribute("Size");
         fontnode.InnerText = FontSize;
         newnode.Attributes.Append(fontnode);
         fontnode = ConfigXml.CreateAttribute("Style");
         fontnode.InnerText = Fontstyle;
         newnode.Attributes.Append(fontnode);
         newnode.InnerText = FontColor;
         node.AppendChild(newnode);
         #endregion
         pntNode.AppendChild(node);
     }
 }
示例#5
0
 void MapGis_StaticClick(ZzhaControlLibrary.StaticObject EventStaticObj)
 {
     this.EventStaticObject = EventStaticObj;
     if (EventStaticObject.Type == ZzhaControlLibrary.StaticType.Word)
         cmsMenu.Items[1].Visible = false;
     else
         cmsMenu.Items[1].Visible = true;
     cmsMenu.Show(MousePosition);
 }
示例#6
0
 public frmStaticConfig(ZzhaControlLibrary.StaticObject staticobj,ZzhaControlLibrary.ZzhaMapGis mapgis)
 {
     InitializeComponent();
     this.StaticObj = staticobj;
     this.MapGis = mapgis;
 }
示例#7
0
 public frmStaticConfig(ZzhaControlLibrary.StaticObject staticobj)
 {
     InitializeComponent();
     this.StaticObj = staticobj;
 }