Mercurial > hg > orthanc-stone
changeset 1374:1e4878ed1d77
added GetBoundingBox to Scene2D
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 20 Apr 2020 18:20:47 +0200 |
parents | e0cdf8688d56 |
children | 4431ffdcc2a4 |
files | Framework/Scene2D/Scene2D.cpp Framework/Scene2D/Scene2D.h |
diffstat | 2 files changed, 20 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Scene2D/Scene2D.cpp Wed Apr 08 14:14:51 2020 +0200 +++ b/Framework/Scene2D/Scene2D.cpp Mon Apr 20 18:20:47 2020 +0200 @@ -222,22 +222,29 @@ canvasToScene_ = inverse; } + void Scene2D::GetBoundingBox(Extent2D &target) const + { + target.Reset(); + + for (Content::const_iterator it = content_.begin(); + it != content_.end(); ++it) + { + assert(it->second != NULL); + + Extent2D tmp; + if (it->second->GetLayer().GetBoundingBox(tmp)) + { + target.Union(tmp); + } + } + } + void Scene2D::FitContent(unsigned int canvasWidth, unsigned int canvasHeight) { Extent2D extent; - for (Content::const_iterator it = content_.begin(); - it != content_.end(); ++it) - { - assert(it->second != NULL); - - Extent2D tmp; - if (it->second->GetLayer().GetBoundingBox(tmp)) - { - extent.Union(tmp); - } - } + GetBoundingBox(extent); if (!extent.IsEmpty()) {