// 设置设备显示、隐藏
        public void SetDeviceVisible(string deviceName, bool visible)
        {
            IMFLayer layer = mapLogic.GetLayer("设备服务图层");

            if (layer == null)
            {
                return;
            }

            IMFElement element = layer.GetElement(deviceName);

            if (element != null)
            {
                IMFPicture picture = element as IMFPicture;
                if (picture != null)
                {
                    picture.SetVisible(visible);
                }
            }

            IMFElement ele = layer.GetElement(deviceName + "polygon");

            if (ele != null)
            {
                IMFCircle circle = ele as IMFCircle;
                if (circle != null)
                {
                    circle.SetVisible(visible);
                }
            }
        }
        /// <summary>
        /// 设置文字是否可见
        /// </summary>
        public void SetTextVisible(bool show = true, string name = "")
        {
            if (mapLogic == null)
            {
                return;
            }
            IMFLayer layer = mapLogic.GetLayer(coverLayerName);

            if (layer == null)
            {
                return;
            }

            bool visible = zoom >= visibleZoom ? true : false;

            if (visible)
            {
                visible = show;
            }

            if (string.IsNullOrEmpty(name))
            {
                lock (beamDic)
                {
                    foreach (int satelliteId in beamDic.Keys)
                    {
                        foreach (int beamId in beamDic[satelliteId])
                        {
                            string     textName = string.Format("卫星{0}-波束{1}_描述", satelliteId, beamId);
                            IMFElement element  = layer.GetElement(textName);
                            if (element != null)
                            {
                                element.SetVisible(visible);
                            }
                        }
                    }
                }
            }
            else
            {
                string     textName = name + "_描述";
                IMFElement element  = layer.GetElement(textName);
                if (element != null)
                {
                    element.SetVisible(visible);
                }
            }
        }
        // 处理预警结果
        public void DealWarnData(RealData data, bool isWarn, List <string> warnNames)
        {
            IMFLayer layer = mapLogic.GetLayer(GetModelLayerName(data.TargetType));

            if (layer == null)
            {
                return;
            }

            IMFElement element = layer.GetElement(data.TargetNum.ToString());

            if (element == null)
            {
                return;
            }

            if (isWarn == false)
            {
                element.Flash(false);
            }
            else
            {
                if (element.IsFlash == false)
                {
                    element.Flash(true, 500);
                }
            }
        }
Exemple #4
0
        private void SetAreaColorArcMap(string name, Color color)
        {
            IMFLayer layer = mapMapLogic.GetLayer(layerName);

            if (layer == null)
            {
                return;
            }

            IMFElement element = layer.GetElement(name);

            if (element == null)
            {
                return;
            }

            IMFPolygon polygon = element as IMFPolygon;

            if (polygon == null)
            {
                return;
            }

            polygon.SetFillColor(Color.FromArgb(80, color));
        }
Exemple #5
0
        private void SetAreaColorGlobe(string name, Color color)
        {
            IMFLayer layer = globeMapLogic.GetLayer(layerName);

            if (layer == null)
            {
                return;
            }

            foreach (string polygonName in warnAresDic[name].Polygons)
            {
                var element = layer.GetElement(polygonName);
                if (element == null)
                {
                    continue;
                }

                IMFPolygon polygon = element as IMFPolygon;
                if (polygon == null)
                {
                    continue;
                }
                Color c = Color.FromArgb(80, color.R, color.G, color.B);
                polygon.SetFillColor(c);
            }

            layer.Refresh();
        }
Exemple #6
0
        /// 重绘区域
        /// </summary>
        /// <param name="name"></param>
        /// <param name="points"></param>
        public void ReDrawArea(string name, List <MapLngLat> points)
        {
            // 先删除之前的面,再添加新的面
            if (!warnAresDic.ContainsKey(name))
            {
                return;
            }

            WarnArea area = warnAresDic[name];

            foreach (string polygonName in area.Polygons)
            {
                IMFLayer layer = globeMapLogic.GetLayer(layerName);
                if (layer == null)
                {
                    return;
                }

                layer.RemoveElement(polygonName);
            }

            bool isWarn      = area.IsWarn;
            bool isImportant = area.IsImportant;

            warnAresDic.Remove(name);

            DrawAreaGlobe(name, points, isWarn, isImportant);

            // arcmap
            IMFLayer layerMap = mapMapLogic.AddLayer(layerName);

            if (layerMap == null)
            {
                return;
            }

            IMFElement ele = layerMap.GetElement(name);

            if (ele == null)
            {
                return;
            }
            IMFPolygon polygon = ele as IMFPolygon;

            if (polygon == null)
            {
                return;
            }
            polygon.UpdatePosition(points);
        }
