private static int WriteTiles(NpgsqlConnection conn, string geometryTable, string geometryColumn, string idcolumn, double[] translation, List <Tile> tiles, int epsg, string outputPath, int counter, int maxcount, string colorColumn = "", string attributesColumn = "", string lodColumn = "", string query = "") { foreach (var t in tiles) { counter++; var perc = Math.Round(((double)counter / maxcount) * 100, 2); Console.Write($"\rcreating tiles: {counter}/{maxcount} - {perc:F}%"); var geometries = BoundingBoxRepository.GetGeometrySubset(conn, geometryTable, geometryColumn, idcolumn, translation, t, epsg, colorColumn, attributesColumn, lodColumn, query); var triangleCollection = GetTriangles(geometries); var attributes = GetAttributes(geometries); var b3dm = B3dmCreator.GetB3dm(attributesColumn, attributes, triangleCollection); B3dmWriter.WriteB3dm($"{outputPath}/tiles/{counter}.b3dm", b3dm); if (t.Children != null) { counter = WriteTiles(conn, geometryTable, geometryColumn, idcolumn, translation, t.Children, epsg, outputPath, counter, maxcount, colorColumn, attributesColumn, lodColumn, query); } } return(counter); }
public void CreateB3dmTest() { // arrange var p0 = new Point(0, 0, 0); var p1 = new Point(1, 1, 0); var p2 = new Point(1, 0, 0); var triangle1 = new Triangle(p0, p1, p2, 0); var triangles = new List <Triangle>() { triangle1 }; // act var b3dm = B3dmCreator.GetB3dm("id", new List <object>() { "1" }, triangles); // assert Assert.IsTrue(b3dm.B3dmHeader.Version == 1); Assert.IsTrue(b3dm.BatchTableJson == "{\"id\":[\"1\"]}"); }