Пример #1
0
        private bool CreateRequest(ref ImitationRequest imitationRequest)
        {
            if (aircraftPoints == null)
            {
                ShowMessage("Не заданы точки самолета");
                return(false);
            }

            if (aircraftPoints.Count < 2)
            {
                ShowMessage("Точек самолета должно быть больше 1");
                return(false);
            }

            imitationRequest.AircraftPoints = aircraftPoints.GetPoints();

            if (missilePoints == null)
            {
                ShowMessage("Не заданы точки ракеты");
                return(false);
            }

            if (missilePoints.Count < 2)
            {
                ShowMessage("Точек ракеты должно быть больше 1");
                return(false);
            }

            imitationRequest.Missiles.LaunchPoint = missilePoints.GetPoints()[0];
            imitationRequest.Missiles.Direction   = missilePoints.GetPoints()[1];

            double missileVelocityModule = Settings.Default.MissileVelocityModule;

            if (missileVelocityModule == 0)
            {
                missileVelocityModule = GetValueDialog <double> .ShowDialog(this, "Введите скорость ракеты");

                Settings.Default.MissileVelocityModule = missileVelocityModule;
            }

            imitationRequest.Missiles.VelocityModule = missileVelocityModule;

            int stepsCount = Settings.Default.StepsCount;

            if (stepsCount == 0)
            {
                stepsCount = GetValueDialog <int> .ShowDialog(this, "Введите количество точек маршрута");

                Settings.Default.StepsCount = stepsCount;
            }

            imitationRequest.StepsCount               = stepsCount;
            imitationRequest.Missiles.PropCoeff       = Settings.Default.PropCoeff;
            imitationRequest.Missiles.Inference       = Settings.Default.Inference;
            imitationRequest.Missiles.Defuzzification = Settings.Default.Defuzzification;

            return(true);
        }
Пример #2
0
        private void PictureBox_MissileMouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                missilePoints.Add(pictureBox, string.Empty, e.Location, scenePointsSize);
                if (missilePoints.Count == 2 && Settings.Default.MissileVelocityModule == 0)
                {
                    double velocityModule = GetValueDialog <double> .ShowDialog(this, "Введите скорость ракеты");

                    Settings.Default.MissileVelocityModule = velocityModule;
                    CancellModes();
                }
            }
        }