Unverified Commit 58099faa authored by David Hoese's avatar David Hoese Committed by GitHub
Browse files

Improve log message when tiled image isn't displayed (#316)

When the TiledGeolocatedImage is panned to leave the canvas completely a
ValueError exception is raised to notify about this and also a WARNING log
message is generated (it can be discussed, whether this case is worth a
warning, but...). This commit enhances the wording and adds the
ValueError exception message to the log message in the hope to reduce
confusion about its meaning.

Co-authored-by: default avatarNicolai Kellerer <nicolai.kellerer@askvisual.de>
parent 561a49f2
......@@ -170,8 +170,7 @@ def calc_view_extents(image_extents_box: Box, canvas_point, image_point, canvas_
top = clip(top, image_extents_box.bottom, image_extents_box.top)
if (right - left) < CANVAS_EXTENTS_EPSILON or (top - bot) < CANVAS_EXTENTS_EPSILON:
# they are viewing essentially nothing or the image isn't in view
raise ValueError("Image can't be currently viewed")
raise ValueError("Image is outside of canvas or empty")
return Box(left=left, right=right, bottom=bot, top=top)
......@@ -446,8 +446,9 @@ class SIFTTiledGeolocatedMixin:
view_box = self.get_view_box()
preferred_stride = self._get_stride(view_box)
tile_box = self.calc.visible_tiles(view_box, stride=preferred_stride, extra_tiles_box=Box(1, 1, 1, 1))
except ValueError:
LOG.error("Could not determine viewable image area for '{}'".format(self.name))
except ValueError as e:
# If image is outside of canvas, then an exception will be raised
LOG.warning("Could not determine viewable image area for '{}': {}".format(self.name, e))
return False, self._stride, self._latest_tile_box
num_tiles = (tile_box.bottom - tile_box.top) * (tile_box.right - tile_box.left)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment