Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
using v5 metatiles
Browse files Browse the repository at this point in the history
  • Loading branch information
vaclavblazek committed Mar 12, 2021
1 parent af2019a commit 103f5d9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion externals/libmath
19 changes: 11 additions & 8 deletions mapproxy/src/mapproxy/generator/metatile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,13 @@ struct Sample {
, max(conv(math::Point3(x, y, value[2])))
, heightRange(navConv(math::Point3(x, y, value[1]))(2)
, navConv(math::Point3(x, y, value[2]))(2))
, ge(geConv(math::Point3(x, y, value[1]))(2)
, geConv(math::Point3(x, y, value[2]))(2)
, geConv(math::Point3(x, y, value[0]))(2))
{}
{
// ge is invalid so far, update it with extremes
vts::update(ge, geConv(math::Point3(x, y, value[1])));
vts::update(ge, geConv(math::Point3(x, y, value[2])));
// set surrogate
ge.surrogate = geConv(math::Point3(x, y, value[0]))(2);
}
};

const Sample* getSample(const Sample &sample)
Expand Down Expand Up @@ -356,7 +359,7 @@ metatileFromDemImpl(const vts::TileId &tileId, Sink &sink, Arsenal &arsenal

// compute tile extents and height range
auto heightRange(HeightRange::emptyRange());
math::Extents3 te(math::InvalidExtents{});
// math::Extents3 te(math::InvalidExtents{});
double area(0.0);
int triangleCount(0);
double avgHeightSum(0.f);
Expand All @@ -373,8 +376,8 @@ metatileFromDemImpl(const vts::TileId &tileId, Sink &sink, Arsenal &arsenal
// update tile extents (if sample valid)
if (p) {
// update by both minimum and maximum
math::update(te, p->min);
math::update(te, p->max);
// math::update(te, p->min);
// math::update(te, p->max);
vts::update(node.geomExtents, p->ge);
avgHeightSum += p->ge.surrogate;
++avgHeightCount;
Expand Down Expand Up @@ -403,7 +406,7 @@ metatileFromDemImpl(const vts::TileId &tileId, Sink &sink, Arsenal &arsenal
setChildren(block, nodeId, node);

// set extents
node.extents = vr::normalizedExtents(rf, te);
// node.extents = vr::normalizedExtents(rf, te);

// build height range
node.heightRange.min = std::floor(heightRange.min);
Expand Down
12 changes: 6 additions & 6 deletions mapproxy/src/mapproxy/generator/surface-spheroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ void SurfaceSpheroid::generateMetatile(const vts::TileId &tileId

// compute tile extents and height range
auto heightRange(vs::Range<double>::emptyRange());
math::Extents3 te(math::InvalidExtents{});
// math::Extents3 te(math::InvalidExtents{});
double area(0);
int triangleCount(0);
double avgHeightSum(0.f);
Expand All @@ -383,14 +383,14 @@ void SurfaceSpheroid::generateMetatile(const vts::TileId &tileId

// update tile extents (if point valid)
if (p) {
math::update(te, *p);
// math::update(te, *p);
// convert point to proper SDS
const auto sdsHeight(geConv(*p)[2]);
const auto sdPoint(geConv(*p));
// update geom extents
vts::update(node.geomExtents, sdsHeight);
vts::update(node.geomExtents, sdPoint);

// accumulate average height (surrogate) calculator
avgHeightSum += sdsHeight;
avgHeightSum += sdPoint(2);
++avgHeightCount;
}

Expand Down Expand Up @@ -424,7 +424,7 @@ void SurfaceSpheroid::generateMetatile(const vts::TileId &tileId
}

// set extents
node.extents = vr::normalizedExtents(rf, te);
// node.extents = vr::normalizedExtents(rf, te);

// build height range
node.heightRange.min = std::floor(heightRange.min);
Expand Down

0 comments on commit 103f5d9

Please sign in to comment.