Esempio n. 1
0
        private static Feature CreateFeature(int index, bool id)
        {
            Feature output;
            int type = index % 7;
            switch (type)
            {
                case 0:
                    output = new Placemark();
                    break;
                case 1:
                    output = new Folder();
                    break;
                case 2:
                    output = new Document();
                    break;
                case 3:
                    output = new NetworkLink();
                    break;
                case 4:
                    output = new GroundOverlay();
                    break;
                case 5:
                    output = new ScreenOverlay();
                    break;
                default:
                    output = new PhotoOverlay();
                    break;
            }

            if (id)
            {
                output.Id = "i" + index;
            }
            else
            {
                output.TargetId = "i" + index;
            }
            return output;
        }
Esempio n. 2
0
        public void TestCalculateLookAtFolder()
        {
            Location location = new Location();
            location.Latitude = 0;
            location.Longitude = 0;

            Model model = new Model();
            model.Location = location;

            Placemark placemark = new Placemark();
            placemark.Geometry = model;

            Folder folder = new Folder();
            folder.AddFeature(placemark);

            var lookat = folder.CalculateLookAt();
            Assert.That(lookat.Latitude, Is.EqualTo(0.0));
            Assert.That(lookat.Longitude, Is.EqualTo(0.0));
            Assert.That(lookat.Range, Is.EqualTo(1000.0));

            Point point = new Point();
            point.Coordinate = new Vector(10, 10);

            PhotoOverlay overlay = new PhotoOverlay();
            overlay.Location = point;

            folder.AddFeature(overlay);
            lookat = folder.CalculateLookAt();
            Assert.That(lookat.Latitude, Is.EqualTo(5.0));
            Assert.That(lookat.Longitude, Is.EqualTo(5.0));
            Assert.That(lookat.Range, Is.EqualTo(1494183.4444).Within(0.0001));
        }