Maintains a set of rectangles as a complex region. More...
Classes | |
| class | Iterator |
| An iterator for accessing all the rectangles in a RectangleList. More... | |
Public Member Functions | |
| RectangleList () throw () | |
| Creates an empty RectangleList. | |
| RectangleList (const RectangleList &other) throw () | |
| Creates a copy of another list. | |
| RectangleList (const Rectangle< int > &rect) throw () | |
| Creates a list containing just one rectangle. | |
| RectangleList & | operator= (const RectangleList &other) throw () |
| Copies this list from another one. | |
| ~RectangleList () throw () | |
| Destructor. | |
| bool | isEmpty () const throw () |
| Returns true if the region is empty. | |
| int | getNumRectangles () const throw () |
| Returns the number of rectangles in the list. | |
| const Rectangle< int > | getRectangle (const int index) const throw () |
| Returns one of the rectangles at a particular index. | |
| void | clear () throw () |
| Removes all rectangles to leave an empty region. | |
| void | add (int x, int y, int width, int height) throw () |
| Merges a new rectangle into the list. | |
| void | add (const Rectangle< int > &rect) throw () |
| Merges a new rectangle into the list. | |
| void | addWithoutMerging (const Rectangle< int > &rect) throw () |
| Dumbly adds a rectangle to the list without checking for overlaps. | |
| void | add (const RectangleList &other) throw () |
| Merges another rectangle list into this one. | |
| void | subtract (const Rectangle< int > &rect) throw () |
| Removes a rectangular region from the list. | |
| void | subtract (const RectangleList &otherList) throw () |
| Removes all areas in another RectangleList from this one. | |
| bool | clipTo (const Rectangle< int > &rect) throw () |
| Removes any areas of the region that lie outside a given rectangle. | |
| bool | clipTo (const RectangleList &other) throw () |
| Removes any areas of the region that lie outside a given rectangle list. | |
| bool | getIntersectionWith (const Rectangle< int > &rect, RectangleList &destRegion) const throw () |
| Creates a region which is the result of clipping this one to a given rectangle. | |
| void | swapWith (RectangleList &otherList) throw () |
| Swaps the contents of this and another list. | |
| bool | containsPoint (int x, int y) const throw () |
| Checks whether the region contains a given point. | |
| bool | containsRectangle (const Rectangle< int > &rectangleToCheck) const throw () |
| Checks whether the region contains the whole of a given rectangle. | |
| bool | intersectsRectangle (const Rectangle< int > &rectangleToCheck) const throw () |
| Checks whether the region contains any part of a given rectangle. | |
| bool | intersects (const RectangleList &other) const throw () |
| Checks whether this region intersects any part of another one. | |
| const Rectangle< int > | getBounds () const throw () |
| Returns the smallest rectangle that can enclose the whole of this region. | |
| void | consolidate () throw () |
| Optimises the list into a minimum number of constituent rectangles. | |
| void | offsetAll (int dx, int dy) throw () |
| Adds an x and y value to all the co-ordinates. | |
| const Path | toPath () const throw () |
| Creates a Path object to represent this region. | |
Maintains a set of rectangles as a complex region.
This class allows a set of rectangles to be treated as a solid shape, and can add and remove rectangular sections of it, and simplify overlapping or adjacent rectangles.
| RectangleList::RectangleList | ( | ) | throw () |
Creates an empty RectangleList.
| RectangleList::RectangleList | ( | const RectangleList & | other | ) | throw () |
Creates a copy of another list.
| RectangleList::RectangleList | ( | const Rectangle< int > & | rect | ) | throw () |
Creates a list containing just one rectangle.
| RectangleList::~RectangleList | ( | ) | throw () |
Destructor.
| RectangleList& RectangleList::operator= | ( | const RectangleList & | other | ) | throw () |
Copies this list from another one.
| bool RectangleList::isEmpty | ( | ) | const throw () |
Returns true if the region is empty.
| int RectangleList::getNumRectangles | ( | ) | const throw () |
Returns the number of rectangles in the list.
| const Rectangle<int> RectangleList::getRectangle | ( | const int | index | ) | const throw () |
Returns one of the rectangles at a particular index.
| void RectangleList::clear | ( | ) | throw () |
Removes all rectangles to leave an empty region.
| void RectangleList::add | ( | int | x, | |
| int | y, | |||
| int | width, | |||
| int | height | |||
| ) | throw () |
Merges a new rectangle into the list.
The rectangle being added will first be clipped to remove any parts of it that overlap existing rectangles in the list.
| void RectangleList::add | ( | const Rectangle< int > & | rect | ) | throw () |
Merges a new rectangle into the list.
The rectangle being added will first be clipped to remove any parts of it that overlap existing rectangles in the list, and adjacent rectangles will be merged into it.
| void RectangleList::addWithoutMerging | ( | const Rectangle< int > & | rect | ) | throw () |
Dumbly adds a rectangle to the list without checking for overlaps.
This simply adds the rectangle to the end, it doesn't merge it or remove any overlapping bits.
| void RectangleList::add | ( | const RectangleList & | other | ) | throw () |
Merges another rectangle list into this one.
Any overlaps between the two lists will be clipped, so that the result is the union of both lists.
| void RectangleList::subtract | ( | const Rectangle< int > & | rect | ) | throw () |
Removes a rectangular region from the list.
Any rectangles in the list which overlap this will be clipped and subdivided if necessary.
| void RectangleList::subtract | ( | const RectangleList & | otherList | ) | throw () |
Removes all areas in another RectangleList from this one.
Any rectangles in the list which overlap this will be clipped and subdivided if necessary.
| bool RectangleList::clipTo | ( | const Rectangle< int > & | rect | ) | throw () |
Removes any areas of the region that lie outside a given rectangle.
Any rectangles in the list which overlap this will be clipped and subdivided if necessary.
Returns true if the resulting region is not empty, false if it is empty.
| bool RectangleList::clipTo | ( | const RectangleList & | other | ) | throw () |
Removes any areas of the region that lie outside a given rectangle list.
Any rectangles in this object which overlap the specified list will be clipped and subdivided if necessary.
Returns true if the resulting region is not empty, false if it is empty.
| bool RectangleList::getIntersectionWith | ( | const Rectangle< int > & | rect, | |
| RectangleList & | destRegion | |||
| ) | const throw () |
Creates a region which is the result of clipping this one to a given rectangle.
Unlike the other clipTo method, this one doesn't affect this object - it puts the resulting region into the list whose reference is passed-in.
Returns true if the resulting region is not empty, false if it is empty.
| void RectangleList::swapWith | ( | RectangleList & | otherList | ) | throw () |
Swaps the contents of this and another list.
This swaps their internal pointers, so is hugely faster than using copy-by-value to swap them.
| bool RectangleList::containsPoint | ( | int | x, | |
| int | y | |||
| ) | const throw () |
Checks whether the region contains a given point.
| bool RectangleList::containsRectangle | ( | const Rectangle< int > & | rectangleToCheck | ) | const throw () |
Checks whether the region contains the whole of a given rectangle.
| bool RectangleList::intersectsRectangle | ( | const Rectangle< int > & | rectangleToCheck | ) | const throw () |
Checks whether the region contains any part of a given rectangle.
| bool RectangleList::intersects | ( | const RectangleList & | other | ) | const throw () |
Checks whether this region intersects any part of another one.
| const Rectangle<int> RectangleList::getBounds | ( | ) | const throw () |
Returns the smallest rectangle that can enclose the whole of this region.
| void RectangleList::consolidate | ( | ) | throw () |
Optimises the list into a minimum number of constituent rectangles.
This will try to combine any adjacent rectangles into larger ones where possible, to simplify lists that might have been fragmented by repeated add/subtract calls.
| void RectangleList::offsetAll | ( | int | dx, | |
| int | dy | |||
| ) | throw () |
Adds an x and y value to all the co-ordinates.
1.6.3