public void DeleteSpeedMeasurement(int id)
        {
            SpeedMeasurement speedMeasurementToDelete = GetSpeedMeasurement(id);

            if (speedMeasurementToDelete != null)
            {
                _measurements.Remove(speedMeasurementToDelete);
            }
        }
Exemple #2
0
 public CVehicle(string name, int x, int y, int price, double speed, SpeedMeasurement speedMeasure, int yearIssue)
 {
     Name         = name;
     Point        = new Coordinates(x, y);
     Price        = price;
     Speed        = speed;
     YearIssue    = yearIssue;
     SpeedMeasure = speedMeasure;
 }
Exemple #3
0
        private void AddSpeedMeasurement(SpeedMeasurement measurement)
        {
            CHART_VALUES.Add(measurement);
            if (TIMER.IsEnabled)
            {
                SetAxisLimits(measurement.DateTime);
            }

            if (DateTime.Now.Subtract(CHART_VALUES.Last().DateTime).TotalSeconds > 60)
            {
                CHART_VALUES.RemoveAt(0);
            }
        }
        public void DeleteSpeedMeasurement(int id)
        {
            SpeedMeasurement        speedMeasurementToDelete = GetSpeedMeasurement(id);
            List <SpeedMeasurement> measurements             = GetAllSpeedMeasurements();

            if (speedMeasurementToDelete != null)
            {
                if (measurements.Remove(speedMeasurementToDelete))
                {
                    JsonFileWriter.WriteToJson(measurements, filePath);
                }
            }
        }
        public void AddSpeedMeasurement(int speed, Location location, string imageName)
        {
            SpeedMeasurement toBeAdded = new SpeedMeasurement(speed, imageName, location);
            int id = 1;

            while (!isUniqueId(id))
            {
                id++;
            }
            toBeAdded.Id = id;
            _speedMeasurements.Add(toBeAdded);
            JsonHelper.Write <SpeedMeasurement>(_speedMeasurements, filepath);
        }
        public void DeleteSpeedMeasurement(int id)
        {
            SpeedMeasurement toBeDelted = null;

            foreach (SpeedMeasurement speedMeasurement in _speedMeasurements)
            {
                if (speedMeasurement.Id == id)
                {
                    toBeDelted = speedMeasurement;
                }
            }

            _speedMeasurements.Remove(toBeDelted);
        }
        public void DeleteSpeedMeasurement(int id)
        {
            SpeedMeasurement toBeDelted = null;

            foreach (SpeedMeasurement speedMeasurement in _speedMeasurements)
            {
                if (speedMeasurement.Id == id)
                {
                    toBeDelted = speedMeasurement;
                }
            }

            _speedMeasurements.Remove(toBeDelted);
            JsonHelper.Write <SpeedMeasurement>(_speedMeasurements, filepath);
        }
        /// <summary>
        /// Конвертуємо величини швидкості
        /// </summary>
        /// <param name="fromMeasure">Вхідна величина яку конвертуємо</param>
        /// <param name="fromValue">Значення вхідної величини</param>
        /// <param name="toMeasure">>Вихідна величина в яку конвертуємо</param>
        /// <returns>Швидкість у вихідній величині</returns>
        public static double SpeedConvert(SpeedMeasurement fromMeasure, double fromValue, SpeedMeasurement toMeasure)
        {
            double result = 0;

            if (fromMeasure == toMeasure)
            {
                result = fromValue;
            }
            else if (fromMeasure == SpeedMeasurement.km && toMeasure == SpeedMeasurement.m)
            {
                result = fromValue / 1.852;
            }
            else if (fromMeasure == SpeedMeasurement.m && toMeasure == SpeedMeasurement.km)
            {
                result = fromValue * 1.852;
            }
            return(result);
        }
Exemple #9
0
 public CPlane(string name, int x, int y, int price, int speed, SpeedMeasurement speedMeasure, int yearIssue, int height, int countPass)
     : base(name, x, y, price, speed, speedMeasure, yearIssue)
 {
     Height        = height;
     CountPasseger = countPass;
 }
Exemple #10
0
 public Speed(SpeedMeasurement measurement, long value, long timestamp)
     : base(timestamp)
 {
     Measurement = measurement;
     Value = value;
 }
