Exemple #1
0
        /// <summary>
        /// 添加图元
        /// </summary>
        /// <param name="kml"></param>
        /// <param name="layer"></param>
        /// <returns></returns>
        public IMFElement CreateElement(Kml kml, ILayer layer)
        {
            KmlCircle circleKml = kml.Placemark.Graph as KmlCircle;

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

            int             index         = -1;
            Circle_ArcGlobe circleElement = null;

            this.Dosomething((Action) delegate()
            {
                //图元
                IGlobeGraphicsLayer graphicsLayer = layer as IGlobeGraphicsLayer;

                circleElement = new Circle_ArcGlobe(graphicsLayer, circleKml);
                IGlobeGraphicsElementProperties properties = new GlobeGraphicsElementPropertiesClass();
                properties.Rasterize = circleKml.Rasterize;
                graphicsLayer.AddElement(circleElement, properties, out index);
                circleElement.Index       = index;
                circleElement.ElementName = kml.Placemark.Name;
            }, true);

            return(circleElement);
        }
Exemple #2
0
        /// <summary>
        /// 移除图元
        /// </summary>
        /// <param name="element"></param>
        /// <param name="layer"></param>
        /// <returns></returns>
        public bool RemoveElement(IMFElement element, ILayer layer)
        {
            if (element == null)
            {
                return(true);
            }
            IGraphicsContainer graphicsLayer = layer as IGraphicsContainer;

            if (graphicsLayer == null)
            {
                return(true);
            }

            Circle_ArcGlobe circleElement = element as Circle_ArcGlobe;

            graphicsLayer.DeleteElement(circleElement);

            return(true);
        }