Esempio n. 1
0
        /// <summary>
        /// 创建图元
        /// </summary>
        /// <param name="kml">图元的kml</param>
        /// <param name="layer">图元所在的图层</param>
        /// <returns></returns>
        public IMFElement CreateElement(Kml kml, ILayer layer)
        {
            KmlPolygon polygonKml = kml.Placemark.Graph as KmlPolygon;

            if (polygonKml == null)
            {
                return(null);
            }
            if (polygonKml.PositionList == null)
            {
                return(null);
            }

            int index = -1;
            Polygon_ArcGlobe polygonElement = null;

            this.Dosomething((Action) delegate()
            {
                //图层
                IGlobeGraphicsLayer graphicsLayer = layer as IGlobeGraphicsLayer;
                //实例化图元
                polygonElement = new Polygon_ArcGlobe(graphicsLayer, polygonKml);

                //设置属性
                GlobeGraphicsElementPropertiesClass properties = new GlobeGraphicsElementPropertiesClass();
                properties.Rasterize = polygonKml.Rasterize;
                graphicsLayer.AddElement(polygonElement, properties, out index);
                polygonElement.Index       = index;                                 //指定索引
                polygonElement.ElementName = kml.Placemark.Name;
            }, true);

            return(polygonElement);
        }
Esempio n. 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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        /// <summary>
        /// 创建图元
        /// </summary>
        /// <param name="kml"></param>
        /// <param name="layer"></param>
        /// <returns></returns>
        public IMFElement CreateElement(Kml kml, ILayer layer)
        {
            KmlText textKml = kml.Placemark.Graph as KmlText;

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

            int index = -1;

            //图层
            IGlobeGraphicsLayer graphicsLayer = layer as IGlobeGraphicsLayer;

            MapFrame.ArcGlobe.Element.Text_ArcGlobe textElement = null;
            this.Dosomething((Action) delegate()
            {
                //图元
                textElement = new MapFrame.ArcGlobe.Element.Text_ArcGlobe(graphicsLayer, textKml);
                GlobeGraphicsElementPropertiesClass properties = new GlobeGraphicsElementPropertiesClass();
                properties.Rasterize = textKml.Rasterize;
                graphicsLayer.AddElement(textElement, properties, out index);
                textElement.Index       = index; //指定索引
                textElement.ElementName = kml.Placemark.Name;
            }, true);

            return(textElement);
        }
        public void AddElement(IElement element, IGlobeGraphicsElementProperties elementProperties)
        {
            int elementIndex;

            IGlobeGraphicsLayer globeGraphicsLayer = _layer as IGlobeGraphicsLayer;

            globeGraphicsLayer.AddElement(element, elementProperties, out elementIndex);
        }
Esempio n. 6
0
        /// <summary>
        /// 创建图元
        /// </summary>
        /// <param name="kml">模型的kml</param>
        /// <param name="layer">模型所在的图层</param>
        /// <returns></returns>
        public IMFElement CreateElement(Kml kml, ILayer layer)
        {
            KmlModel3d modelkml = kml.Placemark.Graph as KmlModel3d;

            if (modelkml == null)
            {
                return(null);
            }
            if (modelkml.Position == null)
            {
                return(null);
            }
            if (!File.Exists(modelkml.ModelFilePath))
            {
                return(null);
            }
            int index = -1;

            //图层
            IGlobeGraphicsLayer graphicLayer = layer as IGlobeGraphicsLayer;

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

            //实例化图元
            Model3d_ArcGlobe modelElement = null;

            //添加图元
            this.Dosomething((Action) delegate()
            {
                IImport3DFile import3Dfile = null;
                if (!filePathDic.ContainsKey(modelkml.ModelFilePath))
                {
                    import3Dfile = new Import3DFileClass();
                    import3Dfile.CreateFromFile(modelkml.ModelFilePath);
                    filePathDic.Add(modelkml.ModelFilePath, import3Dfile);
                }
                else//模型已创建
                {
                    import3Dfile = filePathDic[modelkml.ModelFilePath];
                }

                modelElement = new Model3d_ArcGlobe(graphicLayer, modelkml, import3Dfile);

                //设置属性
                GlobeGraphicsElementPropertiesClass properties = new GlobeGraphicsElementPropertiesClass();
                properties.Rasterize = modelkml.Rasterize;

                graphicLayer.AddElement(modelElement, properties, out index);
                modelElement.Index       = index;
                modelElement.ElementName = kml.Placemark.Name;
            }, true);

            return(modelElement);
        }
Esempio n. 7
0
        /// <summary>
        /// 创建线图元
        /// </summary>
        /// <param name="kml">线的kml</param>
        /// <param name="layer">图元所在的图层</param>
        /// <returns></returns>
        public IMFElement CreateElement(Kml kml, ILayer layer)
        {
            KmlLineString lineKml = kml.Placemark.Graph as KmlLineString;

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

            int index = -1;
            //图层
            IGlobeGraphicsLayer graphicLayer = layer as IGlobeGraphicsLayer;

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

            //图元
            Line_ArcGlobe lineElement = null;

            Dosomething((Action) delegate()
            {
                //属性
                GlobeGraphicsElementPropertiesClass properties = new GlobeGraphicsElementPropertiesClass();
                properties.Rasterize = lineKml.Rasterize;

                //添加图元
                lineElement = new Line_ArcGlobe(graphicLayer, lineKml);
                graphicLayer.AddElement(lineElement, properties, out index);
                lineElement.Index       = index;                                //指定索引
                lineElement.ElementName = kml.Placemark.Name;
            }, true);

            return(lineElement);
        }