Esempio n. 1
0
        public void TestStyleKmlElement_NewDoc()
        {
            Assert.AreEqual(KmlTestInfrastructure.StatValueField.IntervalList[0].Color.ColorStringForKml,
                "800A0C80", "begin");
            Assert.AreEqual(writer.ToString().Replace("\r\n","\n"), (@"<?xml version=""1.0"" encoding=""utf-16""?>
            <kml xmlns=""http://earth.google.com/kml/2.1"">
              <Document>
            <name>KML地图</name>
              </Document>
            </kml>").Replace("\r\n", "\n"));

            _doc = new XmlDocument();
            _doc.Load(reader);
            XmlNode documentNode = _doc.GetElementsByTagName("Document")[0];

            _element = new StyleKmlElement(_doc, "Red-Grid")
            {
                LineWidth = 1,
                LineColor = "FFFF8080",
                PolyColor = "800000FF"
            };
            XmlElement styleElement = _element.CreateElement();
            documentNode.AppendChild(styleElement);
            if (_doc.DocumentElement != null) _doc.DocumentElement.AppendChild(documentNode);
            Assert.AreEqual(_doc.InnerXml.Replace("\r\n", "\n"), (@"<?xml version=""1.0"" encoding=""utf-16""?>" +
            @"<kml xmlns=""http://earth.google.com/kml/2.1""><Document><name>KML地图</name>"
            + @"<Style id=""Red-Grid"" xmlns=""""><LineStyle><width>1</width><color>FFFF8080</color></LineStyle>"
            + @"<PolyStyle><color>800000FF</color></PolyStyle></Style></Document></kml>").Replace("\r\n", "\n"));
            Assert.AreEqual(KmlTestInfrastructure.StatValueField.IntervalList[0].Color.ColorStringForKml,
                "800A0C80", "end");
        }
Esempio n. 2
0
 public void TestStyleKmlElement_EmptyDoc()
 {
     Assert.AreEqual(KmlTestInfrastructure.StatValueField.IntervalList[0].Color.ColorStringForKml,
         "800A0C80", "begin");
     _doc = new XmlDocument();
     _element = new StyleKmlElement(_doc, "222");
     XmlElement element2 = _element.CreateElement();
     Assert.IsNotNull(element2);
     Assert.AreEqual(element2.InnerXml,
         "<LineStyle><width>0</width><color></color></LineStyle><PolyStyle><color></color></PolyStyle>");
     Assert.AreEqual(element2.Attributes["id"].InnerXml, "222");
     Assert.AreEqual(KmlTestInfrastructure.StatValueField.IntervalList[0].Color.ColorStringForKml,
         "800A0C80", "end");
 }
        public static void InitializeKmlDocument(this XmlDocument doc)
        {
            XmlNode documentNode = doc.GetElementsByTagName("Document")[0];

            StyleKmlElement styleKmlElement = new StyleKmlElement(doc, "Red-Grid")
            {
                LineWidth = 1,
                LineColor = "FFFF8080",
                PolyColor = "800000FF"
            };
            XmlElement styleElement = styleKmlElement.CreateElement();

            FolderKmlElement folderKmlElement = new FolderKmlElement(doc, "测试点序列");
            XmlElement       folderElement    = folderKmlElement.CreateElement();

            documentNode.AppendChild(styleElement);
            documentNode.AppendChild(folderElement);
            doc.DocumentElement.AppendChild(documentNode);
        }
        public static void InitializeKmlDocument(this XmlDocument doc, IEnumerable <string> colorStringList)
        {
            XmlNode documentNode = doc.GetElementsByTagName("Document")[0];

            FolderKmlElement folderKmlElement = new FolderKmlElement(doc, "测试点序列");
            XmlElement       folderElement    = folderKmlElement.CreateElement();

            foreach (string colorString in colorStringList)
            {
                StyleKmlElement styleKmlElement = new StyleKmlElement(doc, "Color-" + colorString)
                {
                    LineWidth = 1,
                    LineColor = "FFFF8080",
                    PolyColor = colorString
                };
                XmlElement styleElement = styleKmlElement.CreateElement();

                documentNode.AppendChild(styleElement);
            }

            documentNode.AppendChild(folderElement);
            doc.DocumentElement.AppendChild(documentNode);
        }
Esempio n. 5
0
        public static void InitializeKmlDocument(this XmlDocument doc, IEnumerable<string> colorStringList)
        {
            XmlNode documentNode = doc.GetElementsByTagName("Document")[0];

            FolderKmlElement folderKmlElement = new FolderKmlElement(doc, "测试点序列");
            XmlElement folderElement = folderKmlElement.CreateElement();

            foreach (string colorString in colorStringList)
            {
                StyleKmlElement styleKmlElement = new StyleKmlElement(doc, "Color-" + colorString)
                {
                    LineWidth = 1,
                    LineColor = "FFFF8080",
                    PolyColor = colorString
                };
                XmlElement styleElement = styleKmlElement.CreateElement();

                documentNode.AppendChild(styleElement);
            }

            documentNode.AppendChild(folderElement);
            doc.DocumentElement.AppendChild(documentNode);
        }
Esempio n. 6
0
        public static void InitializeKmlDocument(this XmlDocument doc)
        {
            XmlNode documentNode = doc.GetElementsByTagName("Document")[0];

            StyleKmlElement styleKmlElement = new StyleKmlElement(doc, "Red-Grid")
            {
                LineWidth = 1,
                LineColor = "FFFF8080",
                PolyColor = "800000FF"
            };
            XmlElement styleElement = styleKmlElement.CreateElement();

            FolderKmlElement folderKmlElement = new FolderKmlElement(doc, "测试点序列");
            XmlElement folderElement = folderKmlElement.CreateElement();

            documentNode.AppendChild(styleElement);
            documentNode.AppendChild(folderElement);
            doc.DocumentElement.AppendChild(documentNode);
        }