public void DrawWithWaterEffect(GraphicsDevice GD, Vector3 Position, bool UseID, WaterEffect WEffect, Common.Camera Cam) { WEffect.World = Cam.worldMatrix * Matrix.CreateTranslation(Position) * Matrix.CreateTranslation(offset); WEffect.View = Cam.viewMatrix; WEffect.Projection = Cam.projectionMatrix; if (UseID) { throw new NotImplementedException(); } else { WEffect.InternalEffect.CurrentTechnique = WEffect.InternalEffect.Techniques[0]; WEffect.DiffuseColor = new Vector4(0.192f, 0.192f, 0.192f, 1); //1, 1, 1 by default WEffect.LightSpecularColor = new Vector3(0f); WEffect.SpecularColor = new Vector3(1f); WEffect.SpecularPower = 0.14f; WEffect.LightDirection = new Vector3(1, .71f, 1); WEffect.EmissiveColor = new Vector3(0.125f); } GD.SetVertexBuffer(VertexBuffer); WEffect.InternalEffect.CurrentTechnique = WEffect.InternalEffect.Techniques[0]; foreach (EffectPass pass in WEffect.InternalEffect.CurrentTechnique.Passes) { pass.Apply(); ((Device)GD.Handle).ImmediateContext.GeometryShader.Set(WEffect.GS); ((Device)GD.Handle).ImmediateContext.PixelShader.Set(WEffect.PS); ((Device)GD.Handle).ImmediateContext.VertexShader.Set(WEffect.VS); Buffer[] vsBuffers = WEffect.InternalEffect.ConstantBuffers.Select((a) => a._cbuffer).ToArray(); if (vsBuffers != null) { for (int i = 0; i < vsBuffers.Length; ++i) { ((Device)GD.Handle).ImmediateContext.GeometryShader.SetConstantBuffer(i, vsBuffers[i]); ((Device)GD.Handle).ImmediateContext.VertexShader.SetConstantBuffer(i, vsBuffers[i]); ((Device)GD.Handle).ImmediateContext.PixelShader.SetConstantBuffer(i, vsBuffers[i]); } } else { throw new Exception(); } GD.DrawPrimitives(PrimitiveType.TriangleList, 0, VertexBuffer.VertexCount / 3); ((Device)GD.Handle).ImmediateContext.GeometryShader.Set(null); } GD.SetVertexBuffer(null); GD.Indices = null; }
/// <summary> /// 获取监控设备列表 /// </summary> /// <param name="CameraInfoList">摄像头基本信息</param> /// <param name="CameraGroupList">组基本信息</param> /// <param name="nodeRelationList">所属分组关系信息</param> /// <returns></returns> public Cgw.SmcError.SmcErr GetAllCameras(Cgw.Common.PlatformType platformType, Common.PageParam pageParam, out List <Cgw.Common.Camera> cameraList, out List <Cgw.Common.CameraGroup> groupList, out List <Cgw.Common.NodeRelation> nodeRelationList, out PagesInfo pageInfo, Cgw.Common.PlatformLicenseInfo licenseInfo = null) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); logEx.Trace("Enter: CgwMonitorManageAdapter.GetAllCameras"); cameraList = new List <Cgw.Common.Camera>(); groupList = new List <Common.CameraGroup>(); nodeRelationList = new List <Common.NodeRelation>(); pageInfo = new PagesInfo(); CgwMonitorManageServiceReference.Camera[] cameraListTemp = null; CgwMonitorManageServiceReference.CameraGroup[] groupListTemp = null; CgwMonitorManageServiceReference.NodeRelation[] nodeRelationListTemp = null; CgwMonitorManageServiceReference.PageInfo pagesInfoTemp = null; CgwMonitorManageServiceReference.PlatformLicenseInfo info = new CgwMonitorManageServiceReference.PlatformLicenseInfo(); if (licenseInfo != null) { info.IsEltePlatform = licenseInfo.IsEltePlatform; info.IsMonitorPlatform = licenseInfo.IsMonitorPlatform; } Cgw.SmcError.SmcErr err = new Cgw.SmcError.SmcErr(); try { //if (client.State == CommunicationState.Opened) if (serviceControl.MonitorServiceRun()) { CgwMonitorManageServiceReference.PlatformType platformTypeTemp = (CgwMonitorManageServiceReference.PlatformType)platformType; CgwMonitorManageServiceReference.PagesParam pageParamTemp = new CgwMonitorManageServiceReference.PagesParam(); pageParamTemp.CurrentPage = pageParam.CurrentPage; pageParamTemp.NumberPerPage = pageParam.NumberPerPage; client = new MonitorManageServiceClient(); CgwMonitorManageServiceReference.SmcErr serviceErr = client.GetAllCameras(out cameraListTemp, out groupListTemp, out nodeRelationListTemp, out pagesInfoTemp, platformTypeTemp, pageParamTemp, info); client.Close(); if (serviceErr.ErrNo != Cgw.SmcError.CgwError.ERR_MONITOR_MANAGE_SERVICE_SUCCESS) { logEx.Error("CgwMonitorManageAdapter.GetAllCameras failed. ErrNo = {0} ", serviceErr.ErrNo); err = SetCgwErrNo(serviceErr); } else { if (pagesInfoTemp != null) { pageInfo.CurrentPage = pagesInfoTemp.CurrentPage; pageInfo.TotalPages = pagesInfoTemp.TotalPages; pageInfo.TotalRecords = pagesInfoTemp.TotalRecords; } if (cameraListTemp != null) { foreach (CgwMonitorManageServiceReference.Camera ca in cameraListTemp) { Common.Camera temp = new Common.Camera(ca.No, ca.Name, (Common.CameraStatus)ca.Status); cameraList.Add(temp); } } if (groupListTemp != null) { foreach (CgwMonitorManageServiceReference.CameraGroup cg in groupListTemp) { Common.CameraGroup temp = new Common.CameraGroup(cg.No, cg.Name); groupList.Add(temp); } } if (nodeRelationList != null && nodeRelationListTemp != null) { foreach (CgwMonitorManageServiceReference.NodeRelation no in nodeRelationListTemp) { Common.NodeRelation temp = new Common.NodeRelation(no.No, new List <String>(no.Path), (Common.NodeType)no.Type); nodeRelationList.Add(temp); } } //增加顶层分组 if (string.IsNullOrEmpty(monitorPlatformCameraGroupName)) { monitorPlatformCameraGroupName = "MonitorPlatform"; } if (string.IsNullOrEmpty(eLTEPlatformCameraGroupName)) { eLTEPlatformCameraGroupName = "eLTEPlatform"; } //查询第一页数据时增加顶层分组信息 if (pageParam.CurrentPage == 1) { //if (licenseInfo != null && licenseInfo.IsEltePlatform) if (licenseInfo != null) { groupList.Add(new Common.CameraGroup(eLTEPlatformCameraGroupName, eLTEPlatformCameraGroupName)); } //if (licenseInfo != null && licenseInfo.IsMonitorPlatform) if (licenseInfo != null) { groupList.Add(new Common.CameraGroup(monitorPlatformCameraGroupName, monitorPlatformCameraGroupName)); } } if (nodeRelationList.Count > 0) { List <Common.NodeRelation> nodeRelationTemp = new List <Common.NodeRelation>(nodeRelationList); nodeRelationList.Clear(); foreach (Common.NodeRelation no in nodeRelationTemp) { List <String> path = new List <String>(no.Path); if (path.Count > 1) { //按照从底到顶排序 path.Reverse(); } if (no.No.IndexOf("eLTE") > -1) { path.Add(eLTEPlatformCameraGroupName); } else { path.Add(monitorPlatformCameraGroupName); } if (path.Count > 1) { //按照从顶到底排序 path.Reverse(); } Common.NodeRelation temp = new Common.NodeRelation(no.No, path, (Common.NodeType)no.Type); nodeRelationList.Add(temp); } } if (pageParam.CurrentPage == 1) { //if (licenseInfo != null && licenseInfo.IsEltePlatform) if (licenseInfo != null) { Common.NodeRelation tempELTE = new Common.NodeRelation(eLTEPlatformCameraGroupName, new List <String>(), Common.NodeType.GROUP); nodeRelationList.Add(tempELTE); } //if (licenseInfo != null && licenseInfo.IsMonitorPlatform) if (licenseInfo != null) { Common.NodeRelation tempMonitor = new Common.NodeRelation(monitorPlatformCameraGroupName, new List <String>(), Common.NodeType.GROUP); nodeRelationList.Add(tempMonitor); } } } } else { err.ErrNo = Cgw.SmcError.CgwError.GET_ALL_CAMERAS_FAILED; } } catch (System.Exception ex) { err.SetErrorNo(Cgw.SmcError.CgwError.ERR_MONITOR_MANAGE_SERVICE_RESTARTING); logEx.Error("CgwMonitorManageServiceReference.GetAllCameras failed. Exception is {0} ", ex.ToString()); } return(err); }
/// <summary> /// 获取监控设备列表 /// </summary> /// <param name="CameraInfoList">摄像头基本信息</param> /// <param name="CameraGroupList">组基本信息</param> /// <param name="nodeRelationList">所属分组关系信息</param> /// <returns></returns> public Cgw.SmcError.SmcErr GetAllCameras(Cgw.Common.PlatformType platformType, Common.PageParam pageParam, out List<Cgw.Common.Camera> cameraList, out List<Cgw.Common.CameraGroup> groupList, out List<Cgw.Common.NodeRelation> nodeRelationList, out PagesInfo pageInfo, Cgw.Common.PlatformLicenseInfo licenseInfo = null) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); logEx.Trace("Enter: CgwMonitorManageAdapter.GetAllCameras"); cameraList = new List<Cgw.Common.Camera>(); groupList = new List<Common.CameraGroup>(); nodeRelationList = new List<Common.NodeRelation>(); pageInfo = new PagesInfo(); CgwMonitorManageServiceReference.Camera[] cameraListTemp = null; CgwMonitorManageServiceReference.CameraGroup[] groupListTemp = null; CgwMonitorManageServiceReference.NodeRelation[] nodeRelationListTemp = null; CgwMonitorManageServiceReference.PageInfo pagesInfoTemp = null; CgwMonitorManageServiceReference.PlatformLicenseInfo info = new CgwMonitorManageServiceReference.PlatformLicenseInfo(); if (licenseInfo != null) { info.IsEltePlatform = licenseInfo.IsEltePlatform; info.IsMonitorPlatform = licenseInfo.IsMonitorPlatform; } Cgw.SmcError.SmcErr err = new Cgw.SmcError.SmcErr(); try { //if (client.State == CommunicationState.Opened) if(serviceControl.MonitorServiceRun()) { CgwMonitorManageServiceReference.PlatformType platformTypeTemp = (CgwMonitorManageServiceReference.PlatformType)platformType; CgwMonitorManageServiceReference.PagesParam pageParamTemp = new CgwMonitorManageServiceReference.PagesParam(); pageParamTemp.CurrentPage = pageParam.CurrentPage; pageParamTemp.NumberPerPage = pageParam.NumberPerPage; client = new MonitorManageServiceClient(); CgwMonitorManageServiceReference.SmcErr serviceErr = client.GetAllCameras(out cameraListTemp, out groupListTemp, out nodeRelationListTemp, out pagesInfoTemp, platformTypeTemp, pageParamTemp, info); client.Close(); if (serviceErr.ErrNo != Cgw.SmcError.CgwError.ERR_MONITOR_MANAGE_SERVICE_SUCCESS) { logEx.Error("CgwMonitorManageAdapter.GetAllCameras failed. ErrNo = {0} ", serviceErr.ErrNo); err = SetCgwErrNo(serviceErr); } else { if (pagesInfoTemp != null) { pageInfo.CurrentPage = pagesInfoTemp.CurrentPage; pageInfo.TotalPages = pagesInfoTemp.TotalPages; pageInfo.TotalRecords = pagesInfoTemp.TotalRecords; } if (cameraListTemp != null) { foreach (CgwMonitorManageServiceReference.Camera ca in cameraListTemp) { Common.Camera temp = new Common.Camera(ca.No, ca.Name, (Common.CameraStatus)ca.Status); cameraList.Add(temp); } } if (groupListTemp != null) { foreach (CgwMonitorManageServiceReference.CameraGroup cg in groupListTemp) { Common.CameraGroup temp = new Common.CameraGroup(cg.No, cg.Name); groupList.Add(temp); } } if (nodeRelationList != null && nodeRelationListTemp != null) { foreach (CgwMonitorManageServiceReference.NodeRelation no in nodeRelationListTemp) { Common.NodeRelation temp = new Common.NodeRelation(no.No, new List<String>(no.Path), (Common.NodeType)no.Type); nodeRelationList.Add(temp); } } //增加顶层分组 if (string.IsNullOrEmpty(monitorPlatformCameraGroupName)) { monitorPlatformCameraGroupName = "MonitorPlatform"; } if (string.IsNullOrEmpty(eLTEPlatformCameraGroupName)) { eLTEPlatformCameraGroupName = "eLTEPlatform"; } //查询第一页数据时增加顶层分组信息 if (pageParam.CurrentPage == 1) { //if (licenseInfo != null && licenseInfo.IsEltePlatform) if(licenseInfo!=null) { groupList.Add(new Common.CameraGroup(eLTEPlatformCameraGroupName, eLTEPlatformCameraGroupName)); } //if (licenseInfo != null && licenseInfo.IsMonitorPlatform) if(licenseInfo!=null) { groupList.Add(new Common.CameraGroup(monitorPlatformCameraGroupName, monitorPlatformCameraGroupName)); } } if (nodeRelationList.Count > 0) { List<Common.NodeRelation> nodeRelationTemp = new List<Common.NodeRelation>(nodeRelationList); nodeRelationList.Clear(); foreach (Common.NodeRelation no in nodeRelationTemp) { List<String> path = new List<String>(no.Path); if (path.Count > 1) { //按照从底到顶排序 path.Reverse(); } if (no.No.IndexOf("eLTE") > -1) { path.Add(eLTEPlatformCameraGroupName); } else { path.Add(monitorPlatformCameraGroupName); } if (path.Count > 1) { //按照从顶到底排序 path.Reverse(); } Common.NodeRelation temp = new Common.NodeRelation(no.No, path, (Common.NodeType)no.Type); nodeRelationList.Add(temp); } } if (pageParam.CurrentPage == 1) { //if (licenseInfo != null && licenseInfo.IsEltePlatform) if(licenseInfo!=null) { Common.NodeRelation tempELTE = new Common.NodeRelation(eLTEPlatformCameraGroupName, new List<String>(), Common.NodeType.GROUP); nodeRelationList.Add(tempELTE); } //if (licenseInfo != null && licenseInfo.IsMonitorPlatform) if(licenseInfo !=null) { Common.NodeRelation tempMonitor = new Common.NodeRelation(monitorPlatformCameraGroupName, new List<String>(), Common.NodeType.GROUP); nodeRelationList.Add(tempMonitor); } } } } else { err.ErrNo = Cgw.SmcError.CgwError.GET_ALL_CAMERAS_FAILED; } } catch (System.Exception ex) { err.SetErrorNo(Cgw.SmcError.CgwError.ERR_MONITOR_MANAGE_SERVICE_RESTARTING); logEx.Error("CgwMonitorManageServiceReference.GetAllCameras failed. Exception is {0} ", ex.ToString()); } return err; }