Skip to content

Commit

Permalink
Propagate raster overlay load errors to the user.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Sep 5, 2024
1 parent 770c5bb commit e421079
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 15 additions & 2 deletions CesiumRasterOverlays/src/QuadtreeRasterOverlayTileProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,17 @@ QuadtreeRasterOverlayTileProvider::loadTileImage(
// See https://github.com/CesiumGS/cesium-native/issues/316 for an
// edge case that is not yet handled. Be sure to pass through any
// errors and warnings.
ErrorList errors;
for (LoadedQuadtreeImage& image : images) {
if (image.pLoaded) {
errors.merge(image.pLoaded->errors);
}
}
return LoadedRasterOverlayImage{
ImageCesium(),
Rectangle(),
{},
{},
std::move(errors),
false};
}

Expand Down Expand Up @@ -645,6 +651,12 @@ QuadtreeRasterOverlayTileProvider::combineImages(
const Rectangle& targetRectangle,
const Projection& /* projection */,
std::vector<LoadedQuadtreeImage>&& images) {
ErrorList errors;
for (LoadedQuadtreeImage& image : images) {
if (image.pLoaded) {
errors.merge(std::move(image.pLoaded->errors));
}
}

const CombinedImageMeasurements measurements =
QuadtreeRasterOverlayTileProvider::measureCombinedImage(
Expand All @@ -660,14 +672,15 @@ QuadtreeRasterOverlayTileProvider::combineImages(
std::nullopt,
targetRectangle,
{},
{},
std::move(errors),
true // TODO
};
}

LoadedRasterOverlayImage result;
result.rectangle = measurements.rectangle;
result.moreDetailAvailable = false;
result.errors = std::move(errors);

ImageCesium& target = result.image.emplace();
target.bytesPerChannel = measurements.bytesPerChannel;
Expand Down
4 changes: 4 additions & 0 deletions CesiumRasterOverlays/src/RasterOverlayTileProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ static LoadResult createLoadResultFromLoadedImage(
return result;
}

if (loadedImage.errors.hasErrors()) {
loadedImage.errors.logError(pLogger, "Errors while loading image for tile");
}

if (!loadedImage.errors.warnings.empty()) {
loadedImage.errors.logWarning(
pLogger,
Expand Down

0 comments on commit e421079

Please sign in to comment.