public static Dictionary <string, object> FindProgCirculationNetwork(List <DeptData> deptData, Polygon2d buildingOutline, List <Polygon2d> leftOverPoly = null) { if (!ValidateObject.CheckPoly(buildingOutline)) { return(null); } if (deptData == null) { return(null); } List <Polygon2d> polygonsAllProgList = new List <Polygon2d>(); List <DeptData> deptDataAllDeptList = new List <DeptData>(); List <List <Line2d> > lineCollection = new List <List <Line2d> >(); for (int i = 0; i < deptData.Count; i++) { if ((deptData[i].DepartmentType.IndexOf(BuildLayout.KPU.ToLower()) != -1 || deptData[i].DepartmentType.IndexOf(BuildLayout.KPU.ToUpper()) != -1)) { continue; // dont add for KPU } if (deptData[i].PolyAssignedToDept == null) { continue; } polygonsAllProgList.AddRange(deptData[i].PolyAssignedToDept); } if (leftOverPoly != null) { polygonsAllProgList.AddRange(leftOverPoly); } for (int i = 0; i < polygonsAllProgList.Count; i++) { polygonsAllProgList[i] = new Polygon2d(polygonsAllProgList[i].Points); } List <Line2d> networkLine = new List <Line2d>(); for (int i = 0; i < polygonsAllProgList.Count; i++) { Polygon2d poly1 = polygonsAllProgList[i]; for (int j = i + 1; j < polygonsAllProgList.Count; j++) { Polygon2d poly2 = polygonsAllProgList[j]; Dictionary <string, object> checkNeighbor = PolygonUtility.FindPolyAdjacentEdge(poly1, poly2); if (checkNeighbor != null) { if ((bool)checkNeighbor["Neighbour"] == true) { networkLine.Add((Line2d)checkNeighbor["SharedEdge"]); } } } } List <Line2d> cleanNetworkLines = LineUtility.RemoveDuplicateLines(networkLine); cleanNetworkLines = GraphicsUtility.RemoveDuplicateslinesWithPoly(buildingOutline, cleanNetworkLines); List <List <string> > deptNeighborNames = new List <List <string> >(); List <Line2d> onlyOrthoLineList = new List <Line2d>(); for (int i = 0; i < cleanNetworkLines.Count; i++) { bool checkOrtho = ValidateObject.CheckLineOrthogonal(cleanNetworkLines[i]); if (checkOrtho == true) { onlyOrthoLineList.Add(cleanNetworkLines[i]); } } return(new Dictionary <string, object> { { "CirculationNetwork", (onlyOrthoLineList) }, { "PolygonsForAllPrograms", (polygonsAllProgList) } }); }