VIEW: added CalculateExtents() method
This commit is contained in:
parent
922bf1ddea
commit
5bf50ee910
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue