コード例 #1
0
        public IB_DATOS_VUELO_CTRL(MainWindow window, GMapMarker marker, GMapMarker marker_link, GMapMarker marker_line_link, FlightRadarData title)
        {
            InitializeComponent();

            InicializaPintaRuta();

            this.RectangleSeleccion.Visibility = Visibility.Collapsed;
            this.MainWindow  = window;
            this.Marker      = marker;
            this.Marker_link = marker_link;
            this.m_title     = title;
            this.Marker_Line = marker_line_link;

            this.txt_altidud_vuelo.Text   = title.altitude;
            this.txt_nombre_vuelo.Text    = title.name;
            this.txt_rumbo_vuelo.Text     = title.bearing.ToString() + "º";
            this.txt_velocidad_vuelo.Text = title.speed;

            this.Loaded               += new RoutedEventHandler(CustomMarkerDemo_Loaded);
            this.SizeChanged          += new SizeChangedEventHandler(CustomMarkerDemo_SizeChanged);
            this.MouseEnter           += new MouseEventHandler(MarkerControl_MouseEnter);
            this.MouseLeave           += new MouseEventHandler(MarkerControl_MouseLeave);
            this.MouseMove            += new MouseEventHandler(CustomMarkerDemo_MouseMove);
            this.MouseLeftButtonUp    += new MouseButtonEventHandler(CustomMarkerDemo_MouseLeftButtonUp);
            this.MouseLeftButtonDown  += new MouseButtonEventHandler(CustomMarkerDemo_MouseLeftButtonDown);
            this.MouseRightButtonDown += new MouseButtonEventHandler(CustomMarkerDemo_MouseRightButtonDown);
            this.MouseWheel           += IB_DATOS_VUELO_CTRL_MouseWheel;
            this.MouseDown            += IB_DATOS_VUELO_CTRL_MouseDown;
        }
コード例 #2
0
        public string Encode(FlightRadarData fd, Radar radar, int cnt)
        {
            EncodedData data = new EncodedData();

            //Radar encoding

            /*data.InitialRadar();
             * data.AppendData("0000000000");
             * data.AppendData(Convert.ToString(radar.ID, 16), "00");
             * data.AppendData(dmsToHex(ddToDms(radar.Position.Lat)));
             * data.AppendData(dmsToHex(ddToDms(radar.Position.Lng)));*/

            data.AppendData(cnt.ToString());
            short  positionX = (short)((fd.point.Lng - radar.Position.Lng) * 480);
            short  positionY = (short)((fd.point.Lat - radar.Position.Lat) * 480);
            double speed     = fd.speed;
            double bearing   = fd.bearing;
            short  speedX    = (short)(speed * Math.Sin(bearing * Math.PI / 180));
            short  speedY    = (short)(speed * Math.Cos(bearing * Math.PI / 180));

            data.AppendData(Convert.ToString(positionX, 16).PadLeft(4, '0'));
            data.AppendData(Convert.ToString(positionY, 16).PadLeft(4, '0'));
            data.AppendData(Convert.ToString(speedX, 16).PadLeft(4, '0'));
            data.AppendData(Convert.ToString(speedY, 16).PadLeft(4, '0'));
            data.AppendData(Convert.ToString(fd.Id, 16).PadLeft(4, '0'));
            data.AppendData(Convert.ToString(fd.identification, 16).PadLeft(2, '0'));
            data.AppendData(Convert.ToString(radar.ID, 16));
            return("02" + data.ToString());
        }
コード例 #3
0
 public InfoVuelo_A(FlightRadarData p_DatosVuelo, Map mainMap)
 {
     InitializeComponent();
     this.MouseDown += InfoVuelo_A_MouseDown;
     this.DatosVuelo = p_DatosVuelo;
     m_mainMap       = mainMap;
 }
コード例 #4
0
        protected virtual void OnRaiseCustomEvent(FlightRadarData e)
        {
            EventHandler <FlightRadarData> handler = RaiseCustomEvent;

            if (handler != null)
            {
                handler(this, e);
            }
        }
コード例 #5
0
 public int SearchPlane(int id)
 {
     foreach (int faker in track.Fakers)
     {
         FlightRadarData fd = track.GetFaker(faker);
         if (fd.Id == id)
         {
             return(faker);
         }
     }
     return(-1);
 }
コード例 #6
0
        public IB_CTRL_PanelAvion_A(FlightRadarData title, bool selected)
        {
            InitializeComponent();

            m_flightRadarData = title;
            isSelected        = selected;
            if (isSelected)
            {
                Seccionado();
            }
            else
            {
                NoSeccionado();
            }

            RadarData = title;
        }
