Example #1
0
 public CourseDesignator(Id<Course> course, VariationInfo variationInfo)
     : this(course)
 {
     this.variationInfo = variationInfo;
 }
Example #2
0
 public CourseDesignator(Id<Course> course, VariationInfo variationInfo, int part)
     : this(course, part)
 {
     this.variationInfo = variationInfo;
 }
Example #3
0
 private static string GetVariationString(EventDB eventDB, Id<Course> courseId, VariationInfo.VariationPath variationPath, Dictionary<Id<CourseControl>, char> variationMapper)
 {
     return GetVariationString(eventDB, variationPath.Choices, variationMapper);
 }
Example #4
0
 public static string GetVariationString(EventDB eventDB, Id<Course> courseId, VariationInfo.VariationPath variationPath)
 {
     Dictionary<Id<CourseControl>, char> variationMapper = GetVariantCodeMapping(eventDB, new CourseDesignator(courseId));
     return GetVariationString(eventDB, courseId, variationPath, variationMapper);
 }
Example #5
0
        protected override void WriteCourseStart(CourseView courseView, string courseName, int courseNumber, string[] classNames, bool isScore, int variationNumber, VariationInfo variationInfo)
        {
            xmlWriter.WriteStartElement("Course");

            if (variationInfo != null) {
                xmlWriter.WriteElementString("Name", variationInfo.CodeString);
                xmlWriter.WriteElementString("CourseFamily", courseName);
            }
            else {
                xmlWriter.WriteElementString("Name", courseName);
            }

            if (!isScore) {
                xmlWriter.WriteElementString("Length", XmlConvert.ToString(Math.Round(courseView.MaxTotalLength / 100F) * 100F));   // round to nearest 100m
                if (courseView.TotalClimb > 0)
                    xmlWriter.WriteElementString("Climb", XmlConvert.ToString(Math.Round(courseView.TotalClimb / 5, MidpointRounding.AwayFromZero) * 5.0));  // round to nearest 5m
            }
        }
Example #6
0
        void WriteSingleCourseVariation(CourseDesignator courseDesignator, string courseName, int courseNumber, string[] classNames, bool isScore, int variationNumber, VariationInfo variationInfo)
        {
            float distanceThisLeg = 0;
            int sequenceNumber = 1;     // score courses need sequence #'s, even though there is no sequence.

            CourseView courseView = CourseView.CreateViewingCourseView(eventDB, courseDesignator);

            WriteCourseStart(courseView, courseName, courseNumber, classNames, isScore, variationNumber, variationInfo);

            // Go through the control views.
            int controlViewIndex = 0;
            while (controlViewIndex >= 0 && controlViewIndex < courseView.ControlViews.Count) {
                CourseView.ControlView controlView = courseView.ControlViews[controlViewIndex];
                ControlPointKind kind = eventDB.GetControl(controlView.controlId).kind;

                WriteCourseControl(kind, controlView, isScore, ref sequenceNumber, ref distanceThisLeg);

                if (controlView.legLength != null)
                    distanceThisLeg += controlView.legLength[0];

                if (isScore)
                    ++controlViewIndex;
                else
                    controlViewIndex = courseView.GetNextControl(controlViewIndex);
            }

            WriteCourseEnd();
        }
Example #7
0
 protected abstract void WriteCourseStart(CourseView courseView, string courseName, int courseNumber, string[] classNames, bool isScore, int variationNumber, VariationInfo variationInfo);