Exemple #7
0
        private void SetAreaVisibleGlobe(string name, bool visible)
        {
            IMFLayer layer = globeMapLogic.GetLayer(layerName);

            if (layer == null)
            {
                return;
            }


            foreach (string polygonName in warnAresDic[name].Polygons)
            {
                IMFElement element = layer.GetElement(polygonName);
                element.SetVisible(visible);
            }

            layer.Refresh();
        }
        /// <summary>
        /// 跳转到某目标
        /// </summary>
        /// <param name="name"></param>
        public void JumpToPlane(byte type, string elementName)
        {
            if (mapLogic == null)
            {
                return;
            }
            IMFLayer layer = mapLogic.GetLayer(GetModelLayerName(type));

            if (layer == null)
            {
                return;
            }

            IMFElement element = layer.GetElement(elementName);

            if (element == null)
            {
                return;
            }

            IMFPicture model = element as IMFPicture;

            if (model == null)
            {
                return;
            }

            MapLngLat  position = model.GetLngLat();;
            IMFToolBox toolBox  = mapLogic.GetToolBox();

            if (toolBox == null)
            {
                return;
            }

            toolBox.ZoomToPosition(position);
        }
        // 处理波束数据
        private void DealBeamCover(BeamData e)
        {
            if (e.Point.Alt > 0)
            {
                return;                     // 卫星数据,不做处理
            }
            if (mapLogic == null)
            {
                return;
            }
            // 添加圆图元(波束覆盖)
            IMFLayer layer = mapLogic.AddLayer(coverLayerName);

            if (layer == null)
            {
                return;
            }

            string circleName = string.Format("卫星{0}-波束{1}", e.SatelliteId, e.BeamId);
            string textName   = string.Format("卫星{0}-波束{1}_描述", e.SatelliteId, e.BeamId, e.BeamId);

            if (!beamDic.ContainsKey(e.SatelliteId))   // 新的波束
            {
                Kml kmlCircle = new Kml();
                kmlCircle.Placemark.Name = circleName;
                KmlCircle circle = new KmlCircle();
                circle.Position           = e.Point;
                circle.FillColor          = Color.FromArgb(50, Color.Green);
                circle.Radius             = 500000;
                circle.StrokeColor        = Color.Blue;
                circle.StrokeWidth        = 1;
                kmlCircle.Placemark.Graph = circle;
                layer.AddElement(kmlCircle);

                // 添加文字图元
                Kml kmlText = new Kml();
                kmlText.Placemark.Name = textName;
                string context = string.Format("卫星{0}-波束{1}", e.SatelliteId, e.BeamId);
                kmlText.Placemark.Graph = new KmlText()
                {
                    Position = e.Point, Content = context, Color = Color.Blue, Font = "宋体", Size = 10
                };

                IMFElement elementText;
                if (layer.AddElement(kmlText, out elementText))
                {
                    bool visible = zoom >= visibleZoom ? true : false;
                    elementText.SetVisible(visible);
                }


                // 添加到字典进行维护
                List <int> beamIdList = new List <int>();
                beamIdList.Add(e.BeamId);
                lock (beamDic)
                {
                    beamDic.Add(e.SatelliteId, beamIdList);
                }
            }
            else
            {
                if (!beamDic[e.SatelliteId].Contains(e.BeamId))   // 新的波束
                {
                    Kml kmlCircle = new Kml();
                    kmlCircle.Placemark.Name = circleName;
                    KmlCircle circle = new KmlCircle();
                    circle.Position           = e.Point;
                    circle.FillColor          = Color.FromArgb(50, Color.Green);
                    circle.Radius             = 500000;
                    circle.StrokeColor        = Color.Blue;
                    circle.StrokeWidth        = 1;
                    kmlCircle.Placemark.Graph = circle;
                    layer.AddElement(kmlCircle);


                    // 添加文字图元
                    string context = string.Format("卫星{0}-波束{1}", e.SatelliteId, e.BeamId);
                    Kml    kmlText = new Kml();
                    kmlText.Placemark.Name  = textName;
                    kmlText.Placemark.Graph = new KmlText()
                    {
                        Position = e.Point, Content = context, Color = Color.Blue, Font = "宋体", Size = 10
                    };

                    IMFElement elementText;
                    if (layer.AddElement(kmlText, out elementText))
                    {
                        bool visible = zoom >= visibleZoom ? true : false;
                        elementText.SetVisible(visible);
                    }

                    lock (beamDic)
                    {
                        // 添加到字典进行维护
                        beamDic[e.SatelliteId].Add(e.BeamId);
                    }
                }
                else
                {
                    // 更新圆图元(波束覆盖)位置
                    IMFElement elementCircle = layer.GetElement(circleName);
                    if (elementCircle != null)
                    {
                        IMFCircle circle = elementCircle as IMFCircle;
                        if (circle != null)
                        {
                            circle.UpdatePosition(e.Point);
                        }
                    }

                    // 更新文字图元(描述信息)位置
                    IMFElement elementText = layer.GetElement(textName);
                    if (elementText != null)
                    {
                        IMFText text = elementText as IMFText;
                        if (text != null)
                        {
                            text.UpdatePosition(e.Point);
                        }
                    }
                }
            }
        }