Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from Amsterdam/feature/clean-up-code
Browse files Browse the repository at this point in the history
Feature/clean up code
  • Loading branch information
sambaas authored Aug 2, 2022
2 parents 49c2d18 + 8fee1e2 commit a266ec0
Show file tree
Hide file tree
Showing 7 changed files with 332 additions and 372 deletions.
9 changes: 5 additions & 4 deletions TileBakeLibrary/CityJSONParsing/CityJSON.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ namespace Netherlands3D.CityJSON
{
public class CityJSON
{
public string sourceFilePath = "";

public JSONNode cityJsonNode;
public Vector3Double[] vertices;
private List<Vector2> textureVertices;
Expand All @@ -43,7 +45,7 @@ public class CityJSON

public CityJSON(string filepath, bool applyTransformScale = true, bool applyTransformOffset = true)
{
//string jsonString = File.ReadAllText(filepath);
sourceFilePath = filepath;
cityJsonNode = JSON.StreamParse(filepath);

if (cityJsonNode == null || cityJsonNode["CityObjects"] == null)
Expand All @@ -53,7 +55,6 @@ public CityJSON(string filepath, bool applyTransformScale = true, bool applyTran
}

//Get vertices
Console.Write("\r reading vertices");
textureVertices = new List<Vector2>();
Textures = new List<Surfacetexture>();

Expand All @@ -70,7 +71,7 @@ public CityJSON(string filepath, bool applyTransformScale = true, bool applyTran
cityJsonNode["transform"]["translate"][2].AsDouble
) : new Vector3Double(0, 0, 0);

//now load all the vertices with the scaler and offset applied
//Load all the vertices with the scaler and offset applied
vertices = new Vector3Double[cityJsonNode["vertices"].Count];
int counter = 0;
foreach (JSONNode node in cityJsonNode["vertices"])
Expand All @@ -82,7 +83,7 @@ public CityJSON(string filepath, bool applyTransformScale = true, bool applyTran
);
vertices[counter++] = vertCoordinates;
}
//get textureVertices
//Get texture vertices
foreach (JSONNode node in cityJsonNode["appearance"]["vertices-texture"])
{
textureVertices.Add(new Vector2(node[0].AsFloat, node[1].AsFloat));
Expand Down
2 changes: 1 addition & 1 deletion TileBakeLibrary/CityJSONParsing/SimpleJSON.cs
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ public static JSONNode StreamParse(string fileName)
{
i = 0;
string percentage = ((int)(100 * streamReader.BaseStream.Position / bytelength)).ToString();
Console.Write($"\rreading file ... { percentage}%");
Console.Write($"\rReading {Path.GetFileName(fileName)} ... { percentage}%");
}
switch (str)
{
Expand Down
Loading

0 comments on commit a266ec0

Please sign in to comment.