示例#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)
        {
            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);
        }
示例#2
0
        /// <summary>
        /// 删除图元
        /// </summary>
        /// <param name="element">要移除的线图元</param>
        /// <param name="layer">图元所在的图层</param>
        /// <returns></returns>
        public bool RemoveElement(Core.Interface.IMFElement element, ILayer layer)
        {
            CompositeGraphicsLayerClass graphicLayer = layer as CompositeGraphicsLayerClass;

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

            Line_ArcMap line = element as Line_ArcMap;

            if (line == null)
            {
                return(false);
            }

            graphicLayer.DeleteElement(line);//删除线图元

            return(true);
        }