CreateTextForDirective() public method

public CreateTextForDirective ( string symbolId, string distanceText ) : string
symbolId string
distanceText string
return string
Ejemplo n.º 1
0
        // Get a directive line for a map exchange at a control (not to the finish).
        private DescriptionLine GetMapExchangeAtControlLine(CourseView.ControlView controlWithExchange)
        {
            DescriptionLine line = new DescriptionLine();

            line.kind  = DescriptionLineKind.Directive;
            line.boxes = new object[2];

            // Distance is 0m at the control!
            string distanceText = string.Format("{0} m", 0);

            // Box 1: directive graphics.
            string symbolId = "13.5control";

            line.boxes[0] = symbolDB[symbolId];

            // Box 2: distance of the flagging
            line.boxes[1] = distanceText;

            // Get the text version of the control using the Textifier.
            Textifier textifier = new Textifier(eventDB, symbolDB, language);

            line.textual = textifier.CreateTextForDirective(symbolId, distanceText);

            // The course control IDs, for use in coordinating the selection
            line.controlId       = controlWithExchange.controlId;
            line.courseControlId = controlWithExchange.courseControlIds[0];

            return(line);
        }
Ejemplo n.º 2
0
        // Get a directive line for a marked route (not to the finish). The legId must be valid, because a marked route only occurs
        // with a real leg id.
        private DescriptionLine GetMarkedRouteLine(CourseView.ControlView controlViewFrom, CourseView.ControlView controlViewTo, Id <Leg> legId)
        {
            Leg leg = eventDB.GetLeg(legId);

            Debug.Assert(leg.flagging != FlaggingKind.None && leg.flagging != FlaggingKind.End);

            DescriptionLine line = new DescriptionLine();

            line.kind  = DescriptionLineKind.Directive;
            line.boxes = new object[2];

            // Figure out the distance in the directive, rounded to nearest 10m.
            string distanceText;
            float  distance = QueryEvent.ComputeFlaggedLegLength(eventDB, leg.controlId1, leg.controlId2, legId);

            distance     = (float)(Math.Round(distance / 10.0) * 10.0);   // round to nearest 10 m.
            distanceText = string.Format("{0} m", distance);

            // Box 1: directive graphics.
            string symbolId = (leg.flagging == FlaggingKind.Begin) ? "13.1" : "13.2";

            line.boxes[0] = symbolDB[symbolId];

            // Box 2: distance of the flagging
            line.boxes[1] = distanceText;

            // Get the text version of the control using the Textifier.
            Textifier textifier = new Textifier(eventDB, symbolDB, language);

            line.textual = textifier.CreateTextForDirective(symbolId, distanceText);

            // The course control IDs, for use in coordinating the selection
            line.isLeg            = true;
            line.controlId        = controlViewFrom.controlId;
            line.courseControlId  = controlViewFrom.courseControlIds[0];
            line.courseControlId2 = controlViewTo.courseControlIds[0];

            return(line);
        }
Ejemplo n.º 3
0
        // Get a directive line for a flagged route to map exchange (not to the finish). The distance between the controls is calculated and used for the distance
        // in the direction.
        private DescriptionLine GetMapExchangeLine(CourseView.ControlView controlViewFrom, CourseView.ControlView controlViewTo)
        {
            DescriptionLine line = new DescriptionLine();

            line.kind  = DescriptionLineKind.Directive;
            line.boxes = new object[2];

            // Figure out the distance in the directive, rounded to nearest 10m.
            float  distance;      // default distance is zero.
            string distanceText;

            distance     = controlViewFrom.legLength[0];
            distance     = (float)(Math.Round(distance / 10.0) * 10.0);   // round to nearest 10 m.
            distanceText = string.Format("{0} m", distance);

            // Box 1: directive graphics.
            string symbolId = "13.5";

            line.boxes[0] = symbolDB[symbolId];

            // Box 2: distance of the flagging
            line.boxes[1] = distanceText;

            // Get the text version of the control using the Textifier.
            Textifier textifier = new Textifier(eventDB, symbolDB, language);

            line.textual = textifier.CreateTextForDirective(symbolId, distanceText);

            // The course control IDs, for use in coordinating the selection
            line.isLeg            = true;
            line.controlId        = controlViewFrom.controlId;
            line.courseControlId  = controlViewFrom.courseControlIds[0];
            line.courseControlId2 = controlViewTo.courseControlIds[0];

            return(line);
        }
