Ejemplo n.º 1
0
        private void HandleStation(byte[] data)
        {
            if (++counter >= times.Count)
            {
                counter = 0;
                distPoints.Clear();
                speedPoints.Clear();
                azimuthPoints.Clear();
                pitchPoints.Clear();
            }

            Dist = dists[counter];
            distPoints.Add(new DataPoint(DateTimeAxis.ToDouble(times[counter]), Dist));
            LineSeries distSerial = new LineSeries()
            {
                Title = "测距"
            };

            distSerial.Points.AddRange(distPoints);

            DistModel.Series.Clear();
            DistModel.Series.Add(distSerial);
            DistModel.InvalidatePlot(true);  //刷新

            Speed = speeds[counter];
            speedPoints.Add(new DataPoint(DateTimeAxis.ToDouble(times[counter]), Speed));
            LineSeries speedSerial = new LineSeries()
            {
                Title = "测速"
            };

            speedSerial.Points.AddRange(speedPoints);

            SpeedModel.Series.Clear();
            SpeedModel.Series.Add(speedSerial);
            SpeedModel.InvalidatePlot(true);  //刷新

            Azimuth = azimuths[counter];
            azimuthPoints.Add(new DataPoint(DateTimeAxis.ToDouble(times[counter]), Azimuth));
            LineSeries azimuthSerial = new LineSeries()
            {
                Title = "方位角"
            };

            azimuthSerial.Points.AddRange(azimuthPoints);

            AzimuthModel.Series.Clear();
            AzimuthModel.Series.Add(azimuthSerial);
            AzimuthModel.InvalidatePlot(true);  //刷新

            Pitch = pitchs[counter];
            pitchPoints.Add(new DataPoint(DateTimeAxis.ToDouble(times[counter]), Pitch));
            LineSeries pitchSerial = new LineSeries()
            {
                Title = "俯仰角"
            };

            pitchSerial.Points.AddRange(pitchPoints);

            PitchModel.Series.Clear();
            PitchModel.Series.Add(pitchSerial);
            PitchModel.InvalidatePlot(true);  //刷新
        }
Ejemplo n.º 2
0
        private void HandleAttitude(MsgOfAttitude msg)
        {
            DateTime dt = new DateTime(msg.year, msg.month, msg.day, msg.hour, msg.minute, (int)msg.second);

            if (rollPoints.Count > 3600)
            {
                rollPoints.RemoveRange(0, 3600);
                rollModel.Axes[0].Minimum = DateTimeAxis.ToDouble(DateTime.Now);
                rollModel.Axes[0].Maximum = DateTimeAxis.ToDouble(DateTime.Now.AddMinutes(60));
            }
            if (yawPoints.Count > 3600)
            {
                yawPoints.RemoveRange(0, 3600);
                yawModel.Axes[0].Minimum = DateTimeAxis.ToDouble(DateTime.Now);
                yawModel.Axes[0].Maximum = DateTimeAxis.ToDouble(DateTime.Now.AddMinutes(60));
            }
            if (pitchPoints.Count > 3600)
            {
                pitchPoints.RemoveRange(0, 3600);
                pitchModel.Axes[0].Minimum = DateTimeAxis.ToDouble(DateTime.Now);
                pitchModel.Axes[0].Maximum = DateTimeAxis.ToDouble(DateTime.Now.AddMinutes(60));
            }

            Roll = Math.Round(msg.roll, 2);
            rollPoints.Add(new DataPoint(DateTimeAxis.ToDouble(dt), Roll));
            LineSeries rollSerial = new LineSeries()
            {
                Title = "滚动角"
            };

            rollSerial.Points.AddRange(rollPoints);

            RollModel.Series.Clear();
            RollModel.Series.Add(rollSerial);
            RollModel.InvalidatePlot(true);  //刷新

            Yaw = Math.Round(msg.yaw, 2);
            yawPoints.Add(new DataPoint(DateTimeAxis.ToDouble(dt), Yaw));
            LineSeries yawSerial = new LineSeries()
            {
                Title = "偏航角"
            };

            yawSerial.Points.AddRange(yawPoints);

            YawModel.Series.Clear();
            YawModel.Series.Add(yawSerial);
            YawModel.InvalidatePlot(true);  //刷新

            Pitch = Math.Round(msg.pitch, 2);
            pitchPoints.Add(new DataPoint(DateTimeAxis.ToDouble(dt), Pitch));
            LineSeries pitchSerial = new LineSeries()
            {
                Title = "俯仰角"
            };

            pitchSerial.Points.AddRange(pitchPoints);

            PitchModel.Series.Clear();
            PitchModel.Series.Add(pitchSerial);
            PitchModel.InvalidatePlot(true);  //刷新
        }