Example #1
0
 public void UpdateDynamicEvent(MovableTarget target, bool identified)
 {
     if (target.Lon <= -180 || target.Lon > 180 || target.Lat < -90 || target.Lat > 90)
     {
         return;
     }
     this.Dispatcher.BeginInvoke((Action) delegate()
     {
         lock (this)
         {
             TrackCanvas track = getTrackAnyTime(target.GetId());
             if (track == null)
             {
                 return;
             }
             track.OpacityInfo = identified ? 1 : 0.4;
             track.IsFill      = !identified;
             track.UpdateDynamicEvent(target);
             if (!identified && MenuBarsBaseInfo.Instance.OnlyShowIdentifiedTrack)
             {
                 track.Visibility = System.Windows.Visibility.Collapsed;
             }
             else
             {
                 track.Visibility = System.Windows.Visibility.Visible;
             }
         }
     });
 }
 private void disposeSelectedTrack()
 {
     if (_track != null)
     {
         (MenuBarsBaseInfo.Instance.SelectedTarget as MovableTarget).PropertyChanged -= SelectingTargetCanvas_PropertyChanged;
         _track.Selected = false;
     }
     _track = null;
 }
Example #3
0
        private void addShow(string id, ref TrackCanvas track)
        {
            TrackCanvas target = new TrackCanvas(_locator, EnumerateType, _stroke, _fill, true);

            if (_dynamicObjectEvent.TryAdd(id, target))
            {
                track = target;
                this.Children.Add(target);
            }
        }
Example #4
0
        private TrackCanvas getTrackAnyTime(string id)
        {
            TrackCanvas track = null;

            if (!_dynamicObjectEvent.TryGetValue(id, out track))
            {
                addShow(id, ref track);
            }
            return(track);
        }
 void SelectingTargetCanvas_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "UpdateData" || e.PropertyName == "UpdateDataLast")
     {
         updateStatusString();
     }
     else if (e.PropertyName == "Invisible")
     {
         SelectedTrack = null;
     }
 }
Example #6
0
        public TrackCanvas Clone()
        {
            TrackCanvas clone = new TrackCanvas(_locator, EnumerateType, _stroke, _fill, IsFill);

            clone._target = _target.Clone();
            clone._geometry.Update(_geometry.MMSI, (int)_geometry.Sog, _geometry.Cog, _geometry.Heading, _geometry.DisplayStatusPrev);
            clone.Opacity = this.Opacity;
            clone.UpdateShow();
            clone.Selected = Selected;
            return(clone);
        }
Example #7
0
 public void UpdateStaticEvent(MovableTarget target)
 {
     this.Dispatcher.BeginInvoke((Action) delegate()
     {
         lock (this)
         {
             TrackCanvas track = getTrackAnyTime(target.GetId());
             if (track != null)
             {
                 track.UpdateStaticEvent(target);
             }
         }
     });
 }
 private void updateSelectedTrack(TrackCanvas track)
 {
     _track = track;
     if (_track != null)
     {
         _track.Selected = true;
         IMovableTarget target = _track.GetTarget();
         MenuBarsBaseInfo.Instance.SelectedTarget = target;
         if (MenuBarsBaseInfo.Instance.SelectedTarget != null)
         {
             (MenuBarsBaseInfo.Instance.SelectedTarget as MovableTarget).PropertyChanged += SelectingTargetCanvas_PropertyChanged;
         }
     }
     else
     {
         MenuBarsBaseInfo.Instance.SelectedTarget = null;
     }
 }
Example #9
0
 public void UpdateDynamicEvent(MovableTarget target)
 {
     if (target.Lon <= -180 || target.Lon > 180 || target.Lat < -90 || target.Lat > 90)
     {
         return;
     }
     this.Dispatcher.BeginInvoke((Action) delegate()
     {
         lock (this)
         {
             TrackCanvas track = getTrackAnyTime(target.GetId());
             if (track != null)
             {
                 track.UpdateDynamicEvent(target);
             }
         }
     });
 }
Example #10
0
 /// <summary>
 /// 数据备份
 /// </summary>
 /// <param video="clone">clone data</param>
 public TracksCanvas Clone()
 {
     lock (this)
     {
         TracksCanvas clone = new TracksCanvas(_locator);
         clone.SetColor(_fill, _stroke);
         foreach (var target in _dynamicObjectEvent)
         {
             TrackCanvas track = target.Value.Clone();
             track.OpacityInfo = target.Value.OpacityInfo;
             if (clone._dynamicObjectEvent.TryAdd(target.Key, track))
             {
                 clone.Children.Add(track);
             }
         }
         return(clone);
     }
 }
Example #11
0
 public void UpdateName(int trackID, string name)
 {
     this.Dispatcher.BeginInvoke((Action) delegate()
     {
         lock (_dynamicObjectEvent)
         {
             TrackCanvas track = getTrackAnyTime(trackID.ToString());
             if (track == null)
             {
                 return;
             }
             var target = track.GetTarget() as MovableTarget;
             if (target != null)
             {
                 target.Name = name;
             }
         }
     });
 }