Exemplo n.º 1
0
        private Target GetTarget()
        {
            Target target;

            if (
                Type == TargetType.UNASSIGNED
                )
            {
                var info = InitializeTarget.GetInfo(Type, false);

                switch (info.type)
                {
                case TargetType.DROP:
                    target = new DropTarget();
                    break;

                case TargetType.LETTER:
                    target = new LetterTarget(info.letter);
                    break;

                case TargetType.UNKNOWN:
                    target = new UnknownTarget(info.desc);
                    break;

                // Shouldn't get here, as InitializeTarget.GetInfo() doesn't return TargetType.UNASSIGNED
                default:
                    target = null;
                    break;
                }
            }
            else if (Type == TargetType.DROP)
            {
                target = new DropTarget();
            }
            else if (Type == TargetType.LETTER)
            {
                target = new LetterTarget(Letter);
            }
            else if (Type == TargetType.UNKNOWN)
            {
                target = new UnknownTarget(UnknownDescription);
            }
            else
            {
                // Shouldn't get here, covers all cases of TargetType
                target = null;
            }

            target.Latitude  = Latitudes.Sum() / Latitudes.Count;
            target.Longitude = Longitudes.Sum() / Longitudes.Count;

            return(target);
        }
Exemplo n.º 2
0
        private void stopRecording()
        {
            var info = new BasicTargetInfo {
            };

            if (
                (targetType.SelectedIndex == (int)TargetType.UNASSIGNED) ||
                (targetType.SelectedIndex == (int)TargetType.LETTER && letterInput.Text.Length != 1) ||
                (targetType.SelectedIndex == (int)TargetType.UNKNOWN && unknownDescriptionInput.Text.Length == 0)
                )
            {
                info = InitializeTarget.GetInfo((TargetType)targetType.SelectedIndex, false);
            }
            else
            {
                switch ((TargetType)targetType.SelectedIndex)
                {
                case TargetType.DROP:
                    info.type = TargetType.DROP;
                    break;

                case TargetType.LETTER:
                    info.letter = letterInput.Text[0];
                    info.type   = TargetType.LETTER;
                    break;

                case TargetType.UNKNOWN:
                    info.desc = unknownDescriptionInput.Text;
                    info.type = TargetType.UNKNOWN;
                    break;
                }
            }

            switch (info.type)
            {
            case TargetType.DROP:
                targetBuilder.SetDrop();
                break;

            case TargetType.LETTER:
                targetBuilder.SetLetter(info.letter);
                break;

            case TargetType.UNKNOWN:
                targetBuilder.SetUnknownDescription(info.desc);
                break;
            }

            MissionState.StopRecordingCoordinate(targetBuilder);

            targetBuilder = null;

            Action m = () => {
                letterInput.Text             = "";
                unknownDescriptionInput.Text = "";
                targetType.SelectedIndex     = 0;
                startStopRecording.Text      = "Start Recording";
            };

            this.Invoke(m);
        }