示例#1
0
        public void KMLAnimatorFullTest()
        {
            if (File.Exists(Globals.currentDirectory + "test.kml"))
            {
                File.Delete(Globals.currentDirectory + "test.kml");
            }

            var reader     = new TrajectoryFileReader(CoordinateUnit.metric);
            var trajectory = reader.createTrajectoryFromFile(Globals.testdataDirectory + "test_track.dat");

            var aircraft   = new Aircraft("GP7270", "wing");
            var noiseModel = new IntegratedNoiseModel(trajectory, aircraft);

            noiseModel.StartCalculation(calculationCompleted);
            while (!INMCompleted)
            {
            }

            TemporalGrid temporalGrid = noiseModel.TemporalGrid;

            var population = new List <double[]> {
                new double[3] {
                    104064, 475499, 2.5
                },
                new double[3] {
                    104262, 476470, 3
                }
            };

            var camera   = new FollowKMLAnimatorCamera(aircraft, trajectory);
            var sections = new List <KMLAnimatorSectionInterface>()
            {
                new AircraftKMLAnimator(aircraft, trajectory),
                new AirplotKMLAnimator(trajectory),
                new GroundplotKMLAnimator(trajectory),
                new ContourKMLAnimator(temporalGrid, trajectory, new List <int>()
                {
                    65, 70, 75
                }),
                new AnnoyanceKMLAnimator(temporalGrid, population)
            };
            var animator = new KMLAnimator(sections, camera);

            animator.AnimationToFile(trajectory.Duration, Globals.currentDirectory + "test.kml");

            String output = File.ReadAllText(Globals.currentDirectory + "test.kml");

            try
            {
                var xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(output);
            }
            catch (XmlException ex)
            {
                Assert.Fail(ex.Message);
            }

            INMCompleted = false;
        }
示例#2
0
        public void FollowKMLAnimatorCameraConstructorTest()
        {
            var reader     = new TrajectoryFileReader(CoordinateUnit.metric);
            var trajectory = reader.createTrajectoryFromFile(Globals.testdataDirectory + "test_track.dat");
            var aircraft   = new Aircraft("GP7270", "wing");
            var camera     = new FollowKMLAnimatorCamera(aircraft, trajectory);

            Assert.IsNotNull(camera);
        }
示例#3
0
        public void AicraftKMLAnimatorFinishTest()
        {
            var reader     = new TrajectoryFileReader(CoordinateUnit.metric);
            var trajectory = reader.createTrajectoryFromFile(Globals.testdataDirectory + "test_track.dat");
            var aircraft   = new Aircraft("GP7270", "wing");
            var camera     = new FollowKMLAnimatorCamera(aircraft, trajectory);

            try
            {
                var xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(kmlRoot + camera.KMLFinish() + kmlRootClose);
            }
            catch (XmlException ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        protected void OneTrajectoryVisualisation()
        {
            // Create legend
            var legend = new LegendCreator();

            legend.OutputLegendImage();
            legend.OutputLegendTitle();

            var sections = new List <KMLAnimatorSectionInterface>();

            // Contour animator
            List <int> contoursOfInterest = (_view.VisualiseContoursOfInterest) ? _view.ContoursOfInterest : null;
            var        contourAnimator    = new ContourKMLAnimator(temporalGrid, trajectory, contoursOfInterest);

            if (_view.VisualiseGradient)
            {
                contourAnimator.SetGradientSettings((int)_view.LowestContourValue, (int)_view.HighestContourValue, (int)_view.ContourValueStep);
            }

            // Create sections
            sections.Add(new LegendKMLAnimator());
            sections.Add(new AircraftKMLAnimator(trajectory.Aircraft, trajectory));
            sections.Add(new AirplotKMLAnimator(trajectory));
            sections.Add(new GroundplotKMLAnimator(trajectory));
            sections.Add(contourAnimator);
            //new AnnoyanceKMLAnimator(temporalGrid, population.getPopulationData())
            if (_view.Heatmap)
            {
                var population = new PopulationData(Globals.currentDirectory + "population.dat");
                population.Chance = _view.PopulationFactor;
                var section = new HeatmapKMLAnimator(population);
                section.DotSize = _view.PopulationDotSize;
                section.DotFile = _view.PopulationDotFile;
                sections.Add(section);
            }

            // Create animator
            var camera   = new FollowKMLAnimatorCamera(trajectory.Aircraft, trajectory);
            var animator = new KMLAnimator(sections, camera);

            animator.AnimationToFile(trajectory.Duration, Globals.webrootDirectory + "visualisation.kml");

            _view.Invoke(delegate { _view.PreparationCalculationCompleted(); });
        }