Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option tileset_version + updating dependencies #75

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ Tool parameters:
--use_i3dm (optional - default false) Use I3dm format - only first model will be processed (false creates Cmpt)

--boundingvolume_heights (option - default: 0,10) - Tile boundingVolume heights (min, max) in meters. The heights will be added to the z_min and z_max values of the input geometries.

--tileset_version (optional - default "") - Tileset version
```

# Docker

See https://hub.docker.com/r/geodan/i3dm.export
Expand Down
4 changes: 4 additions & 0 deletions src/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public class Options

[Option("boundingvolume_heights", Required = false, Default = "0,10", HelpText = "Tile boundingVolume heights (min, max) in meters")]
public string BoundingVolumeHeights { get; set; }

[Option("tileset_version", Required = false, Default = "", HelpText = "Tileset version")]
public string TilesetVersion { get; set; }

}


Expand Down
7 changes: 6 additions & 1 deletion src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ static void Main(string[] args)
SqlMapper.AddTypeHandler(new JArrayTypeHandler());

var version = Assembly.GetExecutingAssembly().GetName().Version;
var tilesetVersion = o.TilesetVersion;

var stopWatch = new Stopwatch();
stopWatch.Start();

Console.WriteLine("Tool: I3dm.export");
Console.WriteLine("Version: " + version);
if (!tilesetVersion.Equals(string.Empty))
{
Console.WriteLine($"Tileset version: {tilesetVersion}");
}
Console.WriteLine($"Exporting instances from {o.Table}...");
Console.WriteLine($"Use GPU instancing: {o.UseGpuInstancing}");

Expand Down Expand Up @@ -133,7 +138,7 @@ static void Main(string[] args)
var subtreeLevels = subtreeFiles.Count > 1 ? ((Tile)subtreeFiles.ElementAt(1).Key).Z : 2;
var availableLevels = tiles.Max(t => t.Z) + 1;

var tilesetjson = TreeSerializer.ToImplicitTileset(rootBoundingVolumeRegion, o.GeometricError, availableLevels, subtreeLevels, version, (bool)o.UseGpuInstancing, (bool)o.UseI3dm);
var tilesetjson = TreeSerializer.ToImplicitTileset(rootBoundingVolumeRegion, o.GeometricError, availableLevels, subtreeLevels, version, (bool)o.UseGpuInstancing, (bool)o.UseI3dm, tilesetVersion);
var file = $"{o.Output}{Path.AltDirectorySeparatorChar}tileset.json";
Console.WriteLine($"Subtree files written: {subtreeFiles.Count}");
Console.WriteLine("SubtreeLevels: " + subtreeLevels);
Expand Down
4 changes: 3 additions & 1 deletion src/Tileset/TilesetClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace i3dm.export.Tileset;

public class TileSet
{
public Asset asset { get; set; }
public double geometricError { get; set; }
public Root root { get; set; }
public Asset asset { get; set; }
}

public class Child : ICloneable
Expand Down Expand Up @@ -76,4 +76,6 @@ public class Asset
public string generator { get; set; }

public string version { get; set; }

public string tilesetVersion { get; set; }
}
6 changes: 5 additions & 1 deletion src/TreeSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ namespace i3dm.export;

public static class TreeSerializer
{
public static string ToImplicitTileset(double[] box, double geometricError, int availableLevels, int subtreeLevels, Version version, bool useGpuInstancing = false, bool useI3dm = false)
public static string ToImplicitTileset(double[] box, double geometricError, int availableLevels, int subtreeLevels, Version version, bool useGpuInstancing = false, bool useI3dm = false, string tilesetVersion = "")
{
var tileset = new TileSet
{
asset = new Asset() { version = "1.1", generator = $"i3dm.export {version}" },
geometricError = geometricError
};
if (!tilesetVersion.Equals(string.Empty))
{
tileset.asset.tilesetVersion = tilesetVersion;
}
var root = GetRoot(geometricError, box, "ADD");
var extension = useGpuInstancing ? "glb" : "cmpt";
if(useI3dm)
Expand Down