public void resizeHighway(string highwayID, float newSize)
        {
            int highwayIndex = highwayList.FindIndex(item => item.id == highwayID);

            for (int i = 0; i < highwayList[highwayIndex].streetLampList.Count;i++)
            {
                GameObject.Destroy(highwayList[highwayIndex].streetLampList[i].object3D);
            }

            highwayList[highwayIndex].streetLampList.Clear();

            highwayList[highwayIndex].waySize = newSize;
            highwayList[highwayIndex].generateInitial3Dway(terrain);

            List<IntersectionNode> allIntersections = intersections.FindAll(item => item.wayIds.Contains(highwayID));
            for (int i = 0; i < allIntersections.Count; i++)
                resetIntersectionNode(allIntersections[i]);

            for (int i = 0; i < allIntersections.Count; i++)
            {
                if (allIntersections[i].wayIds.Count == 2)
                    correct2wayIntersection(allIntersections[i]);
                else
                    correctIntersection(allIntersections[i]);
            }

            DrapeHighway draper = new DrapeHighway();
            draper.DrapeRoad(terrain, highwayList[highwayIndex].leftSideVertexes, highwayList[highwayIndex].rightSideVertexes);

            for (int i = 0; i < allIntersections.Count; i++)
            {
                    for (int k = 0; k < allIntersections[i].wayIds.Count; k++)
                    {
                        int hwIndex = highwayList.FindIndex(item => item.id == allIntersections[i].wayIds[k]);
                        highwayList[hwIndex].updateHighwayMesh();

                        if (highwayList[highwayIndex].hasLeftSidewalk)
                        {
                            float size = highwayList[highwayIndex].leftSidewalkSize;
                            deletePavement(highwayList[highwayIndex].id, Pavement.pavementSide.left);
                            addNewPavement(highwayList[highwayIndex].id, Pavement.pavementSide.left, size);
                            correctPavement(highwayList[highwayIndex].id, Pavement.pavementSide.left);
                        }
                        if (highwayList[highwayIndex].hasRightSideWalk)
                        {
                            float size = highwayList[highwayIndex].rightSidewalkSize;
                            deletePavement(highwayList[highwayIndex].id, Pavement.pavementSide.right);
                            addNewPavement(highwayList[highwayIndex].id, Pavement.pavementSide.right, size);
                            correctPavement(highwayList[highwayIndex].id, Pavement.pavementSide.right);
                        }

                    }
            }
        }
        private void generateHighwayList()
        {
            //Eliminate small highways that cause problems
            for (int i = 0; i < wayList.Count; i++)
            {
                float length = 0;
                bool isNormal = false;
                for (int k = 0; k < wayList[i].nodes.Count - 1; k++)
                {
                    length += (wayList[i].nodes[k + 1].meterPosition - wayList[i].nodes[k].meterPosition).magnitude;
                    if (length >= 5.0f)
                    {
                        isNormal = true;
                        break;
                    }
                }

                if (!isNormal)
                {
                    wayList.RemoveAt(i);
                    i--;
                }
            }

            intersections = generateIntersectionList();

            divideNecessaryWays();

            for(int i = 0 ; i < wayList.Count ; i++)
                highwayList.Add(new Highway(wayList[i], configurations, terrain));

            for (int i = 0; i < intersections.Count; i++)
            {
                if (intersections[i].wayIds.Count == 2)
                    correct2wayIntersection(intersections[i]);
                else
                {
                    try
                    {
                        correctIntersection(intersections[i]);
                    }
                    catch (Exception ex)
                    {
                        resetIntersectionNode(intersections[i]);
                        continue;
                    }
                }
            }

            DrapeHighway draper = new DrapeHighway();
            for (int i = 0; i < highwayList.Count; i++)
                draper.DrapeRoad(terrain, highwayList[i].leftSideVertexes, highwayList[i].rightSideVertexes);
        }
        private void generatePavementList()
        {
            DrapeHighway draper = new DrapeHighway();

            for (int i = 0; i < highwayList.Count; i++)
            {
                if (highwayList[i].hasLeftSidewalk)
                {
                    Pavement newPavement = new Pavement(highwayList[i], terrain,Pavement.pavementSide.left);
                    if (newPavement.leftSideVertexes.Count == 0 || newPavement.rightSideVertexes.Count == 0)
                        continue;
                    draper.DrapeRoad(terrain, newPavement.leftSideVertexes, newPavement.rightSideVertexes);
                    pavementList.Add(newPavement);
                }
                if(highwayList[i].hasRightSideWalk)
                {
                    Pavement newPavement = new Pavement(highwayList[i], terrain, Pavement.pavementSide.right);
                    if (newPavement.leftSideVertexes.Count == 0 || newPavement.rightSideVertexes.Count == 0)
                        continue;
                    draper.DrapeRoad(terrain, newPavement.leftSideVertexes, newPavement.rightSideVertexes);
                    pavementList.Add(newPavement);
                }
            }
        }