Beispiel #1
0
        private static KMLPlacemark ReadPlacemark(XmlReader reader)
        {
            string name        = string.Empty;
            string description = string.Empty;

            KMLPlacemarkItem item = null;

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name.ToUpper())
                    {
                    case "NAME":
                    {
                        name = TinyKML.ReadString(reader);
                        break;
                    }

                    case "DESCRIPTION":
                    {
                        description = TinyKML.ReadString(reader);
                        break;
                    }

                    case "POINT":
                    {
                        item = (KMLPoint)TinyKML.ReadPlacemarkItem(reader);

                        if (item != null)
                        {
                            return(new KMLPlacemark(name, description, item));
                        }
                        else
                        {
                            throw new FormatException();
                        }
                    }

                    case "LINESTRING":
                    {
                        item = (KMLLineString)TinyKML.ReadPlacemarkItem(reader);

                        if (item != null)
                        {
                            return(new KMLPlacemark(name, description, item));
                        }
                        else
                        {
                            throw new FormatException();
                        }
                    }
                    }
                }
            }

            throw new FormatException();
        }
Beispiel #2
0
 public KMLPlacemark(string name, string description, KMLLocation[] points)
 {
     Name          = name;
     Description   = description;
     PlacemarkItem = new KMLLineString(points);
 }
Beispiel #3
0
 public KMLPlacemark(string name, string description, KMLPlacemarkItem item)
 {
     Name          = name;
     Description   = description;
     PlacemarkItem = item;
 }
Beispiel #4
0
 public KMLPlacemark(string name, string description, bool extrude, bool tessellate, KMLLocation point)
 {
     Name          = name;
     Description   = description;
     PlacemarkItem = new KMLPoint(point, extrude, tessellate);
 }