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); }
public void drawTextToIDUNode(ng.SystemVRF sysItem, ng.MyNodeIn nodeUnit) { //DOUBT //if (nodeUnit.Children != null) //{ // nodeUnit.Children.Clear(); //} string text = ""; old.RoomIndoor riItem = nodeUnit.RoomIndooItem; if (riItem == null) { return; } string model = riItem.IndoorItem.Model_York; if (isHitachi) { model = riItem.IndoorItem.Model_Hitachi; } if (sysItem.OutdoorItem.Type != null && (sysItem.OutdoorItem.Type.Contains("YVAHP") || sysItem.OutdoorItem.Type.Contains("YVAHR"))) { model = riItem.IndoorItem.Model_York; } text = riItem.IndoorName + "\n" + model; if (!string.IsNullOrEmpty(riItem.RoomID)) { string floorName = ""; foreach (old.Floor f in thisProject.FloorList) { foreach (old.Room rm in f.RoomList) { if (rm.Id == riItem.RoomID) { floorName = f.Name; break; } } } text = floorName + "\n" + riItem.RoomName + ":" + text; } else { if (!string.IsNullOrEmpty(riItem.DisplayRoom)) { text = riItem.DisplayRoom + ":" + text; } } JCHNode label = new JCHNode(); initTextNode(label, text); label.ImagePosition = ImagePosition.CenterBottom; if (label.Size.Width < nodeUnit.Size.Width) { label.Size = convertSize(nodeUnit.Size.Width, label.Size.Height); } //addFlowPiping.Items.Add(label); nodeUnit.Stroke = System.Windows.Media.Brushes.RoyalBlue; //nodeUnit.AddFlow.AddNode(label); //nodeUnit.AddFlow.Items.Add(label); //DOUBT //nodeUnit.HighlightChildren = true; JCHNode label2 = new JCHNode(); string text2 = ""; text2 = "Cooling: " + Unit.ConvertToControl(riItem.ActualCoolingCapacity, UnitType.POWER, ut_power).ToString("n1") + ut_power; text2 += "\nHeating: " + Unit.ConvertToControl(riItem.ActualHeatingCapacity, UnitType.POWER, ut_power).ToString("n1") + ut_power; text2 += "\nSensible Cooling: " + Unit.ConvertToControl(riItem.ActualSensibleHeat, UnitType.POWER, ut_power).ToString("n1") + ut_power; initTextNode(label2, text2); label2.ImagePosition = ImagePosition.LeftMiddle; if (label2.Size.Width < nodeUnit.Size.Width) { label2.Size = convertSize(nodeUnit.Size.Width, label2.Size.Height); } //nodeUnit.AddFlow.AddNode(label2); //nodeUnit.AddFlow.Items.Add(label2); //addFlowPiping.AddNode(label2); // This line show Cooling, Heating and Heating on Canvas //nodeUnit.AddFlow.Items.Add(label2); label.Location = convertPointFToWinPoint(nodeUnit.Location.X, nodeUnit.Location.Y - label.Size.Height); label2.Location = convertPointFToWinPoint(nodeUnit.Location.X, nodeUnit.Location.Y + nodeUnit.Size.Height); if (sysItem.PipingLayoutType == old.PipingLayoutTypes.Normal) { if (!sysItem.IsPipingVertical) { label2.Location = convertPointFToWinPoint(label2.Location.X, label2.Location.Y + 8); } } else if (sysItem.PipingLayoutType == old.PipingLayoutTypes.BinaryTree) { if (!sysItem.IsPipingVertical) { label.Location = convertPointFToWinPoint(nodeUnit.Location.X, nodeUnit.Location.Y + nodeUnit.Size.Height); label2.Location = convertPointFToWinPoint(label2.Location.X, label2.Location.Y + label.Size.Height); } } }