Esempio n. 1
0
        public void GeometryProducesId()
        {
            var placemark = new XElement("Placemark",
                                         new XAttribute("id", "STS-122"),
                                         new XElement("LineString",
                                                      new XElement("altitudeMode", "absolute"),
                                                      new XElement("coordinates", "-68,37,105045 -68,37,105041")));

            var geometry = new Placemark(placemark, m_document);

            geometry.WritePacket();

            string result = m_stringWriter.ToString();
            Assert.That(result.Contains("\"id\":\"STS-122\""));
        }
Esempio n. 2
0
        public void GxMultiTrackWithInterpolateTrueGeneratesOneTrack()
        {
            XElement element = new XElement("Placemark", new XAttribute(XNamespace.Xmlns + "gx", "http://www.google.com/kml/ext/2.2"),
                                new XElement("name", "STS-122"),
                                new XElement("description",
                                             new XCData("<html><table><tr><td><b>Start Time (T-0:44): </b></td><td>2007 Dec 6 16:31:00.000 EST</td></tr></table></html>")),
                                new XElement(m_gxNamespace + "MultiTrack",
                                    new XElement(m_gxNamespace + "interpolate", "1"),
                                    new XElement(m_gxNamespace + "Track",
                                             new XElement("when", "2007-12-06T16:31"),
                                             new XElement(m_gxNamespace + "coord", "0 1 5"),
                                             new XElement("when", "2007-12-06T17:31"),
                                             new XElement(m_gxNamespace + "coord", "0 2 6"),
                                             new XElement("when", "2007-12-06T18:31"),
                                             new XElement(m_gxNamespace + "coord", "0 3 7"),
                                             new XElement("altitudeMode", "absolute")),
                                    new XElement(m_gxNamespace + "Track",
                                             new XElement("when", "2007-12-06T19:31"),
                                             new XElement(m_gxNamespace + "coord", "0 1 5"),
                                             new XElement("when", "2007-12-06T20:31"),
                                             new XElement(m_gxNamespace + "coord", "0 2 6"),
                                             new XElement("when", "2007-12-06T21:31"),
                                             new XElement(m_gxNamespace + "coord", "0 3 7"),
                                             new XElement("altitudeMode", "absolute"))));

            Placemark p = new Placemark(element, m_document);
            p.WritePacket();

            string result = m_stringWriter.ToString();
            var count = result.Select((c, i) =>
            {
                if (i < result.Count() - 2)
                    return result.Substring(i, 2);
                return "";
            }).Count(sub => sub.Equals("id"));
            Assert.AreEqual(1, count);
        }
Esempio n. 3
0
        public void GxMultiTrackAltitudeModeClampToGroundSetsHeightToZero()
        {
            XElement element = new XElement("Placemark", new XAttribute(XNamespace.Xmlns + "gx", "http://www.google.com/kml/ext/2.2"),
                                new XElement("name", "STS-122"),
                                new XElement("description",
                                             new XCData("<html><table><tr><td><b>Start Time (T-0:44): </b></td><td>2007 Dec 6 16:31:00.000 EST</td></tr></table></html>")),
                                new XElement(m_gxNamespace + "MultiTrack",
                                    new XElement(m_gxNamespace + "interpolate", "1"),
                                    new XElement("altitudeMode", "clampToGround"),
                                    new XElement(m_gxNamespace + "Track",
                                             new XElement("when", "2007-12-06T16:31"),
                                             new XElement(m_gxNamespace + "coord", "0 1 5"),
                                             new XElement("when", "2007-12-06T17:31"),
                                             new XElement(m_gxNamespace + "coord", "0 2 6"),
                                             new XElement("when", "2007-12-06T18:31"),
                                             new XElement(m_gxNamespace + "coord", "0 3 7"),
                                             new XElement("altitudeMode", "absolute")),
                                    new XElement(m_gxNamespace + "Track",
                                             new XElement("when", "2007-12-06T19:31"),
                                             new XElement(m_gxNamespace + "coord", "0 1 5"),
                                             new XElement("when", "2007-12-06T20:31"),
                                             new XElement(m_gxNamespace + "coord", "0 2 6"),
                                             new XElement("when", "2007-12-06T21:31"),
                                             new XElement(m_gxNamespace + "coord", "0 3 7"),
                                             new XElement("altitudeMode", "absolute"))));

            Placemark p = new Placemark(element, m_document);
            p.WritePacket();

            string result = m_stringWriter.ToString();
            Assert.IsTrue(result.Contains("\"position\":{\"epoch\":\"20071206T1631Z\",\"cartographicRadians\":[0.0,0.0,0.017453292519943295,0.0,3.6e3,0.0,0.03490658503988659,0.0,7.2e3,0.0,0.05235987755982989,0.0]},\"position\":{\"epoch\":\"20071206T1931Z\",\"cartographicRadians\":[0.0,0.0,0.017453292519943295,0.0,3.6e3,0.0,0.03490658503988659,0.0,7.2e3,0.0,0.05235987755982989,0.0]}"));
        }