private CoursePass CreatePass(List<Measurement> measurements)
        {
            if (this.m_course == null)
                FindCourse(measurements);
            
            if (this.m_course == null)
            {
                Logger.Log("Unable to find a course for this ski run.");       
                return null;
            }

            if (m_rope == null)
                m_rope = Rope.Default;

            CoursePass pass = new CoursePass(m_course, m_rope, CenterLineDegreeOffset);
            for (int i = 0; i < measurements.Count; i++)
            {
                Measurement current = measurements[i];
                current.BoatPosition = pass.CoursePositionFromGeo(current.BoatGeoCoordinate);               
                if (current.BoatPosition == CoursePosition.Empty)
                    continue;               
                
                CalculateInCourse(pass, measurements, i);
                CalculateCurrent(measurements, i);
                pass.Track(current);

                // If the handle has passed the 55s, we're done here.
                if (current.HandlePosition.Y > Course.LengthM)
                    break;
            }
            
            CalculateCoursePassSpeed(pass);
            return pass;
        }
Exemple #2
0
        public void CoursePositionFromGeoTest()
        {
            // Grab a boatposition and verify where in the X,Y course plane it should fit.
            // 7.45, 42.289983, -71.358973, 13.68, 0.11289 <-- before the course
            // 21.63, 42.288066, -71.359257, 14.87, 0.50935 <-- just prior to ball 1, after gate crossing
            // 40.71, 42.285529, -71.359519, 14.27, 0.59728 <-- between exit gates and the 55's
            // 45.32, 42.285165, -71.359369, 5.60, -0.10074 <-- way past the course, looping around

            // 15.02, 42.288937, -71.359136, 14.33, 0.77112 <-- boat is passing through the 55s.

            //42.2867806,"Longitude":-71.3594418 == Chet @ 15 seconds into the GOPR0565.mp4
            // .\slalom\SlalomTracker\Video\MetadataExtractor\GOPR0565.json
            CoursePassFactory factory  = new CoursePassFactory();
            CoursePass        pass     = factory.FromFile("./Video/GOPR0565.json");
            CoursePosition    position = pass.CoursePositionFromGeo(42.2867806, -71.3594418);

            Assert.IsTrue((int)position.X == 0, "Incorrect course X position.");
            Assert.IsTrue((int)position.Y == 61, "Incorrect course Y position.");
        }