private void Add() { Timepaths item = new Timepaths("1", "1.png"); List <Timepaths> items = new List <Timepaths>(); items.Add(item); Paths paths = new Paths("20180619", items); List <Paths> ppp = new List <Paths>(); ppp.Add(paths); Data data = new Data("3", "555", "666", "3", ppp); if (status != null) { status.data.Add(data); } }
/// <summary> /// 往PointClass类里面加点,用于最后的存储刷新文本记录 /// </summary> /// <param name="index"></param> /// <param name="jingdu"></param> /// <param name="weidu"></param> /// <param name="imagepath"></param> /// <param name="date"></param> public void AddPointToPointClass(string jingdu, string weidu, string imagepath, string date) { int tempid = -1; if (pointData == null) { return; } if (pointData.data.Count != 0) { for (int i = 0; i < pointData.data.Count; i++) { int id = int.Parse(pointData.data[i].id); int count = int.Parse(pointData.data[i].count); string pointjingdu = pointData.data[i].jingdu; string pointweidu = pointData.data[i].weidu; //如果有当前经纬度 if (pointweidu == weidu && pointjingdu == jingdu) { tempid = id; List <Paths> path = pointData.data[i].paths; List <Timepaths> timepathses = new List <Timepaths>(); for (int j = 0; j < path.Count; j++) { //如果有当前的日期 Timepaths tt; if (path[j].time == date) { pointData.data[i].count = (++count).ToString(); timepathses = path[j].timepaths; var pathsCount = timepathses.Count; Debug.Log(pathsCount); tt = new Timepaths((++pathsCount).ToString(), imagepath); Debug.Log(pathsCount); timepathses.Add(tt); break; } //如果没有当前的日期 else if (j == path.Count - 1) { pointData.data[i].count = (++count).ToString(); tt = new Timepaths("1", imagepath); timepathses.Add(tt); j++; Paths pp = new Paths(); pp.time = date; pp.timepaths = timepathses; path.Add(pp); break; } } break; } //如果没有当前ID else if (i == pointData.data.Count - 1) { Timepaths item = new Timepaths("1", imagepath); List <Timepaths> items = new List <Timepaths>(); items.Add(item); Paths paths = new Paths(date, items); List <Paths> ppp = new List <Paths>(); ppp.Add(paths); int num = pointData.data.Count; tempid = ++num; Data data = new Data(tempid.ToString(), jingdu, weidu, "1", ppp); pointData.data.Add(data); break; } } } else { Timepaths item = new Timepaths("1", imagepath); List <Timepaths> items = new List <Timepaths>(); items.Add(item); Paths paths = new Paths(date, items); List <Paths> ppp = new List <Paths>(); ppp.Add(paths); int num = pointData.data.Count; tempid = ++num; Data data = new Data(tempid.ToString(), jingdu, weidu, "1", ppp); pointData.data.Add(data); } UpdateImageShowClass(pointData); AddPoint(jingdu, weidu, imagepath, "1", tempid.ToString()); }