public void Parse()
    {
        StreamReader reader = File.OpenText(FileName);
        string       line;

        Target.TrajectoryDataSet.Clear();
        reader.ReadLine();
        while ((line = reader.ReadLine()) != null)
        {
            TransferTrajectoryData tmp = new TransferTrajectoryData();
            string[] items             = line.Split(new string[] { "  " }, StringSplitOptions.RemoveEmptyEntries);
            DateTime date;
            DateTime.TryParse(items[0], out date);
            tmp.UTCTime = (long)(date.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
            float.TryParse(items[1], out tmp.Position.x);
            float.TryParse(items[2], out tmp.Position.y);
            float.TryParse(items[3], out tmp.Position.z);

            Target.TrajectoryDataSet.Add(tmp);
        }
        UnityEditor.EditorUtility.SetDirty(Target);
    }
Exemplo n.º 2
0
 private void FindCurrentPositions(out TransferTrajectoryData prevPoint, out TransferTrajectoryData nextPoint, out int index)
 {
     prevPoint = null;
     nextPoint = null;
     index     = 0;
     for (int i = 0; i < Positions.Count; i++)
     {
         if (Positions[i].UTCTime > GlobalTime)
         {
             nextPoint = Positions[i];
             if (i != 0)
             {
                 index     = i - 1;
                 prevPoint = Positions[index];
             }
             break;
         }
     }
     if (nextPoint == null)
     {
         index     = Positions.Count - 1;
         prevPoint = Positions[index];
     }
 }