Beispiel #1
0
        private ng.MyNodeRemoteControler_Wiring DrawWiringRCNode(ng.WiringNodeIn nodeIn, JCHVRF.Model.Accessory RC, int RCIndex, string imgDir)
        {
            ng.MyNodeRemoteControler_Wiring nodeRC = null;
            double x = nodeIn.Location.X + nodeIn.Size.Width + ((RCIndex + 1) * 82f) + 60f;
            double y = nodeIn.Location.Y - 32f;

            string model = "";

            if (RC.BrandCode == "Y")
            {
                model = RC.Model_York;
            }
            else
            {
                model = RC.Model_Hitachi;
            }
            if (model != "")
            {
                nodeRC          = new ng.MyNodeRemoteControler_Wiring();
                nodeRC.Location = new Point(x, y);
                string imgFile = System.IO.Path.Combine(imgDir, "RemoteControler.png");
                utilWiring.setNode_wiring(nodeRC, imgFile, addFlowWiring);

                //nodeRC.DrawColor = Color.Transparent;
                nodeRC.Stroke = Brushes.Transparent;

                drawing.PointF ptf = new drawing.PointF((float)nodeRC.Size.Width, 5);
                utilWiring.createTextNode_wiring(model, ptf, nodeRC);

                if (RC.IsShared)
                {
                    utilWiring.createTextNode_wiring("Shared", new drawing.PointF(ptf.X, ptf.Y + 15), nodeRC);
                }
            }
            return(nodeRC);
        }
Beispiel #2
0
        private void DrawWiringRemoteControllers(List <ng.WiringNodeIn> nodeInList, string imgDir)
        {
            List <bool[]> rcPositionTable = new List <bool[]>();
            int           rowIndex        = 0;

            foreach (ng.WiringNodeIn nodeIn in nodeInList)
            {
                if (nodeIn.RoomIndoorItem == null || nodeIn.RoomIndoorItem.IndoorItem == null)
                {
                    continue;
                }

                ng.MyNodeRemoteControler_Wiring shardRCNode = null;
                List <JCHVRF.Model.Accessory>   accList     = new List <JCHVRF.Model.Accessory>();
                try
                {
                    if (nodeIn.RoomIndoorItem != null && nodeIn.RoomIndoorItem.ListAccessory != null)
                    {
                        foreach (var itemAcc in nodeIn.RoomIndoorItem.ListAccessory)
                        {
                            if (itemAcc != null && itemAcc.Count > 0)
                            {
                                for (int i = 0; i < itemAcc.Count; i++)
                                {
                                    accList.Add(itemAcc);
                                }
                            }
                        }
                    }
                }
                catch { accList = nodeIn.RoomIndoorItem.ListAccessory; }
                //accList = nodeIn.RoomIndoorItem.ListAccessory;
                List <JCHVRF.Model.RoomIndoor> indoorGroup = nodeIn.RoomIndoorItem.IndoorItemGroup;
                if (accList != null && accList.Count > 0)
                {
                    int RCIndex = 0;
                    if (nodeIn.RoomIndoorItem.IsMainIndoor)
                    {
                        if (!accList.Exists(acc => acc.IsShared))
                        {
                            accList[0].IsShared = true;
                        }
                    }

                    foreach (JCHVRF.Model.Accessory acc in accList)
                    {
                        if (acc.Type.ToLower() == "remote controler" ||
                            acc.Type.ToLower() == "remote control switch" ||
                            acc.Type.ToLower() == "half-size remote control switch" ||
                            acc.Type.ToLower() == "receiver kit for wireless control" ||
                            acc.Type.Contains("有線遙控器") ||
                            acc.Type == "受光器"
                            )
                        {
                            int  colIndex  = RCIndex;
                            bool isCovered = true;

                            int firstShare = rowIndex;
                            int lastShare  = rowIndex;
                            if (acc.IsShared && indoorGroup != null)
                            {
                                for (int index1 = 0; index1 < nodeInList.Count; index1++)
                                {
                                    ng.WiringNodeIn n = nodeInList[index1];
                                    if (indoorGroup.Contains(n.RoomIndoorItem))
                                    {
                                        firstShare = Math.Min(firstShare, index1);
                                        lastShare  = Math.Max(lastShare, index1);
                                    }
                                }
                            }
                            while (isCovered)
                            {
                                isCovered = false;
                                if (rcPositionTable.Count - 1 < colIndex)
                                {
                                    rcPositionTable.Add(new bool[nodeInList.Count]);
                                }
                                for (int index1 = firstShare; index1 <= lastShare; index1++)
                                {
                                    if (rcPositionTable[colIndex][index1])
                                    {
                                        isCovered = true;
                                        break;
                                    }
                                }
                                if (isCovered)
                                {
                                    colIndex++;
                                }
                            }
                            for (int index1 = firstShare; index1 <= lastShare; index1++)
                            {
                                rcPositionTable[colIndex][index1] = true;
                            }

                            ng.MyNodeRemoteControler_Wiring nodeRC = DrawWiringRCNode(nodeIn, acc, colIndex, imgDir);
                            if (nodeIn.RoomIndoorItem.IsMainIndoor)
                            {
                                if (acc.IsShared)
                                {
                                    shardRCNode = nodeRC;
                                }
                            }

                            if (nodeRC != null)
                            {
                                drawing.PointF ptf1 = new drawing.PointF((float)(nodeRC.Location.X + (nodeRC.Size.Width / 2)), (float)(nodeRC.Location.Y + nodeRC.Size.Height));
                                drawing.PointF ptf2 = new drawing.PointF((float)(nodeRC.Location.X + (nodeRC.Size.Width / 2)), (float)(nodeIn.Location.Y + 12));
                                drawing.PointF ptf3 = new drawing.PointF((float)(nodeIn.Location.X + nodeIn.Size.Width - 1), (float)(nodeIn.Location.Y + 12));
                                ptArrayList.Add(new drawing.PointF[] { ptf1, ptf2, ptf3 });

                                RCIndex++;
                            }
                        }
                    }
                }
                if (shardRCNode != null && indoorGroup != null && indoorGroup.Count > 0)
                {
                    foreach (OldModel.RoomIndoor ri in indoorGroup)
                    {
                        //共享其它Remote Controller的室内机
                        if (ri == nodeIn.RoomIndoorItem)
                        {
                            continue;
                        }
                        ng.WiringNodeIn nodeInShareTo = nodeInList.Find(n => n.RoomIndoorItem == ri);
                        if (nodeInShareTo == null)
                        {
                            continue;
                        }

                        //共享连接线
                        drawing.PointF ptf1 = new drawing.PointF((float)(shardRCNode.Location.X + (shardRCNode.Size.Width / 2)), (float)(shardRCNode.Location.Y + shardRCNode.Size.Height));
                        if (nodeInShareTo.Location.Y + 12 < shardRCNode.Location.Y)
                        {
                            //室内机在共享控制器的上面
                            ptf1.Y = (float)(shardRCNode.Location.Y);
                        }
                        drawing.PointF ptf2 = new drawing.PointF((float)(shardRCNode.Location.X + (shardRCNode.Size.Width / 2)), (float)(nodeInShareTo.Location.Y + 12));
                        drawing.PointF ptf3 = new drawing.PointF((float)(nodeInShareTo.Location.X + nodeInShareTo.Size.Width - 1), (float)(nodeInShareTo.Location.Y + 12));
                        ptArrayList.Add(new drawing.PointF[] { ptf1, ptf2, ptf3 });
                    }
                }
                rowIndex++;
            }
        }