public void InsertTrajectories(GPSTrajectory traj) { int userid = traj.UserID; if (usersTrajectoriesDictionary.IndexOfKey(userid) == -1) { usersTrajectoriesDictionary[userid] = new List <int> (); } usersTrajectoriesDictionary[userid].Add(gpsTrajectoriesData.Count); gpsTrajectoriesData.Add(traj); }
public static GPSTrajectory LineStringToGPSTrajectory(int id, LineString ls, int[] times) { if (ls.Count != times.Length) { throw new InvalidOperationException("输入的点数和时间数不一致"); } GPSTrajectory gt = new GPSTrajectory(id); for (int i = 0; i < times.Length; i++) { gt.AddPoint(ls[i].X, ls[i].Y, times[i]); } return(gt); }