コード例 #1
0
ファイル: DrawRectangle.cs プロジェクト: AnuoF/MapFrame
 /// <summary>
 /// 鼠标按下事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void mapControl_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
 {
     if (e.button == 1 && !isMouseDown && !isControl)
     {
         //绘制矩形  四个点的位置集中在一个点上
         Kml kml = new Kml();
         kml.Placemark.Name = "arc_rectangle" + Utils.ElementIndex;
         KmlPolygon kmlRectangle = new KmlPolygon();
         kmlRectangle.Description  = "手动绘制的一个矩形";
         kmlRectangle.FillColor    = Color.Yellow;
         kmlRectangle.OutLineColor = Color.Black;
         kmlRectangle.OutLineSize  = 1;
         MapLngLat lnglat = new MapLngLat(e.mapX, e.mapY);
         pointList.Add(lnglat);
         pointList.Add(lnglat);
         pointList.Add(lnglat);
         pointList.Add(lnglat);
         kmlRectangle.PositionList = pointList;
         kml.Placemark.Graph       = kmlRectangle;
         IMFElement element = null;
         layer.AddElement(kml, out element);
         polygonElement = element as IMFPolygon;
         isMouseDown    = true;
         isFinish       = false;
     }
 }
コード例 #2
0
        public static KmlGeometry[] ParseGeometryChildren(XElement xml, XmlNamespaceManager namespaces)
        {
            List <KmlGeometry> temp = new List <KmlGeometry>();

            foreach (XElement element in xml.Elements())
            {
                switch (element.Name.LocalName)
                {
                case "extrude":
                case "tessellate":
                case "altitudeMode":
                    continue;

                case "Point":
                    temp.Add(KmlPoint.Parse(element));
                    break;

                case "LineString":
                    temp.Add(KmlLineString.Parse(element));
                    break;

                case "Polygon":
                    temp.Add(KmlPolygon.Parse(element));
                    break;

                case "MultiGeometry":
                    temp.Add(KmlMultiGeometry.Parse(element));
                    break;
                }
            }

            return(temp.ToArray());
        }
コード例 #3
0
        private void AddMultiGeometry(bool sky, KmlPlacemark placemark, float width, Color polyColor, Color lineColor, KmlMultiGeometry geo)
        {
            foreach (KmlGeometry childGeo in geo.Children)
            {
                if (childGeo is KmlPoint)
                {
                    KmlPoint point = (KmlPoint)childGeo;

                    placemark.Point = (KmlPoint)childGeo;
                    AddPlacemark(placemark);
                }
                else if (childGeo is KmlLineList)
                {
                    AddLines(sky, childGeo as KmlLineList, width, lineColor, lineColor, false);
                }
                else if (childGeo is KmlPolygon)
                {
                    KmlPolygon child = (KmlPolygon)childGeo;
                    if (child.OuterBoundary != null)
                    {
                        AddLines(sky, child.OuterBoundary as KmlLineList, width, polyColor, lineColor, child.extrude);
                        // to do 3d work and subtract inner rings
                    }
                }
                else if (childGeo is KmlMultiGeometry)
                {
                    AddMultiGeometry(sky, placemark, width, polyColor, lineColor, childGeo as KmlMultiGeometry);
                }
            }
        }
コード例 #4
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);
        }
コード例 #5
0
        private void moveCameraToKml(KmlLayer kmlLayer)
        {
            if (mIsRestore)
            {
                return;
            }
            try
            {
                //Retrieve the first container in the KML layer
                KmlContainer container = (KmlContainer)kmlLayer.Containers.Iterator().Next();
                //Retrieve a nested container within the first container
                container = (KmlContainer)container.Containers.Iterator().Next();
                //Retrieve the first placemark in the nested container
                KmlPlacemark placemark = (KmlPlacemark)container.Placemarks.Iterator().Next();
                //Retrieve a polygon object in a placemark
                KmlPolygon polygon = (KmlPolygon)placemark.Geometry;
                //Create LatLngBounds of the outer coordinates of the polygon
                LatLngBounds.Builder builder = new LatLngBounds.Builder();
                foreach (LatLng latLng in polygon.OuterBoundaryCoordinates)
                {
                    builder.Include(latLng);
                }

                int width  = Resources.DisplayMetrics.WidthPixels;
                int height = Resources.DisplayMetrics.HeightPixels;
                getMap().MoveCamera(CameraUpdateFactory.NewLatLngBounds(builder.Build(), width, height, 1));
            }
            catch (Java.Lang.Exception e)
            {
                // may fail depending on the KML being shown
                e.PrintStackTrace();
            }
        }
