public CourseDesignator(Id<Course> course, VariationInfo variationInfo) : this(course) { this.variationInfo = variationInfo; }
public CourseDesignator(Id<Course> course, VariationInfo variationInfo, int part) : this(course, part) { this.variationInfo = variationInfo; }
private static string GetVariationString(EventDB eventDB, Id<Course> courseId, VariationInfo.VariationPath variationPath, Dictionary<Id<CourseControl>, char> variationMapper) { return GetVariationString(eventDB, variationPath.Choices, variationMapper); }
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); }
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 } }
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(); }
protected abstract void WriteCourseStart(CourseView courseView, string courseName, int courseNumber, string[] classNames, bool isScore, int variationNumber, VariationInfo variationInfo);