Esempio n. 1
0
        public void TerrainLineTest()
        {
            var    startCoord = new Coordinate(60, 4);
            var    endCoord   = new Coordinate(62, 6);
            var    noOfPoints = 10;
            double bearingDeg;
            double distanceM;
            var    distM     = MapHelper.CalculateDistanceApproxM(startCoord, endCoord);
            var    coordList = TerrainReader.GetCoordinateLine(startCoord, endCoord, noOfPoints, out bearingDeg, out distanceM);

            //TerrainReader.CloseMemoryMap();
            TerrainReader.LoadMemoryMap();
            var testHeightM = TerrainReader.GetHeightM(new Coordinate(60, 5));

            Assert.IsTrue(testHeightM != 0, "Test height should not be 0. Memory map not loaded.");
            var sw      = Stopwatch.StartNew();
            var heights = TerrainReader.GetHeightArrayM(coordList);

            sw.Stop();
            var time10coordsMs = sw.ElapsedMilliseconds;

            GameManager.Instance.Log.LogDebug("TerrainLineTest: Get 10 coords: " + time10coordsMs + " ms");
            sw.Start();
            endCoord = new Coordinate(55, 13);
            var summary10 = TerrainReader.GetTerrainHeightSummary(startCoord, endCoord, 10);

            sw.Stop();
            var time10coordsSummaryMs = sw.ElapsedMilliseconds;

            GameManager.Instance.Log.LogDebug("TerrainLineTest: Get 10 coords summary: " + time10coordsSummaryMs + " ms");
            sw.Start();
            var terrainSummary = TerrainReader.GetTerrainHeightSummary(startCoord, endCoord, 1000);

            sw.Stop();
            var time1000coordsSummaryMs = sw.ElapsedMilliseconds;

            GameManager.Instance.Log.LogDebug("TerrainLineTest: Get 1000 coords summary: " + time1000coordsSummaryMs + " ms");
            TerrainReader.CloseMemoryMap();
        }