AgateLib.Utility.SurfacePacker.SurfacePacker.RectPacker< T > Class Template Reference

Class which takes a bunch of rectangles and organizes them to all fit within a large rectangle. More...

List of all members.

Public Member Functions

 RectPacker (Size containerSize)
 Creates a RectPacker object of the specified size.
void AddRect (Rectangle rect, T tag)
 Adds a used rectangle to the RectPacker. This throws an exception if pixels in the rectangle specified are already used.
bool FindEmptySpace (Size size, out Rectangle rect)
 Finds an empty space of the specified size.
void QueueObject (Size size, T tag)
 Adds an object of the specified size to the queue.
void ClearQueue ()
 Clears the queue.
void AddQueue ()
 Packs all the objects in the queue to the container. Sorts them first, to optimize coverage.
ICollection< T > UnusuedQueueObjects ()
 Returns a collection of all objects in the queue which have not been added to the container rect.
IEnumerator< RectHolder< T > > GetEnumerator ()
 Enumerates through the packed rectangles.

Properties

Size ContainerSize [get, set]
 Gets or sets the size of the container to fit all the rects into.
double PixelsUsedPercentage [get]
 Returns what percentage of the container is used up.


Detailed Description

template<T>
class AgateLib::Utility::SurfacePacker::RectPacker< T >

Class which takes a bunch of rectangles and organizes them to all fit within a large rectangle.

Template Parameters:
T The type of objects which will be added to the rectangles. This is so that the RectPacker can keep track of which rectangles go with which objects.

Constructor & Destructor Documentation

template<T >
AgateLib.Utility.SurfacePacker.SurfacePacker.RectPacker< T >.RectPacker ( Size  containerSize  ) 

Creates a RectPacker object of the specified size.

Parameters:
containerSize 


Member Function Documentation

template<T >
void AgateLib.Utility.SurfacePacker.SurfacePacker.RectPacker< T >.AddQueue (  ) 

Packs all the objects in the queue to the container. Sorts them first, to optimize coverage.

template<T >
void AgateLib.Utility.SurfacePacker.SurfacePacker.RectPacker< T >.AddRect ( Rectangle  rect,
tag 
)

Adds a used rectangle to the RectPacker. This throws an exception if pixels in the rectangle specified are already used.

Parameters:
rect 
tag 

template<T >
void AgateLib.Utility.SurfacePacker.SurfacePacker.RectPacker< T >.ClearQueue (  ) 

Clears the queue.

template<T >
bool AgateLib.Utility.SurfacePacker.SurfacePacker.RectPacker< T >.FindEmptySpace ( Size  size,
out Rectangle  rect 
)

Finds an empty space of the specified size.

Returns true if there was an empty space of that size available.

Parameters:
size 
rect 
Returns:

template<T >
IEnumerator<RectHolder<T> > AgateLib.Utility.SurfacePacker.SurfacePacker.RectPacker< T >.GetEnumerator (  ) 

Enumerates through the packed rectangles.

Returns:

template<T >
void AgateLib.Utility.SurfacePacker.SurfacePacker.RectPacker< T >.QueueObject ( Size  size,
tag 
)

Adds an object of the specified size to the queue.

Parameters:
size 
tag 

template<T >
ICollection<T> AgateLib.Utility.SurfacePacker.SurfacePacker.RectPacker< T >.UnusuedQueueObjects (  ) 

Returns a collection of all objects in the queue which have not been added to the container rect.

Returns:


Property Documentation

template<T >
Size AgateLib.Utility.SurfacePacker.SurfacePacker.RectPacker< T >.ContainerSize [get, set]

Gets or sets the size of the container to fit all the rects into.

template<T >
double AgateLib.Utility.SurfacePacker.SurfacePacker.RectPacker< T >.PixelsUsedPercentage [get]

Returns what percentage of the container is used up.


The documentation for this class was generated from the following file:
AgateLib
Awesome Game and Tool Engine Library
SourceForge.net Logo