예제 #1
0
 //关闭所有已打开的视频
 private void CloseAllSP()
 {
     for (int i = 0; i < CMDOperator._b20controldata.Length; i++)
     {
         if (CMDOperator._b20controldata[i].DB33 != "")//存在视频,关闭
         {
             VideoToWall._closeb20win(CMDOperator._b20controldata[i].winno, CMDOperator._b20controldata[i].ptr);
         }
     }
     //VideoToWall._closeallb20win();
 }
예제 #2
0
        private void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
        {
            try
            {
                FeatureSet featureSet = args.FeatureSet;

                if (featureSet == null || featureSet.Features.Count == 0)   // 未扫到视频
                {
                    return;
                }

                if (featureSet.Features.Count > 0)
                {
                    //foreach (Graphic feature in featureSet.Features)
                    //{
                    // GlobalLayers._MainMap.Dispatcher.Invoke(
                    // new Action(
                    // delegate
                    // {

                    Graphic feature = featureSet.Features[0];                 //只取查询到的摄像头集合的第一个来播
                    string  stdid   = feature.Attributes["STDID"].ToString(); //获取视频编号,用来播放视频
                    //if (!GeomServControl.alVideoNeedToPlay.Contains(stdid))//LPY 2015-3-13 17:00:45 添加 用来修改为另外一种方式显示视频点上墙排版,但是效果不好,暂时注释掉
                    //{
                    //    GeomServControl.alVideoNeedToPlay.Add(stdid);
                    //    return;
                    //}
                    //return;
                    if (GeomServControl.alVideosPlayed.Contains(stdid))//首个视频编号已存在于已播放列表,不需要重新打开,其实也不用打开列表
                    {
                        //_currentVideo.DB33 = "";     // 不重新打开不能把当前的视频号清除掉
                        //scrX = 0;
                        //scrY = 0;
                        return;
                    }
                    //if (_currentVideo.DB33 != "")
                    //{
                    //    VideoToWall._closeb20win(QueryLayer._currentVideo.winno, QueryLayer._currentVideo.ptr);
                    //    //QueryLayer.lastPlayedid = "";
                    //    _currentVideo.DB33 = "";
                    //}
                    double   x        = Convert.ToDouble(feature.Attributes["X"].ToString());//地图X
                    double   y        = Convert.ToDouble(feature.Attributes["Y"].ToString());
                    MapPoint mapPoint = new MapPoint(x, y);
                    mapPoint.SpatialReference = new SpatialReference(4326);
                    Point scrPoint = GlobalLayers._MainMap.MapToScreen(mapPoint); //将地图坐标转换为屏幕坐标,取屏幕x,y作为视频开窗起始点

                    _currentVideo.DB33 = stdid;                                   //待播放的视频ID
                    lastPlayedid       = stdid;                                   //同时把待播放的视频ID记录为播放下一个视频前需要关闭的视频编号

                    int videoX = Convert.ToInt32(scrPoint.X);
                    videoX = videoX < 0 ? 0 : videoX;                //坐标小于0的话,取0值
                    scrX   = Convert.ToInt32(videoX * 1.2) - shiftX; //这里的1.2和下面Y坐标乘以1.6是因为大屏分辨率的问题,可能还需调整
                    scrX   = scrX > 0 ? scrX : 0;

                    int videoY = Convert.ToInt32(scrPoint.Y);
                    videoY = videoY < 0 ? 0 : videoY;
                    scrY   = Convert.ToInt32(videoY * 1.6) - shiftY;
                    scrY   = scrY > 0 ? scrY : 0;//最小x,y值为0,0
                    //GlobalLayers._skinfowindow.Width = 200;
                    //VideoToWall._closeallb20win();
                    if (_currentVideo.DB33 != "")
                    {
                        VideoToWall._closeb20win(_currentVideo.winno, _currentVideo.ptr);
                    }
                    _currentVideo.winno = VideoToWall._openb20win(stdid, scrX, scrY, 1000, 1000, _currentVideo.ptr); //视频上墙
                    haveOpened          = true;                                                                      //已打开一个视频
                    GeomServControl.alVideosPlayed.Add(stdid);
                    //Thread.Sleep(TimeSpan.FromSeconds(Convert.ToDouble(System.Configuration.ConfigurationManager.AppSettings["playtime"])));


                    /*
                     * string XH = feature.Attributes["XH"].ToString(); // 真实库为大写
                     * if (!GlobalLayers._GraphicLogCollention.ContainsKey(XH)) // 没有打开过的
                     * {
                     *   Graphic gp = null;
                     *
                     *   graphicsLayer = GlobalLayers._MainMap.Layers[LayerName] as GraphicsLayer;
                     *   gp = new Graphic();
                     *   gp.Geometry = feature.Geometry; //  new MapPoint(122.10324, 30.0219);
                     *   gp.Symbol = App.Current.Resources["ResultsSymbol"] as Symbol;
                     *
                     *   gp.Attributes["ID"] = XH;       // 视频编号为地图上的唯一ID
                     *           // XH.Substring(12, 4);   // 取视频编号的倒数第二开始的后4位
                     *   // 在视频点名称后面加 4位编码,方便键盘控制
                     *   if (XH.Length == 18)
                     *       gp.Attributes["MC"] = feature.Attributes["MC"].ToString() + "(" + XH.Substring(12, 4) + ")";
                     *   else
                     *       gp.Attributes["MC"] = feature.Attributes["MC"].ToString();
                     *   if (LayerName == "DynamicResultGraphicLayer")
                     *       GlobalLayers.DynamicResultGraphicLayer.Graphics.Add(gp);
                     *   else
                     *       GlobalLayers.ResultGraphicLayer.Graphics.Add(gp);
                     *
                     *   GlobalLayers._GraphicLogCollention.TryAdd(XH, gp);
                     * }
                     * String VID = feature.Attributes["XH"].ToString();
                     * MapPoint Mp = feature.Geometry as MapPoint;
                     * if (LayerName == "DynamicResultGraphicLayer") // 如果查询的是视频图层,在大屏上处理和GQY的通讯
                     *   GlobalLayers._gqyvideocontrol.FlushOpenVID(VID, Mp);
                     * else
                     *   GlobalLayers._gqyvideocontrol.OpenVID(VID, Mp);
                     * */
// }));
                    //}
                    //   GlobalLayers.ResultGraphicLayer.Refresh();
                }
            }
            catch (Exception e)
            {
//            MessageBox.Show(e.ToString());
            }
        }
예제 #3
0
        private void PointsRun()
        {
            while (true)//循环播放,遇到停止疏散演示的时候退出循环
            {
                Graphic graphicTemp = new Graphic();

                alVideosPlayed.Clear();//清空播放历史
                QueryLayer.lastPlayedid       = "";
                QueryLayer._currentVideo.DB33 = "";

                if (alPoints.Count <= 0)//判断,是否突然停止疏散演示,停止演示会清空alPoints
                {
                    if (QueryLayer._currentVideo.DB33 != "")
                    {
                        //GlobalLayers._skinfowindow.Width = 10;
                        VideoToWall._closeb20win(QueryLayer._currentVideo.winno, QueryLayer._currentVideo.ptr);
                        QueryLayer.lastPlayedid        = "";
                        QueryLayer.haveOpened          = false;
                        QueryLayer._currentVideo.DB33  = "";
                        QueryLayer._currentVideo.winno = 0;
                    }
                    if (threadPointsRun != null)
                    {
                        if (threadPointsRun.IsAlive)
                        {
                            threadPointsRun.Abort();//Mark
                        }
                    }

                    break;
                }
                for (int i = 0; i < alPoints.Count; i++) // 延加密度的点信息表上开始巡逻
                {
                    if (alPoints.Count <= 0)             //判断,是否突然停止疏散演示,停止演示会清空alPoints
                    {
                        if (QueryLayer._currentVideo.DB33 != "")
                        {
                            //GlobalLayers._skinfowindow.Width = 10;
                            VideoToWall._closeb20win(QueryLayer._currentVideo.winno, QueryLayer._currentVideo.ptr);
                            QueryLayer.lastPlayedid        = "";
                            QueryLayer.haveOpened          = false;
                            QueryLayer._currentVideo.DB33  = "";
                            QueryLayer._currentVideo.winno = 0;
                        }
                        if (threadPointsRun != null)
                        {
                            if (threadPointsRun.IsAlive)
                            {
                                threadPointsRun.Abort();//Mark
                            }
                        }

                        break;
                    }
                    graphicTemp = (Graphic)alPoints[i];
                    GlobalLayers._MainMap.Dispatcher.Invoke(
                        new Action(
                            delegate
                    {
                        try
                        {
                            GraphicsLayer graphicsLayerLinePointsRun = GlobalLayers._MainMap.Layers["graphicsLayerLinePointsRun"] as GraphicsLayer;
                            if (graphicsLayerLinePointsRun != null)
                            {
                                graphicsLayerLinePointsRun.Graphics.Clear();
                                graphicsLayerLinePointsRun.Graphics.Add(graphicTemp);
                                QueryLayer QL = new QueryLayer(graphicTemp.Geometry, "CJ_SP_PT", "DynamicResultGraphicLayer");
                                QL.Do();
                                Thread.Sleep(300);        //等待QL.Do()完成再往下走
                            }
                        }
                        catch (Exception)
                        {
                        }
                    }));

                    if (QueryLayer._currentVideo.DB33 != "")
                    {
                        Thread.Sleep(TimeSpan.FromSeconds(Convert.ToDouble(System.Configuration.ConfigurationManager.AppSettings["playtime"])));
                        //Thread.Sleep(100);
                        VideoToWall._closeb20win(QueryLayer._currentVideo.winno, QueryLayer._currentVideo.ptr);
                        QueryLayer.lastPlayedid       = "";
                        QueryLayer._currentVideo.DB33 = "";
                    }
                    else
                    {
                        Thread.Sleep(100);      // 没有打开视频的时候
                    }
                }

                //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                //这里要做循环播放视频点列表里的视频的动作
                //int ttt = alVideoNeedToPlay.Count;
                //int iii = 0;
                //if (!flag)
                //{
                //    UpdateSPLabel();
                //    flag = true;
                //}
            }
            //throw new NotImplementedException();
        }
예제 #4
0
 //视频下窗的时候,背景板改变
 private void UpdateSPLabelOff(string spid, string stdid)
 {
     if (GlobalLayers._spinfowindow.tb6.Tag.ToString() == stdid)
     {
         GlobalLayers._spinfowindow.tb6.Text = "";
         GlobalLayers._spinfowindow.tb6.Tag  = "0";
         if (CMDOperator._b20controldata[5].DB33 != "")
         {
             VideoToWall._closeb20win(CMDOperator._b20controldata[5].winno, CMDOperator._b20controldata[5].ptr);
             CMDOperator._b20controldata[5].DB33 = "";
         }
     }
     else if (GlobalLayers._spinfowindow.tb5.Tag.ToString() == stdid)
     {
         GlobalLayers._spinfowindow.tb5.Text = "";
         GlobalLayers._spinfowindow.tb5.Tag  = "0";
         if (CMDOperator._b20controldata[4].DB33 != "")
         {
             VideoToWall._closeb20win(CMDOperator._b20controldata[4].winno, CMDOperator._b20controldata[4].ptr);
             CMDOperator._b20controldata[4].DB33 = "";
         }
     }
     else if (GlobalLayers._spinfowindow.tb4.Tag.ToString() == stdid)
     {
         GlobalLayers._spinfowindow.tb4.Text = "";
         GlobalLayers._spinfowindow.tb4.Tag  = "0";
         if (CMDOperator._b20controldata[3].DB33 != "")
         {
             VideoToWall._closeb20win(CMDOperator._b20controldata[3].winno, CMDOperator._b20controldata[3].ptr);
             CMDOperator._b20controldata[3].DB33 = "";
         }
     }
     else if (GlobalLayers._spinfowindow.tb3.Tag.ToString() == stdid)
     {
         GlobalLayers._spinfowindow.tb3.Text = "";
         GlobalLayers._spinfowindow.tb3.Tag  = "0";
         if (CMDOperator._b20controldata[2].DB33 != "")
         {
             VideoToWall._closeb20win(CMDOperator._b20controldata[2].winno, CMDOperator._b20controldata[2].ptr);
             CMDOperator._b20controldata[2].DB33 = "";
         }
     }
     else if (GlobalLayers._spinfowindow.tb2.Tag.ToString() == stdid)
     {
         GlobalLayers._spinfowindow.tb2.Text = "";
         GlobalLayers._spinfowindow.tb2.Tag  = "0";
         if (CMDOperator._b20controldata[1].DB33 != "")
         {
             VideoToWall._closeb20win(CMDOperator._b20controldata[1].winno, CMDOperator._b20controldata[1].ptr);
             CMDOperator._b20controldata[1].DB33 = "";
         }
     }
     else if (GlobalLayers._spinfowindow.tb1.Tag.ToString() == stdid)
     {
         GlobalLayers._spinfowindow.tb1.Text = "";
         GlobalLayers._spinfowindow.tb1.Tag  = "0";
         if (CMDOperator._b20controldata[0].DB33 != "")
         {
             VideoToWall._closeb20win(CMDOperator._b20controldata[0].winno, CMDOperator._b20controldata[0].ptr);
             CMDOperator._b20controldata[0].DB33 = "";
         }
     }
 }