Esempio n. 1
0
        private void _info_RealtimeInfoEvent(VideoParser.Camera camera, VideoParser.GPS gps)
        {
            CCTVDynamicInfo dynamicInfo = getCameraInfo(camera);

            if (dynamicInfo == null)
            {
                dynamicInfo = getGpsInfo(gps);
            }
            if (dynamicInfo != null)
            {
                ObjectItem <CCTVDynamicInfo> item = new ObjectItem <CCTVDynamicInfo>()
                {
                    Key       = dynamicInfo.VideoId,
                    IsDeleted = false,
                    Item      = dynamicInfo,
                };
                _dynamicItemList.Add(item);
                if (DateTime.Now - _lastUpdateTime > TimeSpan.FromSeconds(0.5))
                {
                    _lastUpdateTime = DateTime.Now;
                    _dynamicSync.PutUpdate(_dynamicItemList);
                    _dynamicItemList.Clear();
                }
            }
        }
Esempio n. 2
0
        CCTVDynamicInfo getGpsInfo(VideoParser.GPS gps)
        {
            if (gps != null)
            {
                CCTVDynamicInfo dynamicInfo = getDynamicInfo(getNodeId(gps.Id));
                dynamicInfo.Latitude  = gps.Latitude;
                dynamicInfo.Longitude = gps.Longitude;
                dynamicInfo.SOG       = gps.SOG;
                dynamicInfo.COG       = gps.COG;
                return(dynamicInfo);
            }

            return(null);
        }
Esempio n. 3
0
        CCTVDynamicInfo getCameraInfo(VideoParser.Camera camera)
        {
            if (camera != null)
            {
                CCTVDynamicInfo dynamicInfo = getDynamicInfo(getNodeId(camera.Id));
                dynamicInfo.Heading = camera.Pointing.Pan;
                CCTVStaticInfo staticInfo;
                if (_staticSync.TryGetValue(dynamicInfo.VideoId, out staticInfo) && staticInfo.TrackInfo != null)
                {
                    double zoom = Math.Min(1, Math.Max(0, camera.Zoom));
                    dynamicInfo.ViewPort = (1 - zoom) * (staticInfo.TrackInfo.MaxViewPort - staticInfo.TrackInfo.MinViewPort) + staticInfo.TrackInfo.MinViewPort;
                }
                return(dynamicInfo);
            }

            return(null);
        }