コード例 #6
0
ファイル: DrawPolygon.cs プロジェクト: AnuoF/MapFrame
        /// <summary>
        /// 鼠标左键双击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void mapControl_eventLButtonDbClick(object sender, _DHOSOFTMapControlEvents_eventLButtonDbClickEvent e)
        {
            if (!isControl && listPoints.Count > 2)
            {
                if (!string.IsNullOrEmpty(tempName))
                {
                    mapControl.MgsDelObject(tempName);
                }

                Kml        kml     = new Kml();
                KmlPolygon polygon = new KmlPolygon();
                polygon.PositionList = listPoints;
                polygon.FillColor    = Color.FromArgb(0, Color.White);
                polygon.OutLineColor = Color.Red;
                polygon.OutLineSize  = 3;
                kml.Placemark.Name   = "mgis_polygon" + Utils.ElementIndex;
                kml.Placemark.Graph  = polygon;
                IMFElement element = null;
                layer.AddElement(kml, out element);
                polygonElement = element as IMFPolygon;
                RegistCommondExecutedEvent();
                ReleaseCommond();//修改  陈静
                isFinish = true;
                listPoints.Clear();
            }
        }
コード例 #7
0
        /// <summary>
        /// 鼠标弹起结束绘制
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void mapControl_eventLButtonUp(object sender, _DHOSOFTMapControlEvents_eventLButtonUpEvent e)
        {
            if (!isControl)
            {
                MapLngLat p1 = new MapLngLat(e.dLong, listPoints[0].Lat);
                MapLngLat p2 = new MapLngLat(e.dLong, e.dLat);
                MapLngLat p3 = new MapLngLat(listPoints[0].Lng, e.dLat);
                listPoints.Add(p1);
                listPoints.Add(p2);
                listPoints.Add(p3);

                if (!string.IsNullOrEmpty(tempName))
                {
                    mapControl.MgsDelObject(tempName);
                }
                Kml        kml       = new Kml();
                KmlPolygon rectangle = new KmlPolygon();
                kml.Placemark.Name     = "mgis_rec" + Utils.ElementIndex;
                rectangle.PositionList = listPoints;
                rectangle.FillColor    = System.Drawing.Color.FromArgb(0, System.Drawing.Color.White);
                rectangle.OutLineColor = System.Drawing.Color.Red;
                rectangle.OutLineSize  = 3;
                kml.Placemark.Graph    = rectangle;
                IMFElement element = null;
                layer.AddElement(kml, out element);
                recElement = element as IMFPolygon;

                RegistCommondExecutedEvent();
                ReleaseCommond();//修改  陈静
                isFinish = true;
                listPoints.Clear();
            }
        }
コード例 #8
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);
        }
コード例 #9
0
ファイル: Polygon_GMap.cs プロジェクト: AnuoF/MapFrame
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="pList">多边形点集合</param>
        /// <param name="kPolygon">多边形的kml</param>
        /// <param name="name">多边形的名称</param>
        public Polygon_GMap(List <PointLatLng> pList, KmlPolygon kPolygon, string name)
            : base(pList, name)
        {
            this.ElementName  = name;
            this.ElementType  = ElementTypeEnum.Polygon;
            this.Description  = kPolygon.Description;
            this.Stroke.Width = kPolygon.OutLineSize;

            //设置面的填充色
            fillColor = kPolygon.FillColor;
            SolidBrush b = new SolidBrush(fillColor);

            this.Fill = b;

            //设置面的轮廓颜色
            outLineColor = kPolygon.OutLineColor;
            outLineSize  = kPolygon.OutLineSize;
            Pen pen = new Pen(outLineColor, kPolygon.OutLineSize);

            this.Stroke           = pen;
            this.IsHitTestVisible = true;   // 鼠标经过可见
            flashTimer            = new Timer();
            flashTimer.Elapsed   += flashTimer_Elapsed;
            flashTimer.Interval   = 500;

            base.Tag = this;
        }
