Skip to content

Commit

Permalink
Get rid of default constructor for LayerMetadataProjection.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-phaf committed Sep 13, 2024
1 parent 61a5b8a commit 41e7dd5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
3 changes: 1 addition & 2 deletions adagucserverEC/Types/LayerMetadataType.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ struct LayerMetadataDim {
};

struct LayerMetadataProjection {
LayerMetadataProjection() {}
LayerMetadataProjection(CT::string name, double bbox[]) {
LayerMetadataProjection(const CT::string& name, const double bbox[]) {
this->name = name;
for (size_t j = 0; j < 4; j++) {
this->dfBBOX[j] = bbox[j];
Expand Down
17 changes: 10 additions & 7 deletions adagucserverEC/utils/LayerMetadataStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,18 @@ int loadLayerProjectionAndExtentListFromMetadataDb(MetadataLayer *metadataLayer)
return 1;
}
json a;
auto c = a.parse(projInfo.c_str());
for (auto d : c.items()) {
auto c = json::parse(projInfo.c_str());
for (const auto& d : c.items()) {
auto bboxArray = d.value();
LayerMetadataProjection projection;
double bbox[4] =
{
bboxArray[0].get_to((bbox[0])),
bboxArray[1].get_to((bbox[1])),
bboxArray[2].get_to((bbox[2])),
bboxArray[3].get_to((bbox[3])),
};
LayerMetadataProjection projection(d.key().c_str(), bbox);
projection.name = d.key().c_str();
bboxArray[0].get_to((projection.dfBBOX[0]));
bboxArray[1].get_to((projection.dfBBOX[1]));
bboxArray[2].get_to((projection.dfBBOX[2]));
bboxArray[3].get_to((projection.dfBBOX[3]));
metadataLayer->layerMetadata.projectionList.push_back(projection);
}
} catch (json::exception &e) {
Expand Down
6 changes: 3 additions & 3 deletions adagucserverEC/utils/XMLGenUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ int populateMetadataLayerStruct(MetadataLayer *metadataLayer, bool readFromDB) {

std::map<std::string, LayerMetadataProjection> projectionMap;
// Make a unique list of projections
for (auto p : metadataLayer->layerMetadata.projectionList) {
projectionMap[p.name.c_str()] = p;
for (const auto& p : metadataLayer->layerMetadata.projectionList) {
projectionMap.emplace(p.name.c_str(), p);
}
metadataLayer->layerMetadata.projectionList.clear();
for (auto p : projectionMap) {
for (const auto& p : projectionMap) {
metadataLayer->layerMetadata.projectionList.push_back(p.second);
}

Expand Down

0 comments on commit 41e7dd5

Please sign in to comment.