コード例 #1
0
ファイル: MapMining.cs プロジェクト: duckieuminh/wotbot
        private void loadTrajectory_obsolete()
        {
            using (StreamReader sr = new StreamReader(TBConst.trajectoryPath_obsolete + this.map_name + ".txt"))
            {
                int tot_point = 0;
                while (true)
                {
                    if (sr.EndOfStream)
                        break;
                    Trajectory traj = new Trajectory();
                    string comment = sr.ReadLine(); //replay_id 19 user_id 1686
                    string line = sr.ReadLine(); // 9.8 93.15 9.9 93.0 10.05 92.8 .......
                    string[] sp = line.Split(' ');
                    //for (int i = 0; i < sp.Length; i += 2)
                    {
                        int i = 0;
                        double x = Convert.ToDouble(sp[i]);
                        double y = Convert.ToDouble(sp[i + 1]);
                        x = (x + 105) / 21 + 1;
                        y = (y + 105) / 21 + 1;
                        traj.add_point(new Point(x, y));

                    }
                    traj.comment = comment;
                    traj = pruneTrajectory(traj, 0.05);
                    addToHeapmap_obsolete(traj);
                    traj.reversed = false;
                    trajs.Add(traj);
                    Trajectory rev = new Trajectory();
                    foreach (Point p in traj)
                    {
                        rev.add_point(p);
                    }
                    rev.Reverse();
                    rev.reversed = true;
                    trajs.Add(rev);
                    tot_point += traj.Count * 2;
                }

            }
        }