Skip to content

Commit

Permalink
Add 'octvertexnormals' entry to layer.json file
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuarte47 committed May 17, 2018
1 parent 1f5c1fb commit 3471487
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/ctb-tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ class TerrainMetadata {
/// http://help.agi.com/TerrainServer/RESTAPIGuide.html
/// Example:
/// https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles/layer.json
void writeJsonFile(const std::string &filename, const std::string &datasetName, const std::string &outputFormat = "Terrain", const std::string &profile = "geodetic") const {
void writeJsonFile(const std::string &filename, const std::string &datasetName, const std::string &outputFormat = "Terrain", const std::string &profile = "geodetic", bool writeVertexNormals = false) const {
FILE *fp = fopen(filename.c_str(), "w");

if (fp == NULL) {
Expand All @@ -459,6 +459,9 @@ class TerrainMetadata {
}
fprintf(fp, " \"attribution\": \"\",\n");
fprintf(fp, " \"schema\": \"tms\",\n");
if (writeVertexNormals) {
fprintf(fp, " \"extensions\": [ \"octvertexnormals\" ],\n");
}
fprintf(fp, " \"tiles\": [ \"{z}/{x}/{y}.terrain?v={version}\" ],\n");

if (strcmp(profile.c_str(), "geodetic") == 0) {
Expand Down Expand Up @@ -782,7 +785,7 @@ main(int argc, char *argv[]) {
const size_t rfindpos = datasetName.rfind('.');
if (std::string::npos != rfindpos) datasetName = datasetName.erase(rfindpos);

metadata->writeJsonFile(filename, datasetName, std::string(command.outputFormat), std::string(command.profile));
metadata->writeJsonFile(filename, datasetName, std::string(command.outputFormat), std::string(command.profile), command.vertexNormals);
delete metadata;
}

Expand Down

0 comments on commit 3471487

Please sign in to comment.