예제 #1
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);
            }

            Point_ArcGlobe pointElement = element as Point_ArcGlobe;

            if (pointElement.Rasterize)
            {
                pointElement.Rasterize = false;
            }
            this.Dosomething((Action) delegate()
            {
                graphicsLayer.DeleteElement(pointElement);
            }, true);

            return(true);
        }
예제 #2
0
        /// <summary>
        /// 创建图元
        /// </summary>
        /// <param name="kml"></param>
        /// <param name="layer"></param>
        /// <returns></returns>
        public IMFElement CreateElement(Kml kml, ILayer layer)
        {
            KmlPoint pointKml = kml.Placemark.Graph as KmlPoint;

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

            int index = -1;

            //图层
            IGlobeGraphicsLayer graphicsLayer = layer as IGlobeGraphicsLayer;

            //图元
            Point_ArcGlobe pointElement = new Point_ArcGlobe(graphicsLayer, pointKml);

            this.Dosomething((Action) delegate()
            {
                IGlobeGraphicsElementProperties properties = new GlobeGraphicsElementPropertiesClass();
                properties.Rasterize = pointKml.Rasterize;                  //栅格化
                graphicsLayer.AddElement(pointElement, properties, out index);

                pointElement.Index       = index;                           //指定索引
                pointElement.ElementName = kml.Placemark.Name;
            }, true);

            return(pointElement);
        }