Ejemplo n.º 1
0
        /// <summary>
        /// 刷新地图
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="args"></param>
        private void ImageTimer_Tick(Object obj, EventArgs args)
        {
            if (null == MyArea.AreaBitMap || null == MyArea.AreaBitMap.MyBitmap)
            {
                return;
            }

            ImageBitmap = new Bitmap(MyArea.AreaBitMap.MyBitmap, ImagePanel.Width, ImagePanel.Height);

            //if (scalew < scaleh)
            //{
            //    ImageBitmap = new Bitmap(MyArea.AreaBitMap.MyBitmap, ImagePanel.Width, (int)(ConstInfor.MapHeight * scalew));
            //}
            //else
            //{
            //    ImageBitmap = new Bitmap(MyArea.AreaBitMap.MyBitmap, (int)(scaleh * ImagePanel.Width), ImagePanel.Height);
            //}
            DrawAreaMap.DrawBasicRouter(ImageBitmap, StrAreaID, 1, scalew, scaleh);
            RtAroundTagPlace.ClearAreaAllRouterStand(MyArea);
            IEnumerable <KeyValuePair <string, TagPack> > TEMP =
                CommonCollection.TagPacks.Reverse <KeyValuePair <string, TagPack> >();

            try{
                foreach (KeyValuePair <string, TagPack> tp in TEMP)
                {
                    if (null == tp.Value)
                    {
                        continue;
                    }
                    //判断Tag是否在当前区域中
                    if (CommonBoxOperation.JudgeTagArea(tp.Key, StrAreaID))
                    {
                        RtAroundTagPlace.Num         = CommonBoxOperation.GetRouterAroundNum(tp.Value.RD_New[0].ToString("X2") + tp.Value.RD_New[1].ToString("X2"));
                        RtAroundTagPlace.CurImageTag = tp.Value;
                        if (ImageBitmap == null)
                        {
                            continue;
                        }
                        RtAroundTagPlace.DrawTag3_Place(ImageBitmap, scalew, scaleh);
                    }
                }
            }catch (Exception)
            {
            }
            ImagePanel_Paint(null, null);
        }
Ejemplo n.º 2
0
        public void DrawTimer_Tick(Object obj, EventArgs args)
        {
            StartDTe    = StartDTe.AddMilliseconds(1000);//每次增加1s
            label7.Text = "當前時間:" + StartDTe.ToString();
            if (CurIndex >= PickTags.Length)
            {
                Stop();
                return;
            }
            float scalew, scaleh;

            if (DateTime.Compare(StartDTe, PickTags[CurIndex].ReportTime) >= 0)
            {//画出当前的地图
                string StrTagID    = PickTags[CurIndex].TD[0].ToString("X2") + PickTags[CurIndex].TD[1].ToString("X2");
                string StrRouterID = PickTags[CurIndex].RD_New[0].ToString("X2") + PickTags[CurIndex].RD_New[1].ToString("X2");
                Area   CurArea     = CommonBoxOperation.GetAreaFromRouterID(StrRouterID);
                if (CurArea != null)
                {
                    if (null == CurArea.Name || "".Equals(CurArea.Name))
                    {
                        CurAreaLabel.Text = "當前區域:" + CurArea.ID[0].ToString("X2") + CurArea.ID[1].ToString("X2");
                    }
                    else
                    {
                        CurAreaLabel.Text = "當前區域:" + CurArea.Name + "(" + CurArea.ID[0].ToString("X2") + CurArea.ID[1].ToString("X2") + ")";
                    }
                    BasicRouter CurBasic = CommonBoxOperation.GetBasicRouter(StrRouterID);
                    CurBasic.isReport = true;
                    string StrTagInfor = "";
                    string StrTagName  = CommonBoxOperation.GetTagName(StrTagID);
                    if (null == StrTagName || "".Equals(StrTagName))
                    {
                        StrTagInfor = StrTagID;
                    }
                    else
                    {
                        StrTagInfor = StrTagName + "(" + StrTagID + ")";
                    }

                    scalew   = (float)TrackPanel.Width / CurArea.AreaBitMap.MyBitmap.Width;
                    scaleh   = (float)TrackPanel.Height / CurArea.AreaBitMap.MyBitmap.Height;
                    TrackBtm = new Bitmap(655, 358);
                    TrackBtm = new Bitmap(CurArea.AreaBitMap.MyBitmap, TrackPanel.Width, TrackPanel.Height);
                    //画Router的信息
                    DrawAreaMap.DrawBasicRouter(TrackBtm, CurArea.ID[0].ToString("X2") + CurArea.ID[1].ToString("X2"), 1, scalew, scaleh);
                    //画Tag的信息
                    if (null != CurBasic)
                    {
                        if (PickTags[CurIndex].isAlarm == 0x03)
                        {
                            Graphics.FromImage(TrackBtm).FillEllipse(SimpleBrush, CurBasic.x * scalew - 8, CurBasic.y * scaleh - 32, ConstInfor.TagR * 2, ConstInfor.TagR * 2);
                            Graphics.FromImage(TrackBtm).DrawString(StrTagInfor, new Font("宋体", 10), SimpleBrush, CurBasic.x * scalew - 5, CurBasic.y * scaleh - 42);
                        }
                        else if (PickTags[CurIndex].isAlarm == 0x04)
                        {
                            Graphics.FromImage(TrackBtm).FillEllipse(AlarmBrush, CurBasic.x * scalew - 8, CurBasic.y * scaleh - 32, ConstInfor.TagR * 2, ConstInfor.TagR * 2);
                            Graphics.FromImage(TrackBtm).DrawString(StrTagInfor, new Font("宋体", 10), AlarmBrush, CurBasic.x * scalew - 5, CurBasic.y * scaleh - 42);
                        }
                    }
                    TrackPanel_Paint(null, null);
                }
                CurIndex++;
            }
        }