コード例 #10
0
        public virtual GeoJsonPolygon Convert(KmlPolygon polygon)
        {
            double[][][] array = new double[polygon.InnerBoundaries.Count + 1][][];

            array[0] = new double[polygon.OuterBoundaries.LinearRing.Coordinates.Count][];

            for (int i = 0; i < polygon.OuterBoundaries.LinearRing.Coordinates.Count; i++)
            {
                KmlPointCoordinates c = polygon.OuterBoundaries.LinearRing.Coordinates[i];
                array[0][i] = c.HasAltitude ? new [] { c.Longitude, c.Latitude, c.Altitude } : new [] { c.Longitude, c.Latitude };
            }

            if (polygon.InnerBoundaries != null)
            {
                for (int j = 0; j < polygon.InnerBoundaries.Count; j++)
                {
                    array[j + 1] = new double[polygon.InnerBoundaries[j].LinearRing.Coordinates.Count][];
                    for (int k = 0; k < polygon.InnerBoundaries[j].LinearRing.Coordinates.Count; k++)
                    {
                        KmlPointCoordinates c = polygon.InnerBoundaries[j].LinearRing.Coordinates[k];
                        array[j + 1][k] = c.HasAltitude ? new[] { c.Longitude, c.Latitude, c.Altitude } : new[] { c.Longitude, c.Latitude };
                    }
                }
            }

            return(new GeoJsonPolygon(array));
        }
コード例 #11
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="_graphicsLayer">图层</param>
        /// <parparam name="polygonKml">面的kml</parparam>
        public Polygon_ArcGlobe(IGlobeGraphicsLayer _graphicsLayer, KmlPolygon polygonKml)
        {
            this.graphicsLayer = _graphicsLayer;

            this.ElementType = ElementTypeEnum.Polygon;           //图元类型
            this.Description = polygonKml.Description;            //图元描述

            #region  符号

            simpleFillSymbol = new SimpleFillSymbolClass();
            simpleLineSymbol = new SimpleLineSymbolClass();

            IRgbColor fillColor = new RgbColorClass();
            fillColor.Transparency = polygonKml.FillColor.A;
            fillColor.Red          = polygonKml.FillColor.R;
            fillColor.Green        = polygonKml.FillColor.G;
            fillColor.Blue         = polygonKml.FillColor.B;
            this.opacity           = polygonKml.FillColor.A;

            IRgbColor outlineColor = new RgbColorClass();
            outlineColor.Transparency = polygonKml.OutLineColor.A;
            outlineColor.Red          = polygonKml.OutLineColor.R;
            outlineColor.Green        = polygonKml.OutLineColor.G;
            outlineColor.Blue         = polygonKml.OutLineColor.B;

            simpleLineSymbol.Color   = outlineColor;
            simpleLineSymbol.Width   = polygonKml.OutLineSize;
            simpleFillSymbol.Color   = fillColor;
            simpleFillSymbol.Outline = simpleLineSymbol;

            this.fillColor    = polygonKml.FillColor;
            this.outlineColor = polygonKml.OutLineColor;
            this.outLineSize  = polygonKml.OutLineSize;

            #endregion

            #region  位置

            IGeometry        geometry        = new PolygonClass();
            IPointCollection pointCollection = geometry as IPointCollection;
            IPoint           point           = new PointClass();
            foreach (var item in polygonKml.PositionList)
            {
                point.PutCoords(item.Lng, item.Lat);
                point.Z = item.Alt;
                pointCollection.AddPoint(point);
            }

            (pointCollection as IZAware).ZAware = true;

            #endregion

            base.Geometry = pointCollection as IGeometry;           //指定位置
            base.Symbol   = simpleFillSymbol;                       //指定符号

            flashTimer          = new System.Timers.Timer();
            flashTimer.Elapsed += new System.Timers.ElapsedEventHandler(flashTimer_Elapsed);
            flashTimer.Interval = 500;
        }
