PathEarlViz 1.2.3

dotnet add package PathEarlViz --version 1.2.3
                    
NuGet\Install-Package PathEarlViz -Version 1.2.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PathEarlViz" Version="1.2.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PathEarlViz" Version="1.2.3" />
                    
Directory.Packages.props
<PackageReference Include="PathEarlViz" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PathEarlViz --version 1.2.3
                    
#r "nuget: PathEarlViz, 1.2.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PathEarlViz@1.2.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PathEarlViz&version=1.2.3
                    
Install as a Cake Addin
#tool nuget:?package=PathEarlViz&version=1.2.3
                    
Install as a Cake Tool

PathEarlViz

Provides a means for making Bitmaps out of Maps, mostly for debugging purposes. First, define a coloration method. This tells the renderer what color to give each tile:

private byte[] DotColor = new byte[] { 0, 155, 0, 255 };
private byte[] DotColor_GroundBlocked = new byte[] { 125, 125, 125, 255 };
private byte[] DotColor_SeaBlocked = new byte[] { 0, 0, 155, 255 };

private byte[] Coloration(Map<TestTileInfo> map, int id)
{
    byte[] col = DotColor;
    if (map.IsBlocked(id, EMapLayer.Ground))
        col = DotColor_GroundBlocked;
    else if (map.IsBlocked(id, EMapLayer.Sea))
        col = DotColor_SeaBlocked;
    return col;
}

After that, we can draw the map:

byte[] backColor = new byte[] { 0, 0, 0, 255 };
byte[] lineColor = new byte[] { 100, 100, 100, 255 };

Bitmap bitmap = MapViz<TestTileInfo>.DrawMap(map, 10, backColor, lineColor, Coloration);

Next, we can add graphics for any features we want to highlight manually, by using FindRelativePosition:

// e.g. if we defined some tiles as having forests:
List<int> forestIds = new List<int>()
{
    ids[11, 18], ids[12, 18], ids[13, 18], ids[14, 18],
    ids[11, 19], ids[12, 19], ids[13, 19], ids[14, 19],
    ids[11, 20], ids[12, 20], ids[13, 20], ids[14, 20],
    ids[12, 21],
    ids[12, 22],
    ids[12, 23],
    ids[12, 24],
    ids[12, 25],
};
foreach (int id in forestIds)
    map.Info[id].IsForest = true;

// we can draw dots where the forests are
byte[] col = new byte[] { 100, 200, 100, 255 };
foreach (int id in forestIds)
{
    int relx = MapViz<TestTileInfo>.FindRelativePosition(map.NodeX[id], b.SmallestX, b.Resolution);
    int rely = MapViz<TestTileInfo>.FindRelativePosition(map.NodeY[id], b.SmallestY, b.Resolution);

    bitmap.SetPixel(relx, rely, col, 3);
}

Finally, we can draw paths over the map like so:


MapScratch<TestTileInfo> scratch = new MapScratch<TestTileInfo>();

List<int> pathIdsWalksFliesAndSwims = map.Djikstra(start, target, EMapLayer.None, scratch, cost);
List<int> pathIdsWalksAndSwims = map.Djikstra(start, target, EMapLayer.Ground, scratch, cost);
List<int> pathIdsWalks = map.Djikstra(start, target, EMapLayer.Ground | EMapLayer.Sea, scratch, cost);

MapViz<TestTileInfo>.DrawPath(b, map, pathIdsWalksFliesAndSwims, new byte[] { 255, 0, 0, 255 }, 0);
MapViz<TestTileInfo>.DrawPath(b, map, pathIdsWalksAndSwims, new byte[] { 255, 155, 0, 255 }, 4);
MapViz<TestTileInfo>.DrawPath(b, map, pathIdsWalks, new byte[] { 255, 0, 155, 255 }, -4);

We can convert this Bitmap to a System.Drawing.Bitmap and save it:

b.ToDrawingBitmap().Save("./testforest.png");

Note that ToDrawingBitmap may only work on the Windows platform.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.3 285 11/12/2025
1.2.0 205 10/29/2025
1.1.0 160 10/24/2025
1.0.0 179 10/22/2025