public void ExtractFootTrace() { CheapRuler ruler = new CheapRuler(_footTrace[0].Latitude); ProbeExtractorOptions options = new ProbeExtractorOptions(); ProbeExtractor extractor = new ProbeExtractor(ruler, options); List <Probe> extractedProbes = extractor.ExtractProbes(_footTrace); Assert.AreEqual(40, extractedProbes.Count); }
public void ExtractProbes() { CheapRuler ruler = CheapRuler.FromTile(49, 7); ProbeExtractorOptions options = new ProbeExtractorOptions() { MinTimeBetweenProbes = 1, // seconds MaxDistanceRatioJump = 3, // do not include probes when the distance is 3 times bigger than the previous one MaxDurationRatioJump = 3, // do not include probes when the duration is 3 times bigger than the previous one MaxAcceleration = 15, // meters per second per second MaxDeceleration = 18 // meters per second per second }; ProbeExtractor extractor = new ProbeExtractor(ruler, options); List <Probe> extractedProbes = extractor.ExtractProbes(_trace); Assert.AreEqual(12, extractedProbes.Count, "12 probes were expected to be extracted"); for (int i = 0; i < extractedProbes.Count; i++) { Probe fp = _probes[i]; // fixture probe Probe ep = extractedProbes[i]; // extracted probe Assert.AreEqual(fp.Longitude, ep.Longitude, 0.001, "probe[" + i.ToString() + "]: longitude doesn't match"); Assert.AreEqual(fp.Latitude, ep.Latitude, 0.001, "probe[" + i.ToString() + "]: latitude doesn't match"); Assert.AreEqual(fp.StartTime, ep.StartTime, "probe[" + i.ToString() + "]: start time doesn't match"); Assert.AreEqual(fp.Duration, ep.Duration, "probe[" + i.ToString() + "]: duration doesn't match"); Assert.AreEqual(fp.Speed, ep.Speed, 0.001, "probe[" + i.ToString() + "]: speed doesn't match"); Assert.AreEqual(fp.Bearing, ep.Bearing, 0.001, "probe[" + i.ToString() + "]: bearing doesn't match"); Assert.AreEqual(fp.Distance, ep.Distance, 0.001, "probe[" + i.ToString() + "]: distance doesn't match"); Assert.AreEqual(fp.IsGood, ep.IsGood, "probe[" + i.ToString() + "]: longitude doesn't match"); } options.MinTimeBetweenProbes = 2; extractor = new ProbeExtractor(ruler, options); extractedProbes = extractor.ExtractProbes(_trace); Assert.AreEqual(5, extractedProbes.Count, "5 probes were expected to be extracted"); options.OutputBadProbes = true; extractor = new ProbeExtractor(ruler, options); extractedProbes = extractor.ExtractProbes(_trace); Assert.AreEqual(13, extractedProbes.Count, "13 probes were expected to be extracted"); }