コード例 #7
0
        void flight_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            mainMap.HoldInvalidation = true;

            lock (track)
            {
                foreach (int id in ProcessFlight.AllflightMarkers.Keys)
                {
                    List <PointLatLng> points = new List <PointLatLng>();

                    points.Add(ProcessFlight.AllflightMarkers[id].Position);
                    points.Add(pointRader);
                    GMapPolygon Distance = new GMapPolygon(points, "Distance");

                    if (Distance.Distance > (double)RadarRadius)
                    {
                        track.RemoveFaker(id);
                        if (TagPlane != null && TagPlane.Id == id)
                        {
                            TagPlane = null;
                        }
                    }

                    /*if (flightIdInfo.Text != "" && ProcessFlight.AllflightMarkers[id].id == int.Parse(flightIdInfo.Text))
                     * {
                     *  indexfaker = id;
                     * }*/
                    Track.Markers.Remove(ProcessFlight.AllflightMarkers[id]);
                    BordersTrack.Markers.Remove(ProcessFlight.AllBordersTrack[id]);
                }
                ProcessFlight.AllflightMarkers.Clear();
                ProcessFlight.AllBordersTrack.Clear();

                ProcessFlight.testDoWork();
                MarkerAndPolygon map = MarkerAndPolygon.GetInstance();
                foreach (int faker in track.Fakers)
                {
                    FlightRadarData fd = track.GetFaker(faker);

                    var ex = new GMapMarkerPlane(fd.point, (float)fd.bearing, fd.speed, fd.Id, mainMap.Zoom);
                    ex.id = fd.Id;
                    ex.setIcon(fd.identification);
                    ex.flight = fd;
                    ex.Tag    = new SimpleTrackInfo(TrackType.Faker, fd.Id);
                    //ex.ToolTipText = PositionConverter.ParsePointToString(MainMap.Position, comboBoxScale.Text);
                    //ex.ToolTipPosition.Offset(ex.Offset);
                    //ex.ToolTipMode = MarkerTooltipMode.Always;

                    GMapMarkerRectPlane mBorders = new GMapMarkerRectPlane(ex.Position);
                    mBorders.InnerMarker = ex;

                    ProcessFlight.AllflightMarkers.Add(fd.Id, ex);
                    ProcessFlight.AllBordersTrack.Add(fd.Id, mBorders);

                    bool isInside = false;
                    foreach (GMapPolygon poly in map.RestrictedArea)
                    {
                        isInside = IsPointInPolygon(poly.Points, fd.point);
                        if (isInside)
                        {
                            break;
                        }
                    }
                    if (!isInside || track.isFollow(faker))
                    {
                        BordersTrack.Markers.Add(mBorders);
                        Track.Markers.Add(ex);
                    }

                    /*var strDecoder = ConvertDataDecoder.Convertcode(fd.point, fd.bearing, fd.altitude, fd.speed, fd.Id, fd.identification, SetSerialPort.decoder);
                     * if (SetSerialPort.sportPort_send.IsOpen)
                     * {
                     *  SetSerialPort.sportPort_send.Write(strDecoder);
                     *  Console.WriteLine(strDecoder);
                     * }
                     *
                     * // to Wait for correction
                     * Encoder encoder = new Encoder();
                     * Radar radar = new Radar(41, radarP.Position);
                     * string strdecode = encoder.Encode(fd, radar);
                     * Console.WriteLine(strdecode);
                     * SetSerialPort.sportPort_send.Write(strdecode);*/
                }

                Dictionary <int, FlightRadarData> realTrack = track.CloneRealTrack();

                foreach (int real in realTrack.Keys)
                {
                    FlightRadarData fd = realTrack[real];
                    var             ex = new GMapMarkerPlane(fd.point, (float)fd.bearing, fd.speed, fd.Id, mainMap.Zoom);
                    ex.setIcon(track.getStatus(fd.Id));
                    ex.flight = fd;
                    ex.Tag    = new SimpleTrackInfo(TrackType.Real, fd.Id);

                    GMapMarkerRectPlane mBorders = new GMapMarkerRectPlane(ex.Position);
                    mBorders.InnerMarker = ex;

                    ProcessFlight.AllflightMarkers.Add(fd.Id, ex);
                    ProcessFlight.AllBordersTrack.Add(fd.Id, mBorders);

                    bool isInside = false;
                    foreach (GMapPolygon poly in map.RestrictedArea)
                    {
                        isInside = IsPointInPolygon(poly.Points, fd.point);
                        if (isInside)
                        {
                            break;
                        }
                    }
                    if (!isInside || track.isFollow(real))
                    {
                        BordersTrack.Markers.Add(mBorders);
                        Track.Markers.Add(ex);
                    }
                }
                track.Save();
            }

            //updateline();
            //CalculateCPC();
            //updatePlaneInfo();
            mainMap.Refresh();
        }