コード例 #12
0
ファイル: Polygon_ArcMap.cs プロジェクト: AnuoF/MapFrame
        /// <summary>
        /// 面的构造函数
        /// </summary>
        /// <param name="_layer">图层</param>
        /// <param name="kmlPolygon">图元(kml)</param>
        /// <param name="mapfac">地图工厂</param>
        public Polygon_ArcMap(AxMapControl _mapcontrol, KmlPolygon kmlPolygon, FactoryArcMap _mapFac)
        {
            this.mapControl = _mapcontrol;
            mapFactory      = _mapFac;

            Dosomething((Action)(delegate
            {
                lineSymbol = new SimpleLineSymbolClass();
                //轮廓颜色
                IColor outlineColor = new RgbColorClass()
                {
                    Red = kmlPolygon.OutLineColor.R,
                    Green = kmlPolygon.OutLineColor.G,
                    Blue = kmlPolygon.OutLineColor.B
                };
                lineSymbol.Color = outlineColor;
                lineSymbol.Width = kmlPolygon.OutLineSize;
                //存储颜色和宽度
                outLineColor = kmlPolygon.OutLineColor;
                outLineWidth = kmlPolygon.OutLineSize;

                fillSymbol = new SimpleFillSymbol();
                fillSymbol.Outline = lineSymbol;
                //填充色
                IColor c = new RgbColorClass()
                {
                    Red = kmlPolygon.FillColor.R,
                    Green = kmlPolygon.FillColor.G,
                    Blue = kmlPolygon.FillColor.B
                };
                fillSymbol.Color = c;
                this.fillColor = kmlPolygon.FillColor;

                base.Symbol = fillSymbol;
                polygon = new PolygonClass();
                pointCollection = polygon as IPointCollection;
                foreach (var lngLat in kmlPolygon.PositionList)
                {
                    pointCollection.AddPoint(new PointClass()
                    {
                        X = lngLat.Lng, Y = lngLat.Lat
                    });
                }
                base.Geometry = (IGeometry)pointCollection;

                pointList = new List <MapLngLat>();//坐标点集合
                pointList = kmlPolygon.PositionList;

                this.Description = kmlPolygon.Description;
            }), true);

            flashTimer          = new Timer();
            flashTimer.Elapsed += new ElapsedEventHandler(flashTimer_Elapsed);
        }
コード例 #13
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public void Dispose()
 {
     ReleaseCommond();
     mapLogic             = null;
     mapControl           = null;
     layer                = null;
     pointList            = null;
     polygonElement       = null;
     CommondExecutedEvent = null;
     kml        = null;
     polygonKml = null;
     drawn      = false;
 }
コード例 #14
0
        /// <summary>
        /// 鼠标按下事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mapControl_OnMouseDown(object sender, IGlobeControlEvents_OnMouseDownEvent e)
        {
            if (e.button == 1) //鼠标左键
            {
                MapLngLat lnglat = this.SceneToGeographyPoint(e.x, e.y);
                lnglat.Alt = lnglat.Alt * -1;
                pointList.Add(lnglat);
                if (pointList.Count == 2)
                {
                    kml = new Kml();
                    kml.Placemark.Name = "辅助线";
                    KmlLineString lineKml = new KmlLineString();
                    lineKml.Rasterize    = true;
                    lineKml.Description  = "辅助线";
                    lineKml.PositionList = pointList;
                    lineKml.Color        = Color.FromArgb(70, Color.Orange);
                    kml.Placemark.Graph  = lineKml;
                    layer.AddElement(kml);

                    kml.Placemark.Name     = "绘制面" + Utils.Index;
                    polygonKml             = new KmlPolygon();
                    polygonKml.Rasterize   = true;
                    polygonKml.Description = "手动绘制的面";
                    polygonKml.FillColor   = Color.FromArgb(70, Color.Orange);
                    kml.Placemark.Graph    = polygonKml;
                }
                else if (pointList.Count == 3)                      //更新面
                {
                    layer.RemoveElement("辅助线");
                    polygonKml.PositionList = pointList;
                    kml.Placemark.Graph     = polygonKml;
                    drawn = layer.AddElement(kml, out polygonElement);
                }
                else if (pointList.Count > 3)
                {
                    layer.RemoveElement(polygonElement);
                    polygonKml.PositionList = pointList;
                    kml.Placemark.Graph     = polygonKml;
                    drawn = layer.AddElement(kml, out polygonElement);
                }
                layer.Refresh();
            }
        }
コード例 #15
0
ファイル: KmlPlacemark.cs プロジェクト: peopleknows/InfoEdit
 public KmlPlacemark(string name, string description, string styleUrl, KmlPoint point, KmlLineString line, KmlPolygon polygon)
 {
     Name         = name;
     _description = description;
     StyleUrl     = styleUrl;
     ExtendedData = string.Empty;
     if (point != null)
     {
         Point = point;
     }
     if (line != null)
     {
         LineString = line;
     }
     if (polygon != null)
     {
         Polygon = polygon;
     }
 }
