public void TestChangeCoordinates()
        {
            // Create the target
            var point = new Point();

            point.Coordinate = new Vector(38.38, -122.122);

            var placemark = new Placemark();

            placemark.Id       = "placemark123";
            placemark.Geometry = point;
            placemark.Name     = "placemark name";

            var file = KmlFile.Create(placemark, false);

            // Now create the Update
            const double latitude  = -38.38;
            const double longitude = 122.122;

            point            = new Point();
            point.Coordinate = new Vector(latitude, longitude);

            placemark          = new Placemark();
            placemark.Geometry = point;
            placemark.TargetId = "placemark123";

            var change = new ChangeCollection();

            change.Add(placemark);

            var update = new Update();

            update.AddUpdate(change);

            // Now test the update worked
            update.Process(file);

            placemark = file.Root as Placemark;
            Assert.That(placemark, Is.Not.Null);
            Assert.That(placemark.Id, Is.EqualTo("placemark123"));
            Assert.That(placemark.Name, Is.EqualTo("placemark name"));

            point = placemark.Geometry as Point;
            Assert.That(point, Is.Not.Null);
            Assert.That(point.Coordinate.Latitude, Is.EqualTo(latitude));
            Assert.That(point.Coordinate.Longitude, Is.EqualTo(longitude));
        }
Example #2
0
        public void TestChangeCoordinates()
        {
            // Create the target
            var point = new Point();
            point.Coordinate = new Vector(38.38, -122.122);

            var placemark = new Placemark();
            placemark.Id = "placemark123";
            placemark.Geometry = point;
            placemark.Name = "placemark name";

            var file = KmlFile.Create(placemark, false);

            // Now create the Update
            const double latitude = -38.38;
            const double longitude = 122.122;

            point = new Point();
            point.Coordinate = new Vector(latitude, longitude);

            placemark = new Placemark();
            placemark.Geometry = point;
            placemark.TargetId = "placemark123";

            var change = new ChangeCollection();
            change.Add(placemark);

            var update = new Update();
            update.AddUpdate(change);

            // Now test the update worked
            update.Process(file);

            placemark = file.Root as Placemark;
            Assert.That(placemark, Is.Not.Null);
            Assert.That(placemark.Id, Is.EqualTo("placemark123"));
            Assert.That(placemark.Name, Is.EqualTo("placemark name"));

            point = placemark.Geometry as Point;
            Assert.That(point, Is.Not.Null);
            Assert.That(point.Coordinate.Latitude, Is.EqualTo(latitude));
            Assert.That(point.Coordinate.Longitude, Is.EqualTo(longitude));
        }