Improved image view scene rect size when no images are there. Added warning when transform cannot be computed because some data are missing.

This commit is contained in:
matlabbe
2024-09-16 15:55:38 -07:00
parent 69ac21f811
commit 0e85bd849c
3 changed files with 30 additions and 2 deletions
+19
View File
@@ -4762,6 +4762,25 @@ void DatabaseViewer::update(int value,
{
ULOGGER_DEBUG("Image depth is empty");
}
if(!rect.isValid())
{
if(data.cameraModels().size())
{
for(unsigned int i=0; i<data.cameraModels().size(); ++i)
{
rect.setWidth(rect.width()+data.cameraModels()[i].imageWidth());
rect.setHeight(std::max((int)rect.height(), data.cameraModels()[i].imageHeight()));
}
}
else if(data.stereoCameraModels().size())
{
for(unsigned int i=0; i<data.cameraModels().size(); ++i)
{
rect.setWidth(rect.width()+data.stereoCameraModels()[i].left().imageWidth());
rect.setHeight(std::max((int)rect.height(), data.stereoCameraModels()[i].left().imageHeight()));
}
}
}
if(rect.isValid())
{
view->setSceneRect(rect);