コード例 #16
0
ファイル: PolygonFactory.cs プロジェクト: AnuoF/MapFrame
        /// <summary>
        /// 创建图元
        /// </summary>
        /// <param name="kml">kml对象</param>
        /// <param name="gmapOverlay">图层</param>
        /// <returns></returns>
        public IMFElement CreateElement(Kml kml, GMapOverlay gmapOverlay)
        {
            KmlPolygon kSurface = kml.Placemark.Graph as KmlPolygon;

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

            List <PointLatLng> pList = new List <PointLatLng>();

            foreach (MapLngLat lngLat in kSurface.PositionList)
            {
                PointLatLng point = new PointLatLng(lngLat.Lat, lngLat.Lng);
                pList.Add(point);
            }

            //添加面
            Polygon_GMap gPolygon = new Polygon_GMap(pList, kSurface, kml.Placemark.Name);

            if (gmapOverlay.Control.InvokeRequired)
            {
                gmapOverlay.Control.Invoke(new Action(delegate
                {
                    gmapOverlay.Polygons.Add(gPolygon);
                }));
            }
            else
            {
                gmapOverlay.Polygons.Add(gPolygon);
            }

            return(gPolygon);
        }
コード例 #17
0
        private void MoveCameraToKml(KmlLayer kmlLayer)
        {
            //Retrieve the first container in the KML layer
            KmlContainer container = kmlLayer.Containers.ToEnumerable <KmlContainer>().FirstOrDefault();

            //Retrieve a nested container within the first container
            container = container.Containers.ToEnumerable <KmlContainer>().FirstOrDefault();
            //Retrieve the first placemark in the nested container
            KmlPlacemark placemark = container.Placemarks.ToEnumerable <KmlPlacemark>().FirstOrDefault();
            //Retrieve a polygon object in a placemark
            KmlPolygon polygon = (KmlPolygon)placemark.Geometry;

            //Create LatLngBounds of the outer coordinates of the polygon
            LatLngBounds.Builder builder = new LatLngBounds.Builder();
            foreach (LatLng latLng in polygon.OuterBoundaryCoordinates)
            {
                builder.Include(latLng);
            }

            int width  = Resources.DisplayMetrics.WidthPixels;
            int height = Resources.DisplayMetrics.HeightPixels;

            googleMap.MoveCamera(CameraUpdateFactory.NewLatLngBounds(builder.Build(), width, height, 1));
        }
コード例 #18
0
ファイル: Kml.cs プロジェクト: peopleknows/InfoEdit
        /// <summary>
        /// 调用此方法
        /// </summary>
        /// <param name="xmlname">xml名称</param>
        /// <param name="filename">导出文件名</param>
        /// <param name="lst">数据</param>
        /// <returns></returns>
        public static int CreateKml(string xmlname, string filename, List <dataFormat> lst)
        {
            List <KmlPlacemark> ls = new List <KmlPlacemark>();

            foreach (dataFormat d in lst)
            {
                string type = d.type;

                string coords = d.coordinates.Trim();

                string styleUrl = d.styleUrl;

                string name = d.name;
                if (string.IsNullOrEmpty(name))
                {
                    name = "";
                }
                string description = d.description;
                if (string.IsNullOrEmpty(description))
                {
                    description = "";
                }

                if (type == "point")
                {
                    if (string.IsNullOrEmpty(styleUrl))
                    {
                        styleUrl = "#downArrowIcon";
                    }
                    KmlPoint     p         = new KmlPoint(coords);
                    KmlPlacemark placemark = new KmlPlacemark(name, description, styleUrl, p, null, null);
                    ls.Add(placemark);
                }
                else if (type == "line")
                {
                    if (string.IsNullOrEmpty(styleUrl))
                    {
                        styleUrl = "#blue";
                    }
                    KmlLineString line      = new KmlLineString(coords.Split(';').ToList());
                    KmlPlacemark  placemark = new KmlPlacemark(name, description, styleUrl, null, line, null);
                    ls.Add(placemark);
                }
                else if (type == "polygon")
                {
                    if (string.IsNullOrEmpty(styleUrl))
                    {
                        styleUrl = "#blue";
                    }
                    KmlPolygon   polygon   = new KmlPolygon(coords.Split(';').ToList());
                    KmlPlacemark placemark = new KmlPlacemark(name, description, styleUrl, null, null, polygon);
                    ls.Add(placemark);
                }
            }
            try
            {
                KmlDocument document = new KmlDocument(xmlname, filename, ls);
                Kml         kml      = new Kml(document);
                kml.GenerateKmlFile("a.kml");
                return(1);
            }
            catch (Exception e)
            {
                return(0);
            }
        }
