예제 #1
0
        /// <summary>
        /// 创建图元
        /// </summary>
        /// <param name="kml">图元的kml</param>
        /// <param name="layer">图元所在的图层</param>
        /// <returns></returns>
        public Core.Interface.IMFElement CreateElement(Core.Model.Kml kml, ILayer layer)
        {
            Core.Model.KmlCircle kmlCircle = kml.Placemark.Graph as Core.Model.KmlCircle;
            if (kmlCircle == null)
            {
                return(null);
            }
            if (kmlCircle.Position == null || kmlCircle.Radius <= 0)
            {
                return(null);
            }
            CompositeGraphicsLayerClass graphicLayer = layer as CompositeGraphicsLayerClass;

            if (graphicLayer == null)
            {
                return(null);
            }

            Circle_ArcMap circleElement = new Circle_ArcMap(mapControl, kmlCircle, factoryArcMap);

            circleElement.Opacity     = 30;
            circleElement.ElementType = Core.Model.ElementTypeEnum.Circle;
            graphicLayer.AddElement(circleElement, 0);

            return(circleElement);
        }
예제 #2
0
        /// <summary>
        /// 创建图元
        /// </summary>
        /// <param name="kml">面的kml</param>
        /// <param name="layer">图元所在的图层</param>
        /// <returns></returns>
        public Core.Interface.IMFElement CreateElement(Core.Model.Kml kml, ILayer layer)
        {
            KmlPolygon kmlPolygon = kml.Placemark.Graph as KmlPolygon;

            if (kmlPolygon == null)
            {
                return(null);
            }
            if (kmlPolygon.PositionList == null || kmlPolygon.PositionList.Count == 0)
            {
                return(null);
            }


            CompositeGraphicsLayerClass graphicLayer = layer as CompositeGraphicsLayerClass;

            if (graphicLayer == null)
            {
                return(null);
            }

            Polygon_ArcMap polygonElement = new Polygon_ArcMap(mapControl, kmlPolygon, mapFoctory);

            polygonElement.Opacity = 30;
            graphicLayer.AddElement(polygonElement, 0);
            polygonElement.ElementType = ElementTypeEnum.Polygon;

            return(polygonElement);
        }
예제 #3
0
        /// <summary>
        /// 隐藏
        /// </summary>
        /// <param name="isVisible"></param>
        public void SetVisible(bool isVisible)
        {
            if (this.isVisible == isVisible)
            {
                return;
            }
            ILayer layer = mapFactory.GetLayerByName(this.BelongLayer.LayerName);
            CompositeGraphicsLayerClass graphLayer = layer as CompositeGraphicsLayerClass;

            if (graphLayer == null)
            {
                return;
            }

            Dosomething((Action)(delegate
            {
                if (isVisible)//显示
                {
                    graphLayer.AddElement(this, 1);
                }
                else
                {
                    graphLayer.DeleteElement(this);
                }

                Update();
            }), true);

            this.isVisible = isVisible;
        }
예제 #4
0
        /// <summary>
        ///创建图元
        /// </summary>
        /// <param name="kml"></param>
        /// <param name="layer"></param>
        /// <returns></returns>
        public Core.Interface.IMFElement CreateElement(Core.Model.Kml kml, ILayer layer)
        {
            KmlText kmlText = kml.Placemark.Graph as KmlText;

            if (kmlText == null)
            {
                return(null);
            }
            if (kmlText.Position == null)
            {
                return(null);
            }

            CompositeGraphicsLayerClass graphicLayer = layer as CompositeGraphicsLayerClass;

            if (graphicLayer == null)
            {
                return(null);
            }

            Text_ArcMap textElement = new Text_ArcMap(mapControl, kmlText, mapFactory);

            textElement.ElementType = ElementTypeEnum.Text;
            graphicLayer.AddElement(textElement, 0);

            return(textElement);
        }
