Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 public TimelineValue(TimelineValueType type, Track track)
 {
     this.Type = type;
     this.Track = track;
     this.Start = track.StartTime.StripSeconds();
     this.Finish = track.StartTime.StripSeconds();
 }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 8
0
 private void ClearActive()
 {
     if (m_activeTrack != null) {
         m_activeTrack = null;
     }
 }
Ejemplo n.º 9
0
 private void AddPin(Track track)
 {
     if (track.PointCount > 0) {
         TrackPoint p = track[0];
         browser.InvokeScript("addMarker", track.Id, p.Latitude, p.Longitude);
     }
 }
Ejemplo n.º 10
0
        public void RemoveTrack(Track track, bool refresh = true)
        {
            if (track != null && m_tracks.Contains(track)) {
                m_tracks.Remove(track);

                if (refresh) {
                    RefreshMap();
                }
            }
        }
Ejemplo n.º 11
0
        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;
        }
Ejemplo n.º 12
0
 private void TrackTreeView_ActivateTrack(object sender, Track track)
 {
     Events.GetEvent<TrackActivatedEvent>().Publish(track);
 }
Ejemplo n.º 13
0
        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;
        }
Ejemplo n.º 14
0
 private void RefreshRoutes(Track track)
 {
 }
 // googleMapView
 private void GoogleMapView_TrackDoubleClicked(object sender, Track track)
 {
     PersonalDomain.Domain.EventAggregator.GetEvent<DeviceTrackActivatedEvent>().Publish(track);
 }
Ejemplo n.º 16
0
        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;
        }
Ejemplo n.º 17
0
        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);
            }
        }
Ejemplo n.º 18
0
 /// <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;
        }
Ejemplo n.º 21
0
 // googleMapView
 private void GoogleMapView_TrackDoubleClicked(object sender, Track track)
 {
     Events.GetEvent<TrackActivatedEvent>().Publish(track);
 }
Ejemplo n.º 22
0
        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);
                }
            }
             */
        }
Ejemplo n.º 23
0
 private void RefreshRegion(Track track)
 {
 }
Ejemplo n.º 24
0
        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);
            }
        }
Ejemplo n.º 25
0
        private void SetActive(Track track)
        {
            if (track != m_activeTrack) {
                ClearActive();
                m_activeTrack = track;

                //if (AddTrack(m_activeTrack)) {
                //}
            }
        }
Ejemplo n.º 26
0
 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;
 }
Ejemplo n.º 28
0
        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);
 }
Ejemplo n.º 30
0
 public void Remove(Track track)
 {
     m_children.Remove(track);
 }