Skip to content

Commit

Permalink
featuretiler: Fix Linux g++ 4.8 build.
Browse files Browse the repository at this point in the history
  • Loading branch information
emminizer committed Feb 5, 2019
1 parent 4f5ae23 commit 920117e
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions src/applications/osgearth_featuretiler/osgearth_featuretiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@ struct Env
unsigned counter;
};

struct FeatureData
{
double x, y;
FeatureID fid;
};

struct SortByX
{
bool operator()(const FeatureData& lhs, const FeatureData& rhs) const {
return lhs.x < rhs.x;
}
};

struct SortByY
{
bool operator()(const FeatureData& lhs, const FeatureData& rhs) const {
return lhs.y < rhs.y;
}
};

int
split(const Config& inputConf, TDTiles::Tile* parentTile, unsigned depth, Env& env)
{
Expand Down Expand Up @@ -100,23 +120,6 @@ split(const Config& inputConf, TDTiles::Tile* parentTile, unsigned depth, Env& e
return usage(outputStatus.message().c_str());
}

struct FeatureData {
double x, y;
FeatureID fid;
};

struct {
bool operator()(const FeatureData& lhs, const FeatureData& rhs) const {
return lhs.x < rhs.x;
}
} sortByX;

struct {
bool operator()(const FeatureData& lhs, const FeatureData& rhs) const {
return lhs.y < rhs.y;
}
} sortByY;

std::vector<FeatureData> data;
int count = input->getFeatureCount();
if (count > 0)
Expand Down Expand Up @@ -153,6 +156,7 @@ split(const Config& inputConf, TDTiles::Tile* parentTile, unsigned depth, Env& e

if (isWide)
{
SortByX sortByX;
std::sort(data.begin(), data.end(), sortByX);
median = ((data.size() & 0x1) == 0) ?
0.5 * (data[data.size() / 2].x + data[data.size() / 2].x) :
Expand All @@ -161,6 +165,7 @@ split(const Config& inputConf, TDTiles::Tile* parentTile, unsigned depth, Env& e
}
else
{
SortByY sortByY;
std::sort(data.begin(), data.end(), sortByY);
median = ((data.size() & 0x1) == 0) ?
0.5 * (data[data.size() / 2].y + data[data.size() / 2].y) :
Expand Down Expand Up @@ -286,11 +291,11 @@ main(int argc, char** argv)
TDTiles::Asset asset;
tileset->asset()->version() = "1.0";

std::ofstream out(outFile);
std::ofstream out(outFile.c_str());
Json::Value tilesetJSON = tileset->getJSON();
Json::StyledStreamWriter writer;
writer.write(out, tilesetJSON);
out.close();

return 0;
}
}

0 comments on commit 920117e

Please sign in to comment.