private void ImportOtherDrawingsData(Metadata metadata) { LinearKinematics linearKinematics = new LinearKinematics(); // Trackable drawing's individual points. foreach (ITrackable trackable in metadata.TrackableDrawings()) { Dictionary <string, TrackablePoint> trackablePoints = metadata.TrackabilityManager.GetTrackablePoints(trackable); if (trackablePoints == null) { continue; } foreach (var pair in trackablePoints) { TrackablePoint tp = pair.Value; Timeline <TrackFrame> timeline = pair.Value.Timeline; if (timeline.Count == 0) { continue; } List <TimedPoint> samples = timeline.Enumerate().Select(p => new TimedPoint(p.Location.X, p.Location.Y, p.Time)).ToList(); FilteredTrajectory traj = new FilteredTrajectory(); traj.Initialize(samples, metadata.CalibrationHelper); TimeSeriesCollection tsc = linearKinematics.BuildKinematics(traj, metadata.CalibrationHelper); string name = trackable.Name; Color color = trackable.Color; // Custom drawings may have dedicated names for their handles. DrawingGenericPosture dgp = trackable as DrawingGenericPosture; if (dgp == null) { name = name + " - " + pair.Key; } else { foreach (var handle in dgp.GenericPostureHandles) { if (handle.Reference.ToString() != pair.Key) { continue; } name = name + " - " + (string.IsNullOrEmpty(handle.Name) ? pair.Key : handle.Name); color = handle.Color == Color.Transparent ? trackable.Color : handle.Color; break; } } TimeSeriesPlotData data = new TimeSeriesPlotData(name, color, tsc); timeSeriesData.Add(data); filteredTrajectories.Add(data, traj); } } }
private void ParseTrackablePoint(XmlReader r, PointF scale, TimestampMapper timeMapper) { string key = ""; bool isEmpty = r.IsEmptyElement; if (r.MoveToAttribute("key")) { key = r.ReadContentAsString(); } TrackablePoint point = new TrackablePoint(r, scale, timeMapper); trackablePoints.Add(key, point); }