예제 #5
0
        /// <summary>
        /// 创建图元
        /// </summary>
        /// <param name="kml">图标的kml</param>
        /// <param name="layer">图元所在的图层</param>
        /// <returns></returns>
        public Core.Interface.IMFElement CreateElement(Core.Model.Kml kml, ESRI.ArcGIS.Carto.ILayer layer)
        {
            KmlPoint pointKml = kml.Placemark.Graph as KmlPoint;

            if (pointKml == null)
            {
                return(null);
            }
            if (pointKml.Position == null)
            {
                return(null);
            }

            CompositeGraphicsLayerClass graphicLayer = layer as CompositeGraphicsLayerClass;

            if (graphicLayer == null)
            {
                return(null);
            }

            PointIco_ArcMap pictureElement = new PointIco_ArcMap(mapControl, pointKml, mapFactory);

            pictureElement.ElementType = ElementTypeEnum.Picture;
            graphicLayer.AddElement(pictureElement, 0);

            return(pictureElement);
        }
예제 #6
0
        /// <summary>
        /// 显示隐藏
        /// </summary>
        /// <param name="isVisible"></param>
        public void SetVisible(bool isVisible)
        {
            if (this.isVisible == isVisible)
            {
                return;
            }
            ILayer layer = factoryArcMap.GetLayerByName(belongLayer.LayerName);
            CompositeGraphicsLayerClass graphLayer = layer as CompositeGraphicsLayerClass;

            this.isVisible = isVisible;
            if (isVisible)//显示
            {
                this.Dosomething((Action) delegate()
                {
                    graphLayer.AddElement(this, 1);
                }, true);
            }
            else
            {
                this.Dosomething((Action) delegate()
                {
                    graphLayer.DeleteElement(this);
                }, true);
            }

            Update();
            this.isVisible = isVisible;
        }
예제 #7
0
        /// <summary>
        /// 创建线图元
        /// </summary>
        /// <param name="kml">线的kml</param>
        /// <param name="layer">图层</param>
        /// <returns></returns>
        public Core.Interface.IMFElement CreateElement(Core.Model.Kml kml, ILayer layer)
        {
            KmlLineString line = kml.Placemark.Graph as KmlLineString;

            if (line == null)
            {
                return(null);
            }
            if (line.PositionList == null || line.PositionList.Count < 1)
            {
                return(null);
            }

            CompositeGraphicsLayerClass graphicLayer = layer as CompositeGraphicsLayerClass;

            if (graphicLayer == null)
            {
                return(null);
            }

            Line_ArcMap lineElement = new Line_ArcMap(mapControl, line, mapFactory);

            lineElement.Opacity     = 50;
            lineElement.ElementType = ElementTypeEnum.Line;
            graphicLayer.AddElement(lineElement, 0);

            return(lineElement);
        }
예제 #8
0
        /// <summary>
        /// 创建图元
        /// </summary>
        /// <param name="kml">图标的kml</param>
        /// <param name="layer">图元所在的图层</param>
        /// <returns></returns>
        public Core.Interface.IElement CreateElement(Core.Model.Kml kml, ESRI.ArcGIS.Carto.ILayer layer)
        {
            KmlPicture pictureKml = kml.Placemark.Graph as KmlPicture;

            if (pictureKml == null)
            {
                return(null);
            }
            if (pictureKml.Position == null)
            {
                return(null);
            }

            CompositeGraphicsLayerClass graphicLayer = layer as CompositeGraphicsLayerClass;

            if (graphicLayer == null)
            {
                return(null);
            }

            Picture_ArcMap pictureElement = new Picture_ArcMap(graphicLayer, pictureKml);

            pictureElement.ElementType = ElementTypeEnum.Picture;
            graphicLayer.AddElement(pictureElement, 0);
            return(pictureElement);
        }
예제 #9
0
        /// <summary>
        /// 显示隐藏
        /// </summary>
        /// <param name="isVisible"></param>
        public void SetVisible(bool isVisible)
        {
            if (this.isVisible == isVisible)
            {
                return;
            }
            ILayer layer = mapFactory.GetLayerByName(belongLayer.LayerName);
            CompositeGraphicsLayerClass graphLayer = layer as CompositeGraphicsLayerClass;

            this.isVisible = isVisible;
            if (isVisible)//显示
            {
                graphLayer.AddElement(this, 1);
            }
            else
            {
                graphLayer.DeleteElement(this);
            }
            Update();
        }