Ejemplo n.º 4
0
        // Get a directive line for a finish or crossingpoint.
        private DescriptionLine GetDirectiveLine(CourseView.CourseViewKind kind, CourseView.ControlView controlView, CourseView.ControlView controlViewPrev)
        {
            ControlPoint  control = eventDB.GetControl(controlView.controlId);
            CourseControl courseControl;

            if (controlView.courseControlIds[0].IsNone)
            {
                courseControl = null;
            }
            else
            {
                courseControl = eventDB.GetCourseControl(controlView.courseControlIds[0]);
            }

            Debug.Assert(control.kind == ControlPointKind.Finish || control.kind == ControlPointKind.CrossingPoint || control.kind == ControlPointKind.MapIssue);

            DescriptionLine line = new DescriptionLine();

            line.kind  = DescriptionLineKind.Directive;
            line.boxes = new object[2];

            // Figure out the distance in the directive, rounded to nearest 10m.
            float  distance = float.NaN;
            string distanceText;

            if (control.kind == ControlPointKind.MapIssue)
            {
                if (controlView.legLength != null)
                {
                    distance = controlView.legLength[0];
                }
            }
            else
            {
                if (controlViewPrev != null && controlViewPrev.legLength != null)
                {
                    distance = controlViewPrev.legLength[0];
                }
            }

            if (!float.IsNaN(distance))
            {
                distance     = (float)(Math.Round(distance / 10.0) * 10.0);  // round to nearest 10 m.
                distanceText = string.Format("{0} m", distance);
            }
            else
            {
                distanceText = "";
            }


            // Box 1: directive graphics.
            string directiveId = control.symbolIds[0];

            // Based on the leg flagging, we may modify the finish directive symbol.
            if (control.kind == ControlPointKind.Finish && (kind == CourseView.CourseViewKind.Normal || kind == CourseView.CourseViewKind.AllVariations))
            {
                FlaggingKind flagging = FlaggingKind.None;
                if (controlView != null && controlViewPrev != null)
                {
                    flagging = QueryEvent.GetLegFlagging(eventDB, controlViewPrev.controlId, controlView.controlId);
                }
                if (flagging == FlaggingKind.All)
                {
                    directiveId = "14.1";  // If flagging is All, then finish id must be flagging to finish.
                }
                else if (flagging == FlaggingKind.End)
                {
                    directiveId = "14.2";  // If flagging is Partial, then finish id must be flagging to funnel.
                }
            }

            line.boxes[0] = symbolDB[directiveId];

            // Box 2: distance for the control, if any.
            if (control.kind == ControlPointKind.Finish || control.kind == ControlPointKind.MapIssue)
            {
                line.boxes[1] = distanceText;
            }

            // Get the text version of the control using the Textifier.
            Textifier textifier = new Textifier(eventDB, symbolDB, language);

            line.textual = textifier.CreateTextForDirective(directiveId, distanceText);

            // The course control ID, for use in coordinating the selection
            line.controlId       = controlView.controlId;
            line.courseControlId = controlView.courseControlIds[0];

            return(line);
        }
