Commit 5bf50ee9 authored by Tomasz Włostowski's avatar Tomasz Włostowski

VIEW: added CalculateExtents() method

parent 922bf1dd
......@@ -1019,3 +1019,38 @@ void VIEW::UpdateItems()
m_needsUpdate.clear();
}
struct VIEW::extentsVisitor {
BOX2I extents;
bool first;
extentsVisitor()
{
first = true;
}
bool operator()( VIEW_ITEM* aItem )
{
if(first)
extents = aItem->ViewBBox();
else
extents.Merge ( aItem->ViewBBox() );
return false;
}
};
const BOX2I VIEW::CalculateExtents()
{
extentsVisitor v;
BOX2I fullScene;
fullScene.SetMaximum();
BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers )
{
l->items->Query( fullScene, v );
}
return v.extents;
}
......@@ -507,6 +507,8 @@ public:
*/
void UpdateItems();
const BOX2I CalculateExtents() ;
static const int VIEW_MAX_LAYERS = 128; ///< maximum number of layers that may be shown
private:
......@@ -534,6 +536,8 @@ private:
struct unlinkItem;
struct updateItemsColor;
struct changeItemsDepth;
struct extentsVisitor;
///* Redraws contents within rect aRect
void redrawRect( const BOX2I& aRect );
......
Markdown is supported
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