public static RoadModel getRoadStub(string id) { String[] rolorArr = { ScreenManager.Model.Constant.Constants.RED_COLOR, ScreenManager.Model.Constant.Constants.GREEN_COLOR, ScreenManager.Model.Constant.Constants.YELLOW_COLOR }; RoadModel roadModel = new RoadModel(); roadModel.BaseColor = ScreenManager.Model.Constant.Constants.DEFAULT_COLOR; roadModel.RoadID = id; roadModel.RoadName = "RoadStub" + id; List<SegmentModel> sl = new List<SegmentModel>(); int k = 0; for(int i=0;i<10;i++){ SegmentModel sm = new SegmentModel(); sm.SegmentColor = rolorArr[i%3]; sm.Address.Start = k; sm.Address.End = k+15; sm.SegmentID = id + "-"+i; sm.SegmentName = id + "-" + i; k = k + 15; sl.Add(sm); } roadModel.SegmentList = sl; return roadModel; }
public void loadRoadModel(RoadModel rm) { this.RoadID = rm.RoadID; this.BaseColor = rm.BaseColor; this.RoadName = rm.RoadName; this.RoadLenght = rm.RoadLenght; SegmentList.Clear(); for(int i=0;i< rm.SegmentList.Count;i++){ SegmentModel segModel = new SegmentModel(); segModel.SegmentID = rm.SegmentList[i].SegmentID; segModel.SegmentColor = rm.SegmentList[i].SegmentColor; segModel.Address = rm.SegmentList[i].Address; segModel.SegmentName = rm.SegmentList[i].SegmentName; SegmentList.Add(segModel); } }