/[cits3200i]/branches/playback-branch-rvvs89/UWAPlugins/PlaybackPlugin/Source/PlaybackAnimationRouteControlLayer.cs


UCC Code Repository

Contents of /branches/playback-branch-rvvs89/UWAPlugins/PlaybackPlugin/Source/PlaybackAnimationRouteControlLayer.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 61 - (show annotations) (download)
Thu Sep 30 03:03:02 2010 UTC (11 years, 2 months ago) by rvvs89
File size: 2742 byte(s)
Implemented playback.
Timer resolution and playback bar resolution is currently hardcoded into PlaybackControl.
Removed some listeners from PlaybackControl that were not necessary.
Print current time and time limits to status bar.
Update current position of the playback bar is altered by the user.
If current state is Paused and Rewind or FastForward is pressed, then step back/forward one unit of STEP_SIZE.
Added FollowButton that causes the map to follow playback when checked.
Added FollowIcon for FollowButton.
Increased size of PlaybackDialog to accomodate the new button.
If LoopButton is checked, move back to the startTime if the currentTime exceeds endTime.
If LoopButton is not checked, go to stopped state if the end is reached.
If PlayButton is pressed and currentTime is equal to endTime, move it back to startTime.
If no section of track has been selected, use the entire track.
If a section of track has been selected, use that as the start and end limits for playback.
If a single point on the track has been selected, start playback from that point.
Display markers at the start and end limits.
Don't display markers at the start and end limits if they coincide with the start and end of the track.
On form closing, remove ST event listeners, restore previous selection of track, disable playback timer, hide map markers and dispose forms.
Moved icons that are not compiled in to the executable to a separate directory, Data (start.png, stop.png).
Restructured Plugin to allow other source files to reference it.
Attempt to find icons in the plugin data directory using references from Plugin.
Added PlaybackRouteControlSelection, a simple implementation of IRouteControlSelection to allow PlaybackPlugin to alter the selected area of track thereby allowing playback.
Added a hack to PlaybackControl to prevent problems with Visual Studio's Designer, though the designer still seems to think there are problems with properties.
Added CurrentTime property to PlaybackControl to automatically trigger UI updates when the currentTime is modified.
Added functions to calculate times from the distances provided by SportTracks selection utility since it provides no simple way to convert from distance to time, only from time to distance.
Added listener to SelectedItems on the route control to watch for user interaction, playback is moved to the point the user selected bounded to the current playback limits.
Modified build script to include the Data directory.
Reduced AssemblyInfo version number to 0.1 since this is an alpha.
Removed playing.cs, it doesn't do anything.
Probably some other things too.
1 using System;
2 using System.Collections.Generic;
3 using System.Drawing;
4 using System.IO;
5 using System.Text;
6 using ZoneFiveSoftware.Common.Data.GPS;
7 using ZoneFiveSoftware.Common.Visuals.Fitness;
8 using ZoneFiveSoftware.Common.Visuals.Mapping;
9
10 namespace PlaybackPlugin.Source
11 {
12 class PlaybackAnimationRouteControlLayer : IRouteControlLayer
13 {
14 private static IList<PlaybackAnimationRouteControlLayer> instances = new List<PlaybackAnimationRouteControlLayer>(3);
15 private IRouteControlLayerProvider provider;
16 private IRouteControl control;
17 private MapMarker startMarker;
18 private MapMarker endMarker;
19 private IList<IMapOverlay> overlays = new List<IMapOverlay>(2);
20
21 public MapMarker StartMarker
22 {
23 get { return startMarker; }
24 }
25
26 public MapMarker EndMarker
27 {
28 get { return endMarker; }
29 }
30
31 public PlaybackAnimationRouteControlLayer(IRouteControlLayerProvider provider, IRouteControl control)
32 {
33 this.provider = provider;
34 this.control = control;
35 startMarker = new MapMarker(new GPSPoint(0.0f, 0.0f, 0.0f), MakeMapIcon("PlaybackPlugin\\Data\\start.png", new Size(16, 16)), false);
36 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 public void UpdateMarkers()
46 {
47 control.MapControl.RemoveOverlays(overlays);
48 control.MapControl.AddOverlays(overlays);
49 }
50
51 private MapIcon MakeMapIcon(string name, Size size)
52 {
53 string testPath = Plugin.Instance.Application.Configuration.CommonPluginsInstalledFolder + "\\" + Plugin.Instance.Id.ToString("D") + "\\" + name;
54 if (File.Exists(testPath))
55 {
56 return new MapIcon(testPath, size, new Point(size.Width / 2, size.Height / 2));
57 }
58 return null;
59 }
60
61 public static IList<PlaybackAnimationRouteControlLayer> Instances
62 {
63 get { return instances; }
64 }
65
66 public IRouteControlLayerProvider Provider
67 {
68 get { return provider; }
69 }
70
71 public int ZOrder
72 {
73 get { return 0; }
74 }
75
76 public IRouteControl Control
77 {
78 get { return control; }
79 }
80 }
81 }

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26