/[cits3200i]/trunk/UWAPlugins/PlaybackPlugin/Source/PlaybackAnimationRouteControlLayer.cs


UCC Code Repository

Diff of /trunk/UWAPlugins/PlaybackPlugin/Source/PlaybackAnimationRouteControlLayer.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 61 by kevinhuynh, Tue Sep 28 17:39:53 2010 UTC revision 62 by rvvs89, Thu Sep 30 03:22:02 2010 UTC
# Line 1  Line 1 
1  ´╗┐using System;  ´╗┐using System;
2  using System.Collections.Generic;  using System.Collections.Generic;
3    using System.Drawing;
4    using System.IO;
5  using System.Text;  using System.Text;
6    using ZoneFiveSoftware.Common.Data.GPS;
7  using ZoneFiveSoftware.Common.Visuals.Fitness;  using ZoneFiveSoftware.Common.Visuals.Fitness;
8  using ZoneFiveSoftware.Common.Visuals.Mapping;  using ZoneFiveSoftware.Common.Visuals.Mapping;
9    
# Line 8  namespace PlaybackPlugin.Source Line 11  namespace PlaybackPlugin.Source
11  {  {
12      class PlaybackAnimationRouteControlLayer : IRouteControlLayer      class PlaybackAnimationRouteControlLayer : IRouteControlLayer
13      {      {
14          private static PlaybackAnimationRouteControlLayer instance;          private static IList<PlaybackAnimationRouteControlLayer> instances = new List<PlaybackAnimationRouteControlLayer>(3);
         private static IList<IRouteControlSelection> selection;  
15          private IRouteControlLayerProvider provider;          private IRouteControlLayerProvider provider;
16          private IRouteControl control;          private IRouteControl control;
17            private MapMarker startMarker;
18            private MapMarker endMarker;
19            private IList<IMapOverlay> overlays = new List<IMapOverlay>(2);
20    
21          public static PlaybackAnimationRouteControlLayer Instance          public MapMarker StartMarker
22          {          {
23              get { return instance; }              get { return startMarker; }
24          }          }
25    
26          public static IList<IRouteControlSelection> Selection          public MapMarker EndMarker
27          {          {
28              get { return selection; }              get { return endMarker; }
29          }          }
30    
31          public PlaybackAnimationRouteControlLayer(IRouteControlLayerProvider provider, IRouteControl control)          public PlaybackAnimationRouteControlLayer(IRouteControlLayerProvider provider, IRouteControl control)
32          {          {
33              this.provider = provider;              this.provider = provider;
34              this.control = control;              this.control = control;
35              instance = this;              startMarker = new MapMarker(new GPSPoint(0.0f, 0.0f, 0.0f), MakeMapIcon("PlaybackPlugin\\Data\\start.png", new Size(16, 16)), false);
36              control.SelectedItemsChanged += new EventHandler(control_SelectedItemsChanged);              startMarker.Visible = false;
37                overlays.Add(startMarker);
38                endMarker = new MapMarker(new GPSPoint(0.0f, 0.0f, 0.0f), MakeMapIcon("PlaybackPlugin\\Data\\stop.png", new Size(16, 16)), false);
39                endMarker.Visible = false;
40                overlays.Add(endMarker);
41                control.MapControl.AddOverlays(overlays);
42                instances.Add(this);
43                        
44          }          }
45    
46          private void control_SelectedItemsChanged(object source, EventArgs e)          public void UpdateMarkers()
47          {          {
48              selection = control.SelectedItems;              control.MapControl.RemoveOverlays(overlays);
49                control.MapControl.AddOverlays(overlays);
50          }          }
51    
52                    private MapIcon MakeMapIcon(string name, Size size)
53            {
54                string testPath = Plugin.Instance.Application.Configuration.CommonPluginsInstalledFolder + "\\" + Plugin.Instance.Id.ToString("D") + "\\" + name;
55                if (File.Exists(testPath))
56                {
57                    return new MapIcon(testPath, size, new Point(size.Width / 2, size.Height / 2));
58                }
59                return null;
60            }
61    
62            public static IList<PlaybackAnimationRouteControlLayer> Instances
63            {
64                get { return instances; }
65            }
66    
67          public IRouteControlLayerProvider Provider          public IRouteControlLayerProvider Provider
68          {          {

Legend:
Removed from v.61  
changed lines
  Added in v.62

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26