示例#1
0
 private void showPorintInMap(GMapAirPlane eachlistAirplane)
 {
     // 展示飞机
     planeOverlay.Markers.Add(eachlistAirplane);
     // 展示轨迹点
     showHisPorint(eachlistAirplane.AirPlaneMarkerInfo.sModeAddress);
 }
示例#2
0
        private void sMonitorDis_MouseOn(GMapMarker item)
        {
            if (item is GMapAirPlane)
            {
                //ToolTipText = "S模式地址:" + data.sModeAddress.ToString() + "\r\n"
                //            // + "SSR: " + "0" + "\r\n"
                //            + "FID: " + data.flightNo.ToString() + "\r\n"
                //            + "经度: " + p.Lat.ToString() + "\r\n"
                //            + "纬度: " + p.Lng.ToString() + "\r\n"
                //            + "高度:" + data.geometricAltitude.ToString() + "\r\n";

                GMapAirPlane gMapAirPlane = item as GMapAirPlane;
                textBox1.Text = gMapAirPlane.AirPlaneMarkerInfo.sModeAddress.ToString();
                textBox2.Text = gMapAirPlane.AirPlaneMarkerInfo.flightNo.ToString();
                textBox3.Text = gMapAirPlane.AirPlaneMarkerInfo.latitude.ToString();
                textBox4.Text = gMapAirPlane.AirPlaneMarkerInfo.longtitude.ToString();
                textBox5.Text = gMapAirPlane.AirPlaneMarkerInfo.geometricAltitude.ToString();

                panel1.Visible   = true;
                textBox1.Visible = true;
                textBox2.Visible = true;
                textBox3.Visible = true;
                textBox4.Visible = true;
                textBox5.Visible = true;
            }
        }
示例#3
0
        private void showOnePlane(GMapAirPlane eachlistAirplane)
        {
            if (!airPlaneShow)
            {
                return;
            }

            // 没有航迹圈控制,直接显示
            if (!flightCircle)
            {
                showPorintInMap(eachlistAirplane);
                return;
            }

            // 只展示航迹圈内的飞机
            if (currentFellowId <= 0)
            {
                return;
            }

            List <Dictionary <string, object> > result =
                ProfileHelper.Instance.Select("SELECT * FROM PlaneFollow WHERE ID = " + currentFellowId);

            // 没查到勾选记录
            if (null == result || result.Count() == 0)
            {
                return;
            }

            Dictionary <string, object> dictionary = result[0];
            int type = Convert.ToInt32(dictionary["Type"]);
            // 展示半径
            double length = Convert.ToDouble(dictionary["Length"]);

            // 查到的显示半径为0
            if (length <= 0)
            {
                return;
            }

            double lat  = 0.0;
            double lang = 0.0;

            // 飞行器
            if (1 == type)
            {
                // 根据S地址查找最新的地址
                List <Cat021Data> list = AirplaneManager.Instance.Query(Convert.ToInt32(dictionary["IDNum"]), null, 0, 0, 0, 0);
                if (list.Count() > 0)
                {
                    Cat021Data data = list[0];
                    lat  = data.latitude;
                    lang = data.longtitude;
                }
                else
                {
                    return;
                }
            }
            else
            {
                // 根据id查出地面站信息
                List <Dictionary <string, object> > stationList = ProfileHelper.Instance.Select(
                    "SELECT * FROM LandStation WHERE ID = " + dictionary["IDNum"]);
                if (stationList.Count() > 0)
                {
                    Dictionary <string, object> station = stationList[0];
                    lat  = Convert.ToDouble(station["Lat"]);
                    lang = Convert.ToDouble(station["Lng"]);
                }
                else
                {
                    return;
                }
            }

            showFlightCircle(lat, lang, (int)length);

            // 只展示圈内的飞机
            double disPlane = CommonHelper.Distance(
                lat,
                lang,
                eachlistAirplane.AirPlaneMarkerInfo.latitude,
                eachlistAirplane.AirPlaneMarkerInfo.longtitude);

            if (disPlane <= length)
            {
                showPorintInMap(eachlistAirplane);
            }
        }
