예제 #1
0
        private void OnCmdShowSendDisplayInfoDlg()
        {
            if (_globalParams != null)
            {
                _globalParams.IsSendCurrentDisplayConfig = true;
                _globalParams.CurrentDisplayInfoList = new List<ILEDDisplayInfo>();

                #region 屏体信息
                List<ILEDDisplayInfo> ledInfoList = new List<ILEDDisplayInfo>();

                for (int i = 0; i < MyScreen.ElementCollection.Count; i++)
                {
                    if (MyScreen.ElementCollection[i].ConnectedIndex == -1)
                    {
                        continue;
                    }
                    ComplexLEDDisplayInfo info = new ComplexLEDDisplayInfo();

                    List<RectElement> receiveList = new List<RectElement>();
                    receiveList = FindRect((RectLayer)MyScreen.ElementCollection[i]);
                    for (int j = 0; j < receiveList.Count; j++)
                    {
                        ScanBoardRegionInfo receiveInfo = new ScanBoardRegionInfo();
                        receiveInfo.Height = (ushort)receiveList[j].Height;
                        receiveInfo.Width = (ushort)receiveList[j].Width;
                        receiveInfo.ConnectIndex = (ushort)receiveList[j].ConnectedIndex;
                        int portIndex = receiveList[j].ParentElement.ConnectedIndex;
                        receiveInfo.PortIndex = (byte)portIndex;
                        int senderIndex = receiveList[j].ParentElement.ParentElement.ConnectedIndex;
                        receiveInfo.SenderIndex = (byte)senderIndex;
                        receiveInfo.X = (ushort)receiveList[j].X;
                        receiveInfo.Y = (ushort)receiveList[j].Y;

                        RectLayer parent = new RectLayer();
                        parent = (RectLayer)receiveList[j].ParentElement;
                        while (parent.ParentElement != null)
                        {
                            receiveInfo.X += (ushort)parent.X;
                            receiveInfo.Y += (ushort)parent.Y;
                            parent = (RectLayer)parent.ParentElement;
                        }
                        receiveInfo.XInPort = (ushort)receiveList[j].X;
                        receiveInfo.YInPort = (ushort)receiveList[j].Y;

                        info.ScanBoardRegionInfoList.Add(receiveInfo);
                    }

                    ledInfoList.Add(info);
                }
                #endregion
                _globalParams.CurrentDisplayInfoList = GetLedDisplayInfoList();
                Messenger.Default.Send<string>("", MsgToken.MSG_SHOWEQUIPMENTMANAGER);
            }
        }
예제 #2
0
        /// <summary>
        /// 获取每个显示屏的接收卡位置
        /// </summary>
        /// <returns></returns>
        private List<ILEDDisplayInfo> GetLedDisplayInfoList()
        {
            List<ILEDDisplayInfo> ledDisplayInfoList = new List<ILEDDisplayInfo>();
            int currentSenderIndex;
            int senderCount = Function.FindSenderCount(MyScreen.SenderConnectInfoList, out currentSenderIndex);

            //获取每个屏里接收卡相对于发送卡的位置坐标
            for (int screenIndex = 0; screenIndex < MyScreen.ElementCollection.Count; screenIndex++)
            {
                if (MyScreen.ElementCollection[screenIndex].EleType == ElementType.newLayer)
                {
                    continue;
                }
                ComplexLEDDisplayInfo ledDisplayInfo = new ComplexLEDDisplayInfo();

                RectLayer screen = (RectLayer)((RectLayer)MyScreen.ElementCollection[screenIndex]).ElementCollection[0];
                ObservableCollection<SenderConnectInfo> senderConnectInfoList = screen.SenderConnectInfoList;
                for (int senderIndex = 0; senderIndex < senderConnectInfoList.Count; senderIndex++)
                {
                    SenderConnectInfo senderConnectInfo = senderConnectInfoList[senderIndex];
                    Rect senderLoadSize = senderConnectInfo.LoadSize;
                    Point mapLocation = new Point();

                    for (int portIndex = 0; portIndex < senderConnectInfo.PortConnectInfoList.Count; portIndex++)
                    {
                        int connectIndexGlobal = 0;
                        for (int sIndex = 0; sIndex < screenIndex; sIndex++)
                        {
                            ObservableCollection<IRectElement> cList = ((RectLayer)((RectLayer)MyScreen.ElementCollection[sIndex]).ElementCollection[0]).SenderConnectInfoList[senderIndex].PortConnectInfoList[portIndex].ConnectLineElementList;
                            if (cList != null && cList.Count != 0)
                            {
                                connectIndexGlobal += cList.Count;
                            }
                        }

                        ObservableCollection<IRectElement> scanBdCollection = senderConnectInfo.PortConnectInfoList[portIndex].ConnectLineElementList;
                        if (scanBdCollection == null || scanBdCollection.Count == 0)
                        {
                            continue;
                        }
                        //connectIndex的值不是连续的,所以排个序才能知道先后
                        List<IRectElement> scanBdList = new List<IRectElement>();
                        for (int scanIndex = 0; scanIndex < scanBdCollection.Count; scanIndex++)
                        {
                            scanBdList.Add(scanBdCollection[scanIndex]);
                        }
                        scanBdList.Sort(delegate(IRectElement first, IRectElement second)
                        {
                            return first.ConnectedIndex.CompareTo(second.ConnectedIndex);
                        });

                        //if (senderCount > 1)
                        //{
                        mapLocation = senderConnectInfo.PortConnectInfoList[portIndex].MapLocation;
                        //}
                        for (int scanBdIndex = 0; scanBdIndex < scanBdList.Count; scanBdIndex++)
                        {
                            IRectElement scanBdElement = scanBdList[scanBdIndex];
                            ScanBoardRegionInfo scanBdInfo = new ScanBoardRegionInfo();
                            scanBdInfo.SenderIndex = (byte)scanBdElement.SenderIndex;
                            scanBdInfo.PortIndex = (byte)(scanBdElement.PortIndex);
                            scanBdInfo.ConnectIndex = (ushort)(scanBdIndex + connectIndexGlobal);
                            scanBdInfo.Width = (ushort)scanBdElement.Width;
                            scanBdInfo.Height = (ushort)scanBdElement.Height;
                            scanBdInfo.X = (ushort)(scanBdElement.X - senderLoadSize.Left + mapLocation.X);
                            scanBdInfo.Y = (ushort)(scanBdElement.Y - senderLoadSize.Top + mapLocation.Y);
                            ledDisplayInfo.ScanBoardRegionInfoList.Add(scanBdInfo);
                        }
                    }
                }
                if (ledDisplayInfo.ScanBoardRegionInfoList.Count != 0)
                {
                    ledDisplayInfoList.Add(ledDisplayInfo);
                }
            }
            return ledDisplayInfoList;
        }