Exemple #11
0
 public CCar(string name, int x, int y, int price, double speed, SpeedMeasurement speedMeasure, int yearIssue)
     : base(name, x, y, price, speed, speedMeasure, yearIssue)
 {
 }
        /// <summary> 
        /// Populates the data for the length from the XML.
        /// </summary>
        /// 
        /// <param name="navigator"> 
        /// The XML node representing the length.
        /// </param>
        /// 
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        /// 
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            XPathNavigator modeNav =
                navigator.SelectSingleNode("mode");

            _mode.Clear();
            if (modeNav != null)
            {
                _mode.ParseXml(modeNav);
            }

            XPathNavigator distanceNav =
                navigator.SelectSingleNode("distance");

            if (distanceNav != null)
            {
                _distance = new Length();
                _distance.ParseXml(distanceNav);
            }

            _minutes =
                XPathHelper.GetOptNavValueAsDouble(navigator, "minutes");

            int? intensity =
                XPathHelper.GetOptNavValueAsInt(navigator, "intensity");
            if (intensity != null)
            {
                _intensity = (RelativeRating)((int)intensity);
            }

            _peakHr =
                XPathHelper.GetOptNavValueAsInt(navigator, "peak-heartrate");

            _averageHr =
                XPathHelper.GetOptNavValueAsInt(navigator, "avg-heartrate");

            _minHr =
                XPathHelper.GetOptNavValueAsInt(navigator, "min-heartrate");

            _energy =
                XPathHelper.GetOptNavValueAsDouble(navigator, "energy");

            _energyFromFat =
                XPathHelper.GetOptNavValueAsDouble(navigator, "energy-from-fat");

            _peakSpeed =
                XPathHelper.GetOptNavValue<SpeedMeasurement>(
                    navigator,
                    "peak-speed");

            _averageSpeed =
                XPathHelper.GetOptNavValue<SpeedMeasurement>(
                    navigator,
                    "avg-speed");

            _minSpeed =
                XPathHelper.GetOptNavValue<SpeedMeasurement>(
                    navigator,
                    "min-speed");

            _peakPace =
                XPathHelper.GetOptNavValue<PaceMeasurement>(
                    navigator,
                    "peak-pace");

            _averagePace =
                XPathHelper.GetOptNavValue<PaceMeasurement>(
                    navigator,
                    "avg-pace");

            _minPace =
                XPathHelper.GetOptNavValue<PaceMeasurement>(
                    navigator,
                    "min-pace");

            _peakPower =
                XPathHelper.GetOptNavValue<PowerMeasurement>(
                    navigator,
                    "peak-power");

            _averagePower =
                XPathHelper.GetOptNavValue<PowerMeasurement>(
                    navigator,
                    "avg-power");

            _minPower =
                XPathHelper.GetOptNavValue<PowerMeasurement>(
                    navigator,
                    "min-power");

            _peakTorque =
                XPathHelper.GetOptNavValue<TorqueMeasurement>(
                    navigator,
                    "peak-torque");

            _averageTorque =
                XPathHelper.GetOptNavValue<TorqueMeasurement>(
                    navigator,
                    "avg-torque");

            _minTorque =
                XPathHelper.GetOptNavValue<TorqueMeasurement>(
                    navigator,
                    "min-torque");

            _leftRightBalance =
                XPathHelper.GetOptNavValueAsDouble(
                    navigator,
                    "left-right-balance");

            _peakCadence =
                XPathHelper.GetOptNavValueAsDouble(navigator, "peak-cadence");

            _averageCadence =
                XPathHelper.GetOptNavValueAsDouble(navigator, "avg-cadence");

            _minCadence =
                XPathHelper.GetOptNavValueAsDouble(navigator, "min-cadence");

            _peakTemperature =
                XPathHelper.GetOptNavValue<TemperatureMeasurement>(
                    navigator,
                    "peak-temperature");

            _averageTemperature =
                XPathHelper.GetOptNavValue<TemperatureMeasurement>(
                    navigator,
                    "avg-temperature");

            _minTemperature =
                XPathHelper.GetOptNavValue<TemperatureMeasurement>(
                    navigator,
                    "min-temperature");

            _peakAltitude =
                XPathHelper.GetOptNavValue<AltitudeMeasurement>(
                    navigator,
                    "peak-altitude");

            _averageAltitude =
                XPathHelper.GetOptNavValue<AltitudeMeasurement>(
                    navigator,
                    "avg-altitude");

            _minAltitude =
                XPathHelper.GetOptNavValue<AltitudeMeasurement>(
                    navigator,
                    "min-altitude");

            _elevationGain =
                XPathHelper.GetOptNavValue<Length>(
                    navigator,
                    "elevation-gain");

            _elevationLoss =
                XPathHelper.GetOptNavValue<Length>(
                    navigator,
                    "elevation-loss");

            _numberOfSteps =
                XPathHelper.GetOptNavValueAsInt(
                    navigator,
                    "number-of-steps");

            _numberOfAerobicSteps =
                XPathHelper.GetOptNavValueAsInt(
                    navigator,
                    "number-of-aerobic-steps");

            _aerobicStepMinutes =
                XPathHelper.GetOptNavValueAsDouble(
                    navigator,
                    "aerobic-step-minutes");
        }
Exemple #13
0
 public CShip(string name, int x, int y, int price, double speed, SpeedMeasurement speedMeasure, int yearIssue, string port, int countPass)
     : base(name, x, y, price, speed, speedMeasure, yearIssue)
 {
     Port          = port;
     countPasseger = countPass;
 }