public string GenerateAirspaceGrid(List <IFlightTrack> flights) { string airspacegrid = ""; var dps = new List <FTDataPoint>(); flights.ForEach(f => dps.Add(f.GetNewestDataPoint())); //empty grid char[,] grid = new char[grid_heigth, grid_width]; for (int i = 0; i < grid_heigth; i++) { for (int j = 0; j < grid_width; j++) { grid[i, j] = ' '; } } //x at flightpositions IAirspaceArea aa = _airspace.GetAirspaceArea(); //float width = aa.NorthEastCornerX - aa.SouthWestCornerX; //float heigth = aa.NorthEastCornerY - aa.SouthWestCornerY; float width = aa.Width(); float heigth = aa.Heigth(); if (dps.Count > 0) { foreach (var dp in dps) { int x = (int)lerp(0, grid_width, ((dp.X - aa.GetSouthWestCorner().X) / width)); int y = (int)lerp(0, grid_heigth, ((dp.Y - aa.GetSouthWestCorner().Y) / heigth)); grid[grid_heigth - 1 - y, x] = 'X'; } } //grid to string + add border string line = ""; for (int i = 0; i < grid_width; i++) { line += "-"; } line = "+" + line + "+\n"; airspacegrid += line; for (int i = 0; i < grid_heigth; i++) { airspacegrid += "|"; for (int j = 0; j < grid_width; j++) { airspacegrid += grid[i, j]; } airspacegrid += "|\n"; } airspacegrid += line; return(airspacegrid); }
public void AirspaceArea_Width_PositiveCalculationOutput() { //Arrange float testWidth = 90000 - 10000; //Assert Assert.That(_uut.Width(), Is.EqualTo(testWidth)); }