コード例 #19
0
        private void AddFeatureToDisplay(KmlFeature feature, bool sky)
        {
            KmlDocument doc = feature as KmlDocument;

            if (doc != null)
            {
                sky = doc.sky;
            }
            if (!(feature is KmlNetworkLink))
            {
                if (feature.visibility == false)
                {
                    return;
                }
                else if (feature is KmlPlacemark)
                {
                    KmlPlacemark placemark = (KmlPlacemark)feature;
                    KmlStyle     style     = placemark.Style.GetStyle(placemark.Selected);
                    Color        lineColor = Color.White;
                    if (style != null)
                    {
                        lineColor = style.LineStyle.Color;
                    }
                    if (placemark.geometry is KmlPoint)
                    {
                        placemark.Point = (KmlPoint)placemark.geometry;
                        AddPlacemark(placemark);
                    }
                    else if (placemark.geometry is KmlMultiGeometry)
                    {
                        KmlMultiGeometry geo = (KmlMultiGeometry)placemark.geometry;
                        AddMultiGeometry(sky, placemark, (float)style.LineStyle.Width, style.PolyStyle.Color, lineColor, geo);
                    }
                    else if (placemark.geometry is KmlPolygon)
                    {
                        KmlPolygon geo = (KmlPolygon)placemark.geometry;
                        if (geo.OuterBoundary != null)
                        {
                            AddLines(sky, geo.OuterBoundary as KmlLineList, (float)style.LineStyle.Width, style.PolyStyle.Color, lineColor, geo.extrude);
                            // to do 3d work and subtract inner rings
                        }
                    }
                    else if (placemark.geometry is KmlLineString)
                    {
                        KmlLineString geo = (KmlLineString)placemark.geometry;

                        List <Vector3d> vertexList = new List <Vector3d>();
                        for (int i = 0; i < (geo.PointList.Count); i++)
                        {
                            vertexList.Add(Coordinates.GeoTo3dDouble(geo.PointList[i].Lat, geo.PointList[i].Lng, 1 + (geo.PointList[i].Alt / geo.MeanRadius)));
                        }
                        for (int i = 0; i < (geo.PointList.Count - 1); i++)
                        {
                            if (sky)
                            {
                                lines.AddLine(Coordinates.RADecTo3d(-(180.0 - geo.PointList[i].Lng) / 15 + 12, geo.PointList[i].Lat, 1), Coordinates.RADecTo3d(-(180.0 - geo.PointList[i + 1].Lng) / 15 + 12, geo.PointList[i + 1].Lat, 1), lineColor, new Dates());
                            }
                            else
                            {
                                lines.AddLine(vertexList[i], vertexList[i + 1], lineColor, new Dates());
                            }
                        }
                    }
                }
                if (feature is KmlGroundOverlay && feature.visibility)
                {
                    AddGroundOverlay(feature as KmlGroundOverlay);
                }

                if (feature is KmlScreenOverlay && feature.visibility)
                {
                    AddScreenOverlay(feature as KmlScreenOverlay);
                }
            }
            if (feature.visibility)
            {
                if (feature is KmlContainer)
                {
                    KmlContainer container = (KmlContainer)feature;
                    if (container.children != null)
                    {
                        foreach (KmlFeature child in container.children)
                        {
                            AddFeatureToDisplay(child, sky);
                        }
                    }
                }
                else
                {
                    if (feature is KmlNetworkLink)
                    {
                        KmlNetworkLink netLink = (KmlNetworkLink)feature;
                        if (netLink.LinkRoot != null)
                        {
                            foreach (KmlFeature child in netLink.LinkRoot.children)
                            {
                                AddFeatureToDisplay(child, sky);
                            }
                        }
                    }
                }
            }
        }