示例#4
0
        private void mapControl_OnMarkerClick(GMapMarker item, MouseEventArgs e)
        {
            if (item is GMapAirPlane)
            {
                GMapAirPlane gMapAirPlane = item as GMapAirPlane;
                gMapAirPlane.Pen = new Pen(Brushes.Red, 2);
                if (!listAirplaneCheck.ContainsKey(gMapAirPlane.AirPlaneMarkerInfo.sModeAddress))
                {
                    listAirplaneCheck.Add(gMapAirPlane.AirPlaneMarkerInfo.sModeAddress, gMapAirPlane.AirPlaneMarkerInfo.sModeAddress);
                    // 插入数据库
                    String flightNo     = gMapAirPlane.AirPlaneMarkerInfo.flightNo;
                    String sModeAddress = Convert.ToString(gMapAirPlane.AirPlaneMarkerInfo.sModeAddress);

                    ProfileHelper.Instance.Update("INSERT INTO PlaneFollow (ID, Type, IDNum, Length) VALUES (NULL, 1, '" + sModeAddress + "', 0)");
                }
                else
                {
                    int     sModeAddress = gMapAirPlane.AirPlaneMarkerInfo.sModeAddress;
                    Boolean isCommon     = false;
                    List <Dictionary <string, object> > result = ProfileHelper.Instance.Select("SELECT * FROM CommonPlane");
                    foreach (Dictionary <string, object> dictionary in result)
                    {
                        int sModeAddressSel = Convert.ToInt32(dictionary["SModeAddress"]);
                        if (sModeAddressSel == sModeAddress)
                        {
                            isCommon = true;
                        }
                    }

                    if (isCommon)
                    {
                        MessageBox.Show("常用飞机不可以直接在关注列表中直接删除,请去<常用飞行器>中删除!");
                        return;
                    }
                    else
                    {
                        pointPlaneLand.Remove(sModeAddress);
                        ProfileHelper.Instance.Update("Delete FROM PlaneFollow WHERE Type = 1 AND IDNum = \"" + sModeAddress + "\"");
                    }
                }
            }
            else if (item is GMapLandStation)
            {
                GMapLandStation gMapLandStation = item as GMapLandStation;
                // 根据name查出地面站信息
                List <Dictionary <string, object> > stationList = ProfileHelper.Instance.Select("SELECT * FROM LandStation WHERE Name = '" + gMapLandStation.Name + "'");
                if (stationList.Count() > 0)
                {
                    Dictionary <string, object> dictionary = stationList[0];
                    int id = Convert.ToInt32(dictionary["ID"]);
                    List <Dictionary <string, object> > result =
                        ProfileHelper.Instance.Select("SELECT * FROM PlaneFollow WHERE Type = 2 AND IDNum = " + id);
                    if (result.Count() == 0)
                    {
                        ProfileHelper.Instance.Update("INSERT INTO PlaneFollow (ID, Type, IDNum, Length) VALUES (NULL, 2, '" + id + "', 0)");
                    }
                    else
                    {
                        ProfileHelper.Instance.Update("Delete FROM PlaneFollow WHERE Type = 2 AND IDNum = \"" + id + "\"");
                    }
                }
            }
            else
            {
                panel1.Visible   = false;
                textBox1.Visible = false;
                textBox2.Visible = false;
                textBox3.Visible = false;
                textBox4.Visible = false;
                textBox5.Visible = false;
            }
            initListAirplaneCheck(false);
        }
示例#5
0
        // 区别飞行器是正常机、凸显机还是中心机;记录轨迹点
        private void flyTimer_Tick(object sender, EventArgs e)
        {
            if (dataSource.Count == 0)
            {
                return;
            }
            Cat021Data tmpData        = dataSource.GetData();
            int        isCheckedPlane = 0; // 0-普通飞行器,1-凸显飞行器,2-中心机,3-告警机器

            // 获取中心机
            String my_sAddress = ConfigHelper.Instance.GetConfig("my_sAddress");
            int    iAddress    = Convert.ToInt32(my_sAddress);

            if (!string.IsNullOrWhiteSpace(my_sAddress) && tmpData.sModeAddress == iAddress)
            {
                isCheckedPlane = 1;
                initCenterPlane(tmpData);
            }

            PointLatLng pointLatLng = new PointLatLng(tmpData.latitude, tmpData.longtitude);

            // 看飞机是否在凸显列表中
            if (1 != isCheckedPlane)
            {
                if (listAirplaneCheck.ContainsKey(tmpData.sModeAddress))
                {
                    isCheckedPlane = 2;

                    if (pointPlaneLand.ContainsKey(tmpData.sModeAddress))
                    {
                        pointPlaneLand.Remove(tmpData.sModeAddress);
                    }
                    pointPlaneLand.Add(tmpData.sModeAddress, pointLatLng);
                }

                if (AirplaneManager.Instance.checkAlermPlane(tmpData.sModeAddress))
                {
                    isCheckedPlane = 3;
                }
            }

            GMapAirPlane tmpAirplane  = new GMapAirPlane(new PointLatLng(tmpData.latitude, tmpData.longtitude), tmpData, isCheckedPlane);
            int          sModeAddress = tmpData.sModeAddress;

            // 轨迹点处理
            List <PointLatLng> points;

            if (keyValuePairs.ContainsKey(sModeAddress))
            {
                points = keyValuePairs[sModeAddress];
                showValue[sModeAddress] = showValue[sModeAddress] + 1;
                if (29 == showValue[sModeAddress])
                {
                    pointMax(points);
                }
                points.Add(pointLatLng);
            }
            else
            {
                points = new List <PointLatLng>(showPointMax);
                points.Add(pointLatLng);
                keyValuePairs.Add(sModeAddress, points);
                showValue[sModeAddress] = 0;
            }

            // 同一架飞机来了新的先从list里面移除掉
            if (listAirplane.ContainsKey(sModeAddress))
            {
                listAirplane.Remove(sModeAddress);
                //showAllPalne();
                //planeOverlay.Markers.Remove(tmpAirplane);
            }
            else
            {
                listAirplane.Add(sModeAddress, tmpAirplane);
            }
            //showOnePlane(tmpAirplane);

            AirplaneManager.Instance.Add(tmpData);


            /*
             *
             *
             * // 全部飞机展示
             * if (airPlaneShow)
             * {
             *  showAllPalne();
             * }
             *
             * // 展示关注飞机与指定地面站的虚线距离
             * showLandStation();
             *
             * gMapControl1.Refresh();
             */
        }