Link AddLink(AddFlow addflow, Node org, Node dst) { Link link = new Link(org, dst, null, addflow); addflow.AddLink(link); return(link); }
private static void AddNewLinks(MyNodeYP ypNode, List <Link> oldLinks, AddFlow addflow, int pinCount) { if (oldLinks.Count > 0) { foreach (var oldLink in oldLinks) { var org = oldLink.Org == ypNode ? oldLink.Org : oldLink.Dst; var dst = oldLink.Org == ypNode ? oldLink.Dst : oldLink.Org; var orgIndex = oldLink.Org == ypNode ? oldLink.PinOrgIndex : oldLink.PinDstIndex; var dstIndex = oldLink.Org == ypNode ? oldLink.PinDstIndex : oldLink.PinOrgIndex; Link newLink = new Link(org, dst, orgIndex == 0 ? 0 : pinCount - orgIndex, dstIndex, "", addflow); addflow.AddLink(newLink); } } }
private void DrawLinks(AutoWiringNodeGroup nodeGroup) { List <JCHNode> seriesList = new List <JCHNode>(); JCHNode nodeStart, nodeEnd; if (thisProject.RegionCode == "EU_W" || thisProject.RegionCode == "EU_S" || thisProject.RegionCode == "EU_E") { if (nodeGroup.ControllerListLevel1.Count > 0) { seriesList.Add(nodeGroup.ControllerListLevel1[0]); } if (nodeGroup.ControllerListLevel2.Count > 0) { seriesList.Add(nodeGroup.ControllerListLevel2[0]); } } if (nodeGroup.ControllerListOthers.Count > 0) { seriesList.Add(nodeGroup.ControllerListOthers[0]); } if (nodeGroup.SystemList.Count > 0) { seriesList.Add(nodeGroup.SystemList[0]); } for (int i = 0; i < seriesList.Count - 1; i++) { Link myLink = SeriesLink(seriesList[i], seriesList[i + 1]); myLink.IsStretchable = true; myLink.IsSelectable = false; //myLink.LineStyle = LineStyle.Polyline; _addflowWiring.AddLink(myLink); } for (int i = 0; i < nodeGroup.ControllerListLevel1.Count - 1; i++) { nodeStart = nodeGroup.ControllerListLevel1[i]; nodeEnd = nodeGroup.ControllerListLevel1[i + 1]; Link customLink = ParallelLink(nodeStart, nodeEnd); _addflowWiring.AddLink(customLink); CustomizeLink(nodeStart, nodeEnd, customLink); } for (int i = 0; i < nodeGroup.ControllerListLevel2.Count - 1; i++) { nodeStart = nodeGroup.ControllerListLevel2[i]; nodeEnd = nodeGroup.ControllerListLevel2[i + 1]; Link customLink = ParallelLink(nodeStart, nodeEnd); _addflowWiring.AddLink(customLink); CustomizeLink(nodeStart, nodeEnd, customLink); } for (int i = 0; i < nodeGroup.ControllerListOthers.Count - 1; i++) { nodeStart = nodeGroup.ControllerListOthers[i]; nodeEnd = nodeGroup.ControllerListOthers[i + 1]; Link customLink = ParallelLink(nodeStart, nodeEnd); _addflowWiring.AddLink(customLink); CustomizeLink(nodeStart, nodeEnd, customLink); } for (int i = 0; i < nodeGroup.SystemList.Count - 1; i++) { nodeStart = nodeGroup.SystemList[i]; nodeEnd = nodeGroup.SystemList[i + 1]; Link customLink = ParallelLink(nodeStart, nodeEnd); _addflowWiring.AddLink(customLink); CustomizeLink(nodeStart, nodeEnd, customLink); } }
private void DoDrawingHRWiring(ng.SystemVRF sysItem, ng.WiringNodeOut nodeOut, string imgDir) { Node textNode; drawing.PointF ptText = new drawing.PointF(); NodeElement_Wiring item_wiring = utilWiring.GetNodeElement_Wiring_ODU(sysItem.OutdoorItem, thisProject.BrandCode); nodeOut.Location = new Point(10f, JCHVRF.MyPipingBLL.NextGen.UtilPiping.HeightForNodeText + (JCHVRF.MyPipingBLL.NextGen.UtilPiping.OutdoorOffset_Y_wiring) * 2 + 36f); // ?????? Location string imgFile = System.IO.Path.Combine(imgDir, item_wiring.KeyName + ".png"); utilWiring.setNode_wiring(nodeOut, imgFile, addFlowWiring); drawing.PointF ptf1 = new drawing.PointF((float)(nodeOut.Location.X) + 140, (float)(nodeOut.Location.Y + 20)); drawing.PointF ptf2 = new drawing.PointF(ptf1.X + 74, ptf1.Y + 4); drawing.PointF ptf3 = new drawing.PointF(ptf2.X - 10, ptf2.Y); ptArrayList_ground.Add(new drawing.PointF[] { ptf1, ptf2, ptf3 }); string text = ""; ptText = item_wiring.PtNodeNames[0]; text = sysItem.Name; utilWiring.createTextNode_wiring(text, ptText, nodeOut); if (item_wiring.UnitCount > 1) { text = sysItem.OutdoorItem.AuxModelName; utilWiring.createTextNode_wiring(text, item_wiring.PtNodeNames[1], nodeOut); } //---------------- utilWiring.createTextNode_wiring(item_wiring.Str1, item_wiring.PtStr1, nodeOut); drawing.PointF locationPointF = new drawing.PointF(); for (int i = 0; i < item_wiring.UnitCount; ++i) { locationPointF = utilWiring.convertSystemPointToDrawingPoint(nodeOut.Location); ptf1 = UtilEMF.OffsetLocation(item_wiring.PtStrGroupLine2L[i], locationPointF); ptf2 = UtilEMF.OffsetLocation(item_wiring.PtStrGroupLine2R[i], locationPointF); ptArrayList_power.Add(new drawing.PointF[] { ptf1, ptf2 }); Point pt = new Point(item_wiring.PtModelGroup[i].X, item_wiring.PtModelGroup[i].Y); utilWiring.createTextNode_wiring(item_wiring.ModelGroup[i], item_wiring.PtModelGroup[i], nodeOut); if (i < 4) { Point pt1 = new Point(item_wiring.PtStrGroup1[i].X, item_wiring.PtStrGroup1[i].Y); utilWiring.createTextNode_wiring(item_wiring.StrGroup1[i], item_wiring.PtStrGroup1[i], nodeOut); } utilWiring.createTextNode_wiring(item_wiring.StrGroup2[i], item_wiring.PtStrGroup2[i], nodeOut); utilWiring.createTextNode_wiring(item_wiring.StrGroup3[i], item_wiring.PtStrGroup3[i], nodeOut); utilWiring.createTextNode_wiring(item_wiring.StrGroup4[i], item_wiring.PtStrGroup4[i], nodeOut, true); } drawing.PointF ptf4 = new drawing.PointF(0, 0); drawing.PointF ptf5 = new drawing.PointF(0, 0); ptText = item_wiring.PtNodeNames[0]; ptText.Y += UtilPiping.HeightForNodeText / 2; List <ng.WiringNodeIn> wiringNodeInList = new List <ng.WiringNodeIn>(); DrawWiringNodes(nodeOut, nodeOut.ChildNodes, wiringNodeInList, imgDir, true); DrawWiringRemoteControllers(wiringNodeInList, imgDir); for (int i = 0; i < strArrayList_powerType.Count; i++) { ptArrayList_power.Add(ptArrayList_mainpower[i]); ptf4 = ptArrayList_mainpower[i][1]; text = strArrayList_powerVoltage[i] + "/" + dArrayList_powerCurrent[i].ToString() + "A"; textNode = utilWiring.createTextNode_wiring(text, new drawing.PointF(ptf4.X + 122, ptf4.Y + 2)); addFlowWiring.AddNode(textNode); //.Nodes.Add(textNode); text = strArrayList_powerType[i]; textNode = utilWiring.createTextNode_wiring(text, new drawing.PointF(ptf4.X + 166, ptf4.Y - 12)); addFlowWiring.AddNode(textNode); //.Nodes.Add(textNode); } DrawWiringLegend(nodeOut); foreach (drawing.PointF[] pt in ptArrayList) { if (pt[0].Y < 0) { pt[0].Y = 0; } Node nd1 = utilWiring.createLinePoint(pt[0]); addFlowWiring.AddNode(nd1); //.Nodes.Add(nd1); Node nd2 = utilWiring.createLinePoint(pt[pt.Length - 1]); addFlowWiring.AddNode(nd2); //.Nodes.Add(nd2); //Link lnk1 = utilWiring.createLine(); Link lnk1 = utilWiring.createLine(nd1, nd2, "", addFlowWiring); addFlowWiring.AddLink(lnk1); //lnk1.Jump = Jump.Arc; //nd1.OutLinks.Add(lnk1, nd2); if (pt.Length > 2) { lnk1.AddPoint(new Point(pt[1].X, pt[1].Y)); } // lnk1.Points.Add(new Point(pt[1].X, pt[1].Y)); if (pt.Length > 3) { lnk1.AddPoint(new Point(pt[2].X, pt[2].Y)); } //lnk1.Points.Add(new Point(pt[2].X, pt[2].Y)); } foreach (drawing.PointF[] pt in ptArrayList_power) { Node nd1 = utilWiring.createLinePoint(pt[0]); addFlowWiring.AddNode(nd1); //.Nodes.Add(nd1); Node nd2 = utilWiring.createLinePoint(pt[pt.Length - 1]); //Link lnk1 = utilWiring.createLine(); Link lnk1 = utilWiring.createLine(nd1, nd2, "", addFlowWiring); if (pt.Length > 2) { lnk1.LineStyle = LineStyle.VH; } //lnk1.Line.Style = LineStyle.VH; // lnk1.Jump = Jump.Arc; //lnk1.DrawWidth = 1; // lnk1.DrawColor = Color.Red; lnk1.Stroke = System.Windows.Media.Brushes.Red; // nd1.OutLinks.Add(lnk1, nd2); addFlowWiring.AddLink(lnk1); } foreach (drawing.PointF[] pt in ptArrayList_ground) { if (pt.Length > 2) { ng.MyNodeGround_Wiring nodeground = new ng.MyNodeGround_Wiring(); nodeground.Location = new Point(pt[2].X, pt[2].Y); imgFile = System.IO.Path.Combine(imgDir, "Ground.png"); utilWiring.setNode_wiring(nodeground, imgFile, addFlowWiring); // nodeground.DrawColor = Color.Transparent; } Node nd1 = utilWiring.createLinePoint(pt[0]); addFlowWiring.AddNode(nd1); // .Nodes.Add(nd1); Node nd2 = utilWiring.createLinePoint(pt[1]); //Link lnk1 = utilWiring.createLine(); Link lnk1 = utilWiring.createLine(nd1, nd2, "", addFlowWiring); // lnk1.DashStyle = DashStyle.Dash; lnk1.DashStyle = DashStyles.Dash; // nd1.OutLinks.Add(lnk1, nd2); addFlowWiring.AddLink(lnk1); } }