예제 #1
0
        public void TestInitializeKmlDocument()
        {
            Assert.AreEqual(KmlTestInfrastructure.StatValueField.IntervalList[0].Color.ColorStringForKml,
                "800A0C80", "begin");
            KmlTestInfrastructure.StatValueField.FieldName = "同模干扰电平";
            Assert.AreEqual(KmlTestInfrastructure.StatValueField.FieldName, "同模干扰电平");
            XmlDocument doc = new XmlDocument();
            doc.Load(reader);

            StatValueField field = KmlTestInfrastructure.StatValueField;
            doc.InitializeKmlDocument(field.IntervalList.Select(x => x.Color.ColorStringForKml));
            Assert.AreEqual(KmlTestInfrastructure.StatValueField.IntervalList[0].Color.ColorStringForKml,
                "800A0C80", "end");
            Assert.AreEqual(doc.InnerXml,
                @"<?xml version=""1.0"" encoding=""utf-16""?>"
                + @"<kml xmlns=""http://earth.google.com/kml/2.1"">"
                + @"<Document><name>KML地图</name>"
                + @"<Style id=""Color-800A0C80"" xmlns=""""><LineStyle><width>1</width>"
                + @"<color>FFFF8080</color></LineStyle><PolyStyle><color>800A0C80</color></PolyStyle></Style>"
                + @"<Style id=""Color-80670C0C"" xmlns=""""><LineStyle><width>1</width>"
                + @"<color>FFFF8080</color></LineStyle><PolyStyle><color>80670C0C</color></PolyStyle></Style>"
                + @"<Style id=""Color-800A7B0C"" xmlns=""""><LineStyle><width>1</width>"
                + @"<color>FFFF8080</color></LineStyle><PolyStyle><color>800A7B0C</color></PolyStyle></Style>"
                + @"<Folder xmlns=""""><name>测试点序列</name></Folder>"
                + @"</Document></kml>");
        }
예제 #2
0
        public static XmlDocument GenerateKmlDoc(List<MeasurePointInfo> measurePointList, 
            StatValueField field, TextReader reader)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(reader);
            doc.InitializeKmlDocument(field.IntervalList.Select(x => x.Color.ColorStringForKml));

            for (int i = 0; i < measurePointList.Count(); i++)
            {
                PlacemarkKmlElement placemarkKmlElement = new PlacemarkKmlElement(doc, "测试点")
                {
                    StyleUrl = "Color-" + measurePointList[i].ColorStringForKml,
                    CoordinatesInfo = measurePointList[i].CoordinatesInfo
                };
                XmlElement placemarkElement = placemarkKmlElement.CreateElement();
                doc.AddPlacemarkElement(placemarkElement);
            }
            return doc;
        }