Ejemplo n.º 5
0
        // Get a directive line for a marked route (not to the finish). The legId must be valid, because a marked route only occurs
        // with a real leg id.
        private DescriptionLine GetMarkedRouteLine(CourseView.ControlView controlViewFrom, CourseView.ControlView controlViewTo, Id<Leg> legId)
        {
            Leg leg = eventDB.GetLeg(legId);

            Debug.Assert(leg.flagging != FlaggingKind.None && leg.flagging != FlaggingKind.End);

            DescriptionLine line = new DescriptionLine();
            line.kind = DescriptionLineKind.Directive;
            line.boxes = new object[2];

            // Figure out the distance in the directive, rounded to nearest 10m.
            string distanceText;
            float distance = QueryEvent.ComputeFlaggedLegLength(eventDB, leg.controlId1, leg.controlId2, legId);
            distance = (float) (Math.Round(distance / 10.0) * 10.0);      // round to nearest 10 m.
            distanceText = string.Format("{0} m", distance);

            // Box 1: directive graphics.
            string symbolId = (leg.flagging == FlaggingKind.Begin) ? "13.1" : "13.2";
            line.boxes[0] = symbolDB[symbolId];

            // Box 2: distance of the flagging
            line.boxes[1] = distanceText;

            // Get the text version of the control using the Textifier.
            Textifier textifier = new Textifier(eventDB, symbolDB, language);
            line.textual = textifier.CreateTextForDirective(symbolId, distanceText);

            // The course control IDs, for use in coordinating the selection
            line.isLeg = true;
            line.controlId = controlViewFrom.controlId;
            line.courseControlId = controlViewFrom.courseControlIds[0];
            line.courseControlId2 = controlViewTo.courseControlIds[0];

            return line;
        }
Ejemplo n.º 6
0
        // Get a directive line for a flagged route to map exchange (not to the finish). The distance between the controls is calculated and used for the distance
        // in the direction.
        private DescriptionLine GetMapExchangeLine(CourseView.ControlView controlViewFrom, CourseView.ControlView controlViewTo)
        {
            DescriptionLine line = new DescriptionLine();
            line.kind = DescriptionLineKind.Directive;
            line.boxes = new object[2];

            // Figure out the distance in the directive, rounded to nearest 10m.
            float distance;       // default distance is zero.
            string distanceText;
            distance = controlViewFrom.legLength[0];
            distance = (float) (Math.Round(distance / 10.0) * 10.0);      // round to nearest 10 m.
            distanceText = string.Format("{0} m", distance);

            // Box 1: directive graphics.
            string symbolId = "13.5";
            line.boxes[0] = symbolDB[symbolId];

            // Box 2: distance of the flagging
            line.boxes[1] = distanceText;

            // Get the text version of the control using the Textifier.
            Textifier textifier = new Textifier(eventDB, symbolDB, language);
            line.textual = textifier.CreateTextForDirective(symbolId, distanceText);

            // The course control IDs, for use in coordinating the selection
            line.isLeg = true;
            line.controlId = controlViewFrom.controlId;
            line.courseControlId = controlViewFrom.courseControlIds[0];
            line.courseControlId2 = controlViewTo.courseControlIds[0];

            return line;
        }
Ejemplo n.º 7
0
        // Get a directive line for a map exchange at a control (not to the finish).
        private DescriptionLine GetMapExchangeAtControlLine(CourseView.ControlView controlWithExchange)
        {
            DescriptionLine line = new DescriptionLine();
            line.kind = DescriptionLineKind.Directive;
            line.boxes = new object[2];

            // Distance is 0m at the control!
            string distanceText = string.Format("{0} m", 0);

            // Box 1: directive graphics.
            string symbolId = "13.5control";
            line.boxes[0] = symbolDB[symbolId];

            // Box 2: distance of the flagging
            line.boxes[1] = distanceText;

            // Get the text version of the control using the Textifier.
            Textifier textifier = new Textifier(eventDB, symbolDB, language);
            line.textual = textifier.CreateTextForDirective(symbolId, distanceText);

            // The course control IDs, for use in coordinating the selection
            line.controlId = controlWithExchange.controlId;
            line.courseControlId = controlWithExchange.courseControlIds[0];

            return line;
        }