public SequencedTrack SequenceTrack(Track track)
 {
     SequencedTrack seqTrack = new SequencedTrack(track,Message);
     String[] lines = File.ReadAllLines(@"SequencerPlugins\Models\Models.txt");
     String[] num = lines[3].Split(';');
     double numD = Convert.ToDouble(num[1]);
     List<List<double>> models = lines.ToList().ConvertAll(x => x.Split(';').ToList().ConvertAll(y => Convert.ToDouble(y)));
     models.ForEach(x => ApplyModel(x, seqTrack));
     return seqTrack;
 }
 public DialogResult ShowDialog(SequencedTrack sTrack, List<ITrackDisplay> displays, List<ITrackParser> parsers)
 {
     Text = sTrack.MethodName;
     this.sTrack = sTrack;
     this.displays = displays;
     this.parsers = parsers;
     start = 0;
     end = sTrack.Track.TrackItems.Length - 1;
     FillTable();
     LoadParsers();
     LoadDisplays();
     return ShowDialog();
 }
 public FormRoutesInScreenSetting(SequencedTrack track, int pos)
 {
     this.track = track.Track;
     this.pTracks = new List<ProccessedTrack>();
     if (RMMap == null)
         RMMap = new RouteManager();
     Route rt = TrackToRoute(track.Track);
     InitializeComponent();
     InitSourceGrid();
     foreach (Sequence seq in track.GetSequence(pos))
     {
         RMMap.CreateAndRoute(rt, seq.Start - 1, seq.End - 1);
         int iRouteSector = dataGridViewSel.Rows.Add(rt.NameOfRoute);
     }
     InitSelectedGrid();
 }
 public void ShowSequencedTrack(SequencedTrack track, int pos)
 {
     FormRoutesInScreenSetting friss = new FormRoutesInScreenSetting(track, pos);
     friss.ShowDialog();
     RouteManager manager = friss.RouteManager;
     StringBuilder sb = new StringBuilder(File.ReadAllText(@"DisplayPlugins\HTML\start.txt"));
     foreach (Route route in manager.Routes)
     {
         sb.Append(CreateFragmentFromRoute(route));
     }
     sb.AppendLine("map.setView([" + track.Track.TrackItems[pos].Latitude.ToString().Replace(',', '.') + "," + track.Track.TrackItems[pos].Longitude.ToString().Replace(',', '.') + "]);");
     sb.Append(File.ReadAllText(@"DisplayPlugins\HTML\end.txt"));
     String fileName = @"DisplayPlugins\HTML\temp.html";
     File.WriteAllText(fileName, sb.ToString().Replace("<title></title>", "<title>"+track.MethodName+"</title>"));
     Process.Start(fileName);
 }
 public SequencedTrack SequenceTrack(Track track)
 {
     curLen = Parameters[0].IntegerValue;
     minDist = Parameters[1].IntegerValue;
     List<MatchCount> seqList = new List<MatchCount>();
     SequencedTrack seqTrack = new SequencedTrack(track, "Прямой поиск");
     for (int i = 0; i < track.TrackItems.Length - curLen - 1; i++)
     {
         List<TrackItem> matches = new List<TrackItem>();
         for (int j = 0; j < track.TrackItems.Length - curLen; j++)
         {
             if (Compare(track, i, j))
                 seqTrack.AddSequence(i, j + 1, curLen);
         }
     }
     return seqTrack;
 }
 private void ApplyModel(List<double> model, SequencedTrack sTrack)
 {
     List<double> inverted = new List<double>();
     int minus = 1;
     for (int i = model.Count - 1; i >= 0; i--)
     {
         inverted.Add(minus * model[i]);
         minus *= -1;
     }
     TrackItem[] items = sTrack.Track.TrackItems;
     int iLen=items.Length;
     for (int i = 0; i < iLen; i += 2)
     {
         double res = 0;
         for (int j = 0; j < inverted.Count; j++)
             res += inverted[j] * items[(i + j) % iLen].Latitude;
         if (Math.Abs(res) < 0.0001)
         {
             sTrack.AddSequence(i, model.Count,model.Count);
             sTrack.AddSequence((i + 1) % iLen, model.Count,model.Count);
         }
     }
 }
예제 #7
0
        public void SaveFilteredSequencedTrack(SequencedTrack sTrack, int from, int to, String fileName)
        {
            string connectionString = GetConnectionString(fileName);
            using (OleDbConnection conn = new OleDbConnection(connectionString))
            {
                conn.Open();
                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection = conn;
                StringBuilder sb = new StringBuilder();
                sb.Append("CREATE TABLE [" + sTrack.MethodName + "] (Номер INT, Широта FLOAT, Долгота FLOAT, Время_в_начале DATE, Последовательности TEXT)");

                cmd.CommandText = sb.ToString();
                cmd.ExecuteNonQuery();
                for (int i = from; i < to; i++)
                {
                    TrackItem pVec = sTrack.Track.TrackItems[i];
                    cmd.CommandText = "INSERT INTO [" + sTrack.MethodName + "] VALUES(" + (i + 1).ToString() + "," + pVec.Latitude.ToString().Replace(',', '.') + "," + pVec.Longitude.ToString().Replace(',', '.') + ",'" + pVec.Date.ToString() + "'," + "'"+ String.Join(", ",sTrack.GetSequence(i).ConvertAll(x=>x.Start.ToString("00")).ToArray())+"');";
                    //MessageBox.Show(cmd.CommandText);
                    cmd.ExecuteNonQuery();
                }
                conn.Close();
            }
        }
예제 #8
0
 /// <summary>
 /// Показать трек с последовтальеностями в таблице
 /// </summary>
 /// <param name="sTrack">Трек с последовательностями</param>
 private void ShowSequencedTrackTable(SequencedTrack sTrack)
 {
     ShowSequencedTrackForm sstf = new ShowSequencedTrackForm();
     sstf.ShowDialog(sTrack,displays,parsers);
 }