Exemplo n.º 1
0
        public void DrawTextToAllNodes(Node node, Node parent, ng.SystemVRF sysItem)
        {
            // RND
            if (sysItem.editrpt == false)
            {
                sysItem.IsExportToReport = true;
            }

            if (node is ng.MyNodeOut)
            {
                ng.MyNodeOut nodeOut = node as ng.MyNodeOut;
                DrawTextToAllNodes(nodeOut.ChildNode, nodeOut, sysItem);
                nodeOut.Stroke = System.Windows.Media.Brushes.RoyalBlue;
            }
            else if (node is ng.MyNodeYP)
            {
                ng.MyNodeYP nodeYP = node as ng.MyNodeYP;
                drawTextToOtherNode(node, parent, sysItem);

                foreach (Node item in nodeYP.ChildNodes)
                {
                    DrawTextToAllNodes(item, nodeYP, sysItem);
                }
            }
            else if (node is ng.MyNodeCH)
            {
                ng.MyNodeCH nodeCH = node as ng.MyNodeCH;
                drawTextToOtherNode(node, parent, sysItem);

                DrawTextToAllNodes(nodeCH.ChildNode, nodeCH, sysItem);
            }
            else if (node is ng.MyNodeMultiCH)
            {
                ng.MyNodeMultiCH nodeMCH = node as ng.MyNodeMultiCH;
                drawTextToOtherNode(node, parent, sysItem);

                foreach (Node item in nodeMCH.ChildNodes)
                {
                    DrawTextToAllNodes(item, nodeMCH, sysItem);
                }
            }
            else if (node is ng.MyNodeIn)
            {
                ng.MyNodeIn nodeIn = node as ng.MyNodeIn;
                drawTextToIDUNode(sysItem, nodeIn);
            }

            if (node is ng.MyNode)
            {
                ng.MyNode myNode = node as ng.MyNode;
                if (myNode != null && myNode.MyInLinks != null && myNode.MyInLinks.Count > 0)
                {
                    for (int i = 0; i < myNode.MyInLinks.Count; i++)
                    {
                        ng.MyLink myLink = myNode.MyInLinks[i] as ng.MyLink;
                        drawTextToLink(myLink, i, parent, node, isInch, sysItem);
                    }
                }
            }
        }
 public void GetHeightDifferenceNodes(Lassalle.WPF.Flow.Node node, Lassalle.WPF.Flow.Node parent, JCHVRF.Model.NextGen.SystemVRF sysItem, List <JCHVRF.Model.NextGen.MyNode> list)
 {
     if (node is JCHVRF.Model.NextGen.MyNodeOut)
     {
         JCHVRF.Model.NextGen.MyNodeOut nodeOut = node as JCHVRF.Model.NextGen.MyNodeOut;
         GetHeightDifferenceNodes(nodeOut.ChildNode, nodeOut, sysItem, list);
     }
     else if (node is JCHVRF.Model.NextGen.MyNodeYP)
     {
         JCHVRF.Model.NextGen.MyNodeYP nodeYP = node as JCHVRF.Model.NextGen.MyNodeYP;
         foreach (Lassalle.WPF.Flow.Node item in nodeYP.ChildNodes)
         {
             GetHeightDifferenceNodes(item, nodeYP, sysItem, list);
         }
     }
     else if (node is JCHVRF.Model.NextGen.MyNodeCH)
     {
         JCHVRF.Model.NextGen.MyNodeCH nodeCH = node as JCHVRF.Model.NextGen.MyNodeCH;
         list.Add(nodeCH);
         GetHeightDifferenceNodes(nodeCH.ChildNode, nodeCH, sysItem, list);
     }
     else if (node is JCHVRF.Model.NextGen.MyNodeMultiCH)
     {
         JCHVRF.Model.NextGen.MyNodeMultiCH nodeMCH = node as JCHVRF.Model.NextGen.MyNodeMultiCH;
         list.Add(nodeMCH);
         foreach (Lassalle.WPF.Flow.Node item in nodeMCH.ChildNodes)
         {
             GetHeightDifferenceNodes(item, nodeMCH, sysItem, list);
         }
     }
     else if (node is JCHVRF.Model.NextGen.MyNodeIn)
     {
         //因为DoPipingCalculation之后可能影响indoor的管径,
         //所以绘制YP型号的时候顺便绘制indoor的管径 add on 20170512 by Shen Junjie
         JCHVRF.Model.NextGen.MyNodeIn nodeIn = node as JCHVRF.Model.NextGen.MyNodeIn;
         list.Add(nodeIn);
     }
 }
        private void OnSettingsOk()
        {
            RoomIndoor emptyIndoor = new RoomIndoor();

            if (this.SelectedIndex == 0)
            {
                emptyIndoor.PositionType = PipingPositionType.Upper.ToString();
            }
            else if (this.SelectedIndex == 1)
            {
                emptyIndoor.PositionType = PipingPositionType.SameLevel.ToString();
            }
            else
            {
                emptyIndoor.PositionType = PipingPositionType.Lower.ToString();
            }
            if (TxtIndoorHighDifference == "")
            {
                TxtIndoorHighDifference = "0";
            }
            emptyIndoor.HeightDiff = Unit.ConvertToSource(Convert.ToDouble(TxtIndoorHighDifference), UnitType.LENGTH_M, ut_length);

            if (emptyIndoor.PositionType != PipingPositionType.SameLevel.ToString())
            {
                if (emptyIndoor.HeightDiff <= 0)
                {
                    lblPipingLegthError = Msg.GetResourceString("INDOOR_HIGHERDIFFERENCE_LENGTH");
                    return;
                }
            }

            if (emptyIndoor.PositionType == PipingPositionType.Upper.ToString() && emptyIndoor.HeightDiff > sysItemSource.MaxOutdoorAboveHeight)
            {
                double len = Unit.ConvertToControl(sysItemSource.MaxOutdoorAboveHeight, UnitType.LENGTH_M, ut_length);

                IsPipingPopupOpened = false;
                JCHMessageBox.Show(Language.Current.GetMessage("HEIGHT_UPPER_MSG") + len.ToString("n0") + ut_length);
                return;
            }
            if (emptyIndoor.PositionType == PipingPositionType.Lower.ToString() && emptyIndoor.HeightDiff > sysItemSource.MaxOutdoorBelowHeight)
            {
                double len = Unit.ConvertToControl(sysItemSource.MaxOutdoorBelowHeight, UnitType.LENGTH_M, ut_length);
                IsPipingPopupOpened = false;
                JCHMessageBox.Show(Language.Current.GetMessage("HEIGHT_UPPER_MSG") + len.ToString("n0") + ut_length);

                return;
            }
            foreach (SelectedIDUList ind in SelIDUList)
            {
                int    IDU_ID     = ind.IndoorNo;
                double HeightDiff = emptyIndoor.HeightDiff;
                if (ind.IndoorTag is JCHVRF.Model.NextGen.MyNodeCH)
                {
                    //MyNodeCH nodech = ind.IndoorTag as MyNodeCH;
                    JCHVRF.Model.NextGen.MyNodeCH nodech = ind.IndoorTag as JCHVRF.Model.NextGen.MyNodeCH;
                    if (emptyIndoor.PositionType == PipingPositionType.Lower.ToString())
                    {
                        HeightDiff = -HeightDiff;
                    }
                    nodech.HeightDiff = HeightDiff;
                }
                else if (ind.IndoorTag is JCHVRF.Model.NextGen.MyNodeMultiCH)
                {
                    JCHVRF.Model.NextGen.MyNodeMultiCH nodech = ind.IndoorTag as JCHVRF.Model.NextGen.MyNodeMultiCH;
                    if (emptyIndoor.PositionType == PipingPositionType.Lower.ToString())
                    {
                        HeightDiff = -HeightDiff;
                    }
                    nodech.HeightDiff = HeightDiff;
                }
                else if (ind.IndoorTag is JCHVRF.Model.NextGen.MyNodeIn)
                {
                    JCHVRF.Model.NextGen.MyNodeIn node = ind.IndoorTag as JCHVRF.Model.NextGen.MyNodeIn;
                    node.RoomIndooItem.PositionType = emptyIndoor.PositionType.ToString();
                    node.RoomIndooItem.HeightDiff   = HeightDiff;
                }
            }
            RefreshPanel();

            BindHighDifference();
            VerificationHighDiff();


            PopupSettings       = Visibility.Hidden;
            IsPipingPopupOpened = false;
        }
        private void BindHighDifference()
        {
            this.ListIDU = new ObservableCollection <IDUList>();
            this.ListIDU.Clear();
            List <JCHVRF.Model.NextGen.MyNode> nodes = new List <JCHVRF.Model.NextGen.MyNode>();

            WL.Node addFlowItemPiping = (WL.Node)sysItemSource.MyPipingNodeOut;
            GetHeightDifferenceNodes(addFlowItemPiping, null, sysItemSource, nodes);
            int i = -1;

            foreach (JCHVRF.Model.NextGen.MyNode node in nodes)
            {
                int    Id        = this.ListIDU.Count + 1;
                string modelName = "";
                if (node is JCHVRF.Model.NextGen.MyNodeCH)
                {
                    JCHVRF.Model.NextGen.MyNodeCH nodeCH = node as JCHVRF.Model.NextGen.MyNodeCH;

                    string PositionType = PipingPositionType.Upper.ToString();
                    if (!string.IsNullOrEmpty(nodeCH.Model))
                    {
                        modelName = "CHBox [" + nodeCH.Model + "]";
                    }
                    else
                    {
                        modelName = "CHBox";
                    }
                    double HeightDiff = nodeCH.HeightDiff;
                    if (HeightDiff < 0)
                    {
                        PositionType = PipingPositionType.Lower.ToString();
                        HeightDiff   = -HeightDiff;
                    }
                    else if (HeightDiff == 0)
                    {
                        PositionType = PipingPositionType.SameLevel.ToString();
                    }
                    ListIDU.Add(new IDUList
                    {
                        IndoorNo     = (int)Id,
                        IndoorName   = (string)modelName,
                        Name         = Id + "[" + modelName + "]",
                        PositionType = (string)PositionType,
                        HeightDiff   = Convert.ToDouble(Unit.ConvertToControl(HeightDiff, UnitType.LENGTH_M, ut_length).ToString("n1")),
                        IndoorTag    = node
                    });
                }
                if (node is JCHVRF.Model.NextGen.MyNodeMultiCH)
                {
                    JCHVRF.Model.NextGen.MyNodeMultiCH nodeCH = node as JCHVRF.Model.NextGen.MyNodeMultiCH;
                    string PositionType = PipingPositionType.Upper.ToString();
                    if (!string.IsNullOrEmpty(nodeCH.Model))
                    {
                        modelName = "MultiCHBox [" + nodeCH.Model + "]";
                    }
                    else
                    {
                        modelName = "MultiCHBox";
                    }
                    double HeightDiff = nodeCH.HeightDiff;
                    if (HeightDiff < 0)
                    {
                        PositionType = PipingPositionType.Lower.ToString();
                        HeightDiff   = -HeightDiff;
                    }
                    else if (HeightDiff == 0)
                    {
                        PositionType = PipingPositionType.SameLevel.ToString();
                    }
                    ListIDU.Add(new IDUList
                    {
                        IndoorNo     = (int)Id,
                        IndoorName   = (string)modelName,
                        Name         = Id + "[" + modelName + "]",
                        PositionType = (string)PositionType,
                        HeightDiff   = Convert.ToDouble(Unit.ConvertToControl(HeightDiff, UnitType.LENGTH_M, ut_length).ToString("n1")),
                        IndoorTag    = node
                    });
                }
                if (node is JCHVRF.Model.NextGen.MyNodeIn)
                {
                    JCHVRF.Model.NextGen.MyNodeIn nodeIn = node as JCHVRF.Model.NextGen.MyNodeIn;
                    string Room = "";
                    if (!string.IsNullOrEmpty((new ProjectBLL(thisProject)).GetFloorAndRoom(nodeIn.RoomIndooItem.RoomID)))
                    {
                        Room = (new ProjectBLL(thisProject)).GetFloorAndRoom(nodeIn.RoomIndooItem.RoomID) + " : ";
                    }
                    Room = Room + nodeIn.RoomIndooItem.IndoorName + " [" + (thisProject.BrandCode == "Y" ? nodeIn.RoomIndooItem.IndoorItem.Model_York : nodeIn.RoomIndooItem.IndoorItem.Model_Hitachi) + "]";
                    if (nodeIn.RoomIndooItem != null)
                    {
                        modelName = nodeIn.RoomIndooItem.IndoorFullName;
                    }
                    else
                    {
                        modelName = "";
                    }
                    ListIDU.Add(new IDUList
                    {
                        IndoorNo     = (int)Id,
                        IndoorName   = modelName,
                        Name         = modelName,
                        PositionType = nodeIn.RoomIndooItem.PositionType,
                        HeightDiff   = Convert.ToDouble(Unit.ConvertToControl(nodeIn.RoomIndooItem.HeightDiff, UnitType.LENGTH_M, ut_length)),
                        IndoorTag    = node
                    });
                }
            }
            RecalculateMaxHeightDifference(nodes);
        }
Exemplo n.º 5
0
        private void drawTextToOtherNode(Node node, Node parent, ng.SystemVRF sysItem)
        {
            if (node == null)
            {
                return;
            }

            //DOUBT
            //if (node.Children != null)
            //{
            //    node.Children.Clear();
            //}

            if (!sysItem.IsPipingOK)
            {
                return;
            }

            if (node is ng.MyNodeYP)
            {
                ng.MyNodeYP nodeYP = node as ng.MyNodeYP;
                if (!string.IsNullOrEmpty(nodeYP.Model) && sysItem.IsPipingOK)
                {
                    JCHNode label1 = new JCHNode();
                    initTextNode(label1, " ");

                    Caption Cap1 = initCaptionText(nodeYP.Model, nodeYP);

                    label1.Location = convertPointFToWinPoint(nodeYP.Location.X + 20, nodeYP.Location.Y - label1.Size.Height);
                    if (sysItem.PipingLayoutType == old.PipingLayoutTypes.BinaryTree)
                    {
                        if (!sysItem.IsPipingVertical)
                        {
                            label1.Location = convertPointFToWinPoint(nodeYP.Location.X + 10, nodeYP.Location.Y);
                        }
                        else
                        {
                            label1.Location = convertPointFToWinPoint(nodeYP.Location.X + 15, nodeYP.Location.Y - label1.Size.Height);
                        }
                    }
                    else if (sysItem.PipingLayoutType == old.PipingLayoutTypes.SchemaA)
                    {
                        if (!sysItem.IsPipingVertical)
                        {
                            label1.Location = convertPointFToWinPoint(label1.Location.X + 3, label1.Location.Y);
                        }
                        else
                        {
                            label1.Location = convertPointFToWinPoint(label1.Location.X - 8, label1.Location.Y + 20);
                        }
                    }
                    else if (sysItem.PipingLayoutType == old.PipingLayoutTypes.Normal)
                    {
                        if (sysItem.IsPipingVertical)
                        {
                            label1.Location = convertPointFToWinPoint(nodeYP.Location.X + 20, nodeYP.Location.Y - label1.Size.Height - 8);
                        }
                        else
                        {
                            label1.Location = convertPointFToWinPoint(nodeYP.Location.X + 20, nodeYP.Location.Y - label1.Size.Height);
                        }
                    }

                    //addFlowPiping.AddNode(label1);

                    //nodeYP.AddFlow.Items.Add(label1);

                    Cap1.Location = label1.Location;
                    addFlowPiping.AddCaption(Cap1);

                    if (nodeYP.Model != "")
                    {
                        if (sysItem.IsExportToReport)
                        {
                            InsertPipingKitTable("BranchKit", sysItem.Name, nodeYP.Model, 1, sysItem.Id);
                        }
                    }
                    addFlowPiping.RemoveNode(label1);
                }
            }
            else if (node is ng.MyNodeCH)
            {
                ng.MyNodeCH nodeCH = node as ng.MyNodeCH;
                if (!string.IsNullOrEmpty(nodeCH.Model))
                {
                    if (sysItem.IsExportToReport)
                    {
                        InsertPipingKitTable("CHBox", sysItem.Name, nodeCH.Model, 1, sysItem.Id);
                    }
                    if (sysItem.IsPipingOK)
                    {
                        JCHNode label1 = new JCHNode();
                        initTextNode(label1, nodeCH.Model);
                        if (!sysItem.IsPipingVertical)
                        {
                            label1.Location = convertPointFToWinPoint(nodeCH.Location.X + nodeCH.Size.Width / 2 + 5, nodeCH.Location.Y - label1.Size.Height);
                        }
                        else
                        {
                            label1.Location = convertPointFToWinPoint((nodeCH.Location.X - 50) + nodeCH.Size.Width / 2 - label1.Size.Width / 2, (nodeCH.Location.Y + 12) - label1.Size.Height);
                        }

                        addFlowPiping.AddNode(label1);

                        nodeCH.AddFlow.Items.Add(label1);
                    }
                }
            }
            else if (node is ng.MyNodeMultiCH)
            {
                ng.MyNodeMultiCH nodeMCH = node as ng.MyNodeMultiCH;
                if (!string.IsNullOrEmpty(nodeMCH.Model))
                {
                    if (sysItem.IsExportToReport)
                    {
                        InsertPipingKitTable("CHBox", sysItem.Name, nodeMCH.Model, 1, sysItem.Id);
                    }
                    if (sysItem.IsPipingOK)
                    {
                        JCHNode label1 = new JCHNode();
                        initTextNode(label1, nodeMCH.Model);
                        if (sysItem.IsPipingVertical)
                        {
                            label1.Location = convertPointFToWinPoint(nodeMCH.Location.X + nodeMCH.Size.Width / 2 - label1.Size.Width / 2, nodeMCH.Location.Y - label1.Size.Height);
                        }
                        else
                        {
                            if (parent is ng.MyNodeYP && parent.Location.Y > node.Location.Y)
                            {
                                label1.Location = convertPointFToWinPoint(nodeMCH.Location.X + nodeMCH.Size.Width / 2 - label1.Size.Width / 2, nodeMCH.Location.Y - label1.Size.Height);
                            }
                            else
                            {
                                label1.Location = convertPointFToWinPoint(nodeMCH.Location.X + nodeMCH.Size.Width / 2 + 5, nodeMCH.Location.Y - label1.Size.Height);
                            }
                        }

                        addFlowPiping.AddNode(label1);

                        nodeMCH.AddFlow.Items.Add(label1);
                    }
                }
            }
        }