예제 #1
0
        public void KmlReadTestv2_0()
        {
            // instantiate and load the gpx test document.
            XmlStreamSource source = new XmlStreamSource(
                Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.UnitTests.test.v2.0.kml"));
            KmlDocument document = new KmlDocument(source);
            object kml = document.Kml;

            if (kml is OsmSharp.Tools.Xml.Kml.v2_0.kml)
            { // all ok here!
                OsmSharp.Tools.Xml.Kml.v2_0.kml kml_type = (kml as OsmSharp.Tools.Xml.Kml.v2_0.kml);

                // test the gpx test file content.
                Assert.IsNotNull(kml_type.Item, "No item was found!");
                Assert.IsInstanceOf<OsmSharp.Tools.Xml.Kml.v2_0.Placemark>(kml_type.Item, "Incorrect item type!");

                OsmSharp.Tools.Xml.Kml.v2_0.Placemark type = (kml_type.Item as OsmSharp.Tools.Xml.Kml.v2_0.Placemark);
                Assert.AreEqual(type.Items.Length, 3, "Incorrect number of items in folder!");
            }
            else
            {
                Assert.Fail("No kml data was read, or data was of the incorrect type!");
            }

            document.Close();
            source.Close();
        }
예제 #2
0
        /// <summary>
        /// Creates a new osm data source.
        /// </summary>
        /// <param name="document"></param>
        public KmlDataSource(KmlDocument document)
        {
            _document = document;
            _id = Guid.NewGuid();

            _read = false;
            _nodes = new Dictionary<long, Node>();
            _ways = new Dictionary<long, Way>();
            _relations = new Dictionary<long, Relation>();

            _ways_per_node = new Dictionary<long, List<long>>();
            _relations_per_member = new Dictionary<long, List<long>>();
        }