private TrackCollection LoadTracks() { TrackCollection tracks = new TrackCollection(); Track track; for (int i = 0; i < 30; i++) { track = new Track() { StartTime = new DateTime(2012, 3, 1, 11, i, 0), EndTime = new DateTime(2012, 3, 1, 11, i, 59) }; tracks.Add(track); } for (int i = 0; i < 20; i++) { track = new Track() { StartTime = new DateTime(2012, 3, 1, 12, 10 + i, 0), EndTime = new DateTime(2012, 3, 1, 12, 10 + i, 59) }; tracks.Add(track); } for (int i = 0; i < 20; i++) { track = new Track() { StartTime = new DateTime(2012, 3, 1, 13, 11 + i, 0), EndTime = new DateTime(2012, 3, 1, 13, 11 + i, 59) }; track.TrackType = TrackType.Event; tracks.Add(track); } for (int i = 0; i < 20; i++) { track = new Track() { StartTime = new DateTime(2012, 3, 1, 13, 31 + i, 0), EndTime = new DateTime(2012, 3, 1, 13, 31 + i, 59) }; tracks.Add(track); } return tracks; }
public TimelineValue(TimelineValueType type, Track track) { this.Type = type; this.Track = track; this.Start = track.StartTime.StripSeconds(); this.Finish = track.StartTime.StripSeconds(); }
/// <summary> /// .inc 파일을 읽어 각 라인을 TopicPoint로 생성하고, /// track에 추가한다. /// </summary> /// <param name="track"></param> /// <param name="reader"></param> protected void LoadPoints(Track track, TextReader reader) { if (track == null) throw new ArgumentNullException("track"); if (reader == null) throw new ArgumentNullException("reader"); string line; while ((line = reader.ReadLine()) != null) { if (Regex.IsMatch(line, @"^\d{4}-\d{2}-\d{2}")) { string[] items = line.Split2(','); if (items.Length >= 7) { TrackPoint p = new TrackPoint(); p.PointTime = DateTime.ParseExact(items[0], DATE_FORMAT, null); p.Latitude = Convert.ToDouble(items[1]); p.Longitude = Convert.ToDouble(items[2]); p.Velocity = Convert.ToDouble(items[3]); p.AccelerationX = Convert.ToDouble(items[4]); p.AccelerationY = Convert.ToDouble(items[5]); p.AccelerationZ = Convert.ToDouble(items[6]); track.AddPoint(p); } } } }
private TrackCollection LoadTracks() { TrackCollection tracks = new TrackCollection(); Track track = new Track() { StartTime = new DateTime(2012, 3, 1, 11, 11, 12), EndTime = new DateTime(2012, 3, 1, 11, 11, 59) }; tracks.Add(track); track = new Track() { StartTime = new DateTime(2012, 3, 1, 11, 1, 0), EndTime = new DateTime(2012, 3, 1, 11, 1, 59) }; tracks.Add(track); return tracks; }
public void LoadPointsTest() { TrackLoaderBase_Accessor target = new TrackLoaderBase_Accessor(); Track track = new Track(); string path = AppDomain.CurrentDomain.BaseDirectory; StreamReader reader = new StreamReader(Path.Combine(path, @"sample\track_log.inc")); target.LoadPoints(track, reader); Assert.AreEqual(track.PointCount, 26); // 시간 순으로 정렬되어 있는가? for (int i = 1; i < track.PointCount; i++) { Assert.IsTrue(track[i].PointTime >= track[i - 1].PointTime); } }
public void LengthTest() { TrackCollection target = new TrackCollection(); Track track = new Track() { StartTime = new DateTime(2012, 3, 1, 0, 0, 0) }; target.Add(track); long actual = target.Length; Assert.AreEqual(1, actual); track = new Track() { StartTime = new DateTime(2012, 3, 2, 3, 1, 0) }; target.Add(track); actual = target.Length; Assert.AreEqual(24 * 60 + 3 * 60 + 2, actual); }
public Track GetNext(Track track, bool isAll, bool isLoop) { if (isAll) { int index = m_tracks.IndexOf(track); if (index < m_tracks.Count - 1) { track = (Track)m_tracks.GetItemAt(index + 1); } else if (isLoop) { track = (Track)m_tracks.GetItemAt(0); } else { track = null; } } else { track = null; } return track; }
private void ClearActive() { if (m_activeTrack != null) { m_activeTrack = null; } }
private void AddPin(Track track) { if (track.PointCount > 0) { TrackPoint p = track[0]; browser.InvokeScript("addMarker", track.Id, p.Latitude, p.Longitude); } }
public void RemoveTrack(Track track, bool refresh = true) { if (track != null && m_tracks.Contains(track)) { m_tracks.Remove(track); if (refresh) { RefreshMap(); } } }
public bool AddTrack(Track track, bool refresh = true) { if (track != null && !m_tracks.Contains(track)) { m_tracks.Add(track); if (refresh) { RefreshMap(); } return true; } return false; }
private void TrackTreeView_ActivateTrack(object sender, Track track) { Events.GetEvent<TrackActivatedEvent>().Publish(track); }
public bool Delete(Track track) { if (TrackList.Delete(track)) { // .inc file string fileName = track.TrackFile; File.Delete(fileName); // .log file fileName = Path.ChangeExtension(track.TrackFile, "log"); File.Delete(fileName); // .264 file fileName = Path.ChangeExtension(track.TrackFile, "264"); File.Delete(fileName); // .mp4 file fileName = Path.ChangeExtension(track.TrackFile, "mp4"); File.Delete(fileName); return true; } return false; }
private void RefreshRoutes(Track track) { }
// googleMapView private void GoogleMapView_TrackDoubleClicked(object sender, Track track) { PersonalDomain.Domain.EventAggregator.GetEvent<DeviceTrackActivatedEvent>().Publish(track); }
protected Track CreateTrack(string path, bool convertVideo) { if (!File.Exists(path)) { return null; } // create date TrackType tt; DateTime d; if (!FileToDateTime(path, out d, out tt)) return null; Track track = new Track(); // track file track.TrackFile = path; // create date track.CreateDate = d; // track type track.TrackType = tt; // video file string s = Path.ChangeExtension(path, "264"); if (File.Exists(s)) { track.VideoFile = s; if (convertVideo) { track.MpegFile = VideoUtil.RawToMpeg(s, null); } } return track; }
private void Deserialize(XDocument doc) { XElement root = doc.Root; if (!ROOT_ELEMENT.Equals(root.Name.LocalName)) { throw new Exception("Xml is not a Track catalog file."); } IEnumerable<XElement> elts = root.Elements(TRACK_ELEMENT); foreach (XElement elt in elts) { Track track = new Track(); var val = elt.Attribute(CREATED_ATTR); track.CreateDate = DateTime.ParseExact((string)val, DATE_FORMAT, null); m_tracks.Add(track); } }
/// <summary> /// Track file을 읽어 Track 개체를 생성한다. /// </summary> /// <param name="fileName">경로와 확장자가 제외된 파일명.</param> private Track Add(string fileName) { DateTime date = new DateTime(); if (Repository.ParseTrackFile(fileName, ref date)) { if (date.Year == m_year && date.Month == m_month) { Track track = new Track(); track.VehicleId = m_vehicle.VehicleId; track.CreateDate = date; if (m_tracks != null) { m_tracks.Add(track); } return track; } } return null; }
private void TrackGroup_TrackChanged(TrackGroup group, Track track, string propName) { // 현재 재생 중인 것은 그냥 놔둔다. if (track == ActiveTrack && !track.IsChecked) { track.IsChecked = true; } if (track.IsChecked) { m_selectedTracks.Add(track); } else { m_selectedTracks.Remove(track); } }
private TrackGroup CreateRoot(Track startTrack, Track endTrack) { TrackGroupLevel level; DateTime dStart = startTrack.CreateDate; DateTime dEnd = endTrack.CreateDate; if (dStart.Year != dEnd.Year) { level = TrackGroupLevel.All; } else if (dStart.Month != dEnd.Month) { level = TrackGroupLevel.Year; } else if (dStart.Day != dEnd.Day) { level = TrackGroupLevel.Month; } else { level = TrackGroupLevel.Day; } TrackGroup root = new TrackGroup(startTrack.CreateDate, level); return root; }
// googleMapView private void GoogleMapView_TrackDoubleClicked(object sender, Track track) { Events.GetEvent<TrackActivatedEvent>().Publish(track); }
private void RefreshLocations(Track track) { /* if (m_locations == null) { m_locations = new List<Location>(); } else { m_locations.Clear(); } if (track != null) { foreach (TrackPoint p in track.Points) { Location loc = new Location(p.Lattitude, p.Longitude); m_locations.Add(loc); } } */ }
private void RefreshRegion(Track track) { }
private void FireTrackChangeEvent(TrackGroup group, Track track, string propName) { Action<TrackGroup, Track, string> eh = TrackChanged; if (eh != null) { eh(group, track, propName); } if (m_parent != null) { m_parent.FireTrackChangeEvent(this, track, propName); } }
private void SetActive(Track track) { if (track != m_activeTrack) { ClearActive(); m_activeTrack = track; //if (AddTrack(m_activeTrack)) { //} } }
private void UnregisterTrackEvents(Track track) { track.PropertyChanged -= new PropertyChangedEventHandler(track_PropertyChanged); }
/// <summary> /// 트랙 정보를 제거한다. /// </summary> /// <param name="track"></param> public bool Delete(Track track) { int index = m_tracks.IndexOf(track); if (index >= 0) { m_tracks.RemoveAt(index); return true; } return false; }
private void DeleteTrack(Repository repo, Track track, bool confirm) { if (confirm && DisplayMessage != null) { if (!DisplayMessage.Confirm("트랙 삭제", "트랙과 관련된 정보 및 영상 파일이 모두 삭제됩니다.\r\n삭제하시겠습니까?")) return; } // 재생 중이던 트랙이면 중지시킨다. if (track == ActiveTrack) { ActiveTrack = null; } // 선택 상태이면 선택을 해제한다. track.IsChecked = false; // 그룹에서 제거한다. track.Group.Remove(track); // 트랙 객체와 관련 파일들을 모두 삭제한다. repo.Delete(track); }
private void TrackTreeView_ActivateTrack(object sender, Track track) { PersonalDomain.Domain.EventAggregator.GetEvent<DeviceTrackActivatedEvent>().Publish(track); }
public void Remove(Track track) { m_children.Remove(track); }