Esempio n. 1
0
    private static void AddTerrainString(StringBuilder sb, Planetoid planet, Image <L16> elevationMap, int landCoords)
    {
        sb.AppendFormat("Sea Level:                 {0}m", Math.Round(planet.SeaLevel));
        sb.AppendLine();

        var elevationRange = planet.GetElevationRange(elevationMap);

        if (planet.Hydrosphere?.IsEmpty == false)
        {
            var totalCoords    = (decimal)(elevationMap.Width * elevationMap.Height);
            var landProportion = landCoords / totalCoords;
            sb.AppendFormat("Land proportion:           {0}", Math.Round(landProportion, 2));
            sb.AppendLine();
            sb.AppendFormat("Water proportion:          {0}", Math.Round(1 - landProportion, 2));
            sb.AppendLine();
        }

        sb.AppendFormat("Avg Elevation:             {0}m", Math.Round(elevationRange.Average));
        sb.AppendLine();
        sb.AppendFormat("Min Elevation:             {0}m / {1}m", Math.Round(elevationRange.Min), Math.Round(planet.MaxElevation));
        sb.AppendLine();
        sb.AppendFormat("Max Elevation:             {0}m / {1}m", Math.Round(elevationRange.Max), Math.Round(planet.MaxElevation));
        sb.AppendLine();
    }