# HG changeset patch # User alpar # Date 1138613475 0 # Node ID 12f289d6187f79bd84c6e89c9adc2a1e110ca106 # Parent 6a30ef4d10f194c01ee8bea7e9db947cee092cdc Functions added to set the edges/corners of the bounding box directly. diff -r 6a30ef4d10f1 -r 12f289d6187f lemon/xy.h --- a/lemon/xy.h Sun Jan 29 23:46:05 2006 +0000 +++ b/lemon/xy.h Mon Jan 30 09:31:15 2006 +0000 @@ -245,52 +245,112 @@ _empty=1; } - ///Gives back the bottom left corner (if the bounding box is empty, then the return value is not defined) + ///\brief Gives back the bottom left corner + ///(if the bounding box is empty, then the return value is not defined) xy bottomLeft() const { return bottom_left; } - ///Gives back the top right corner (if the bounding box is empty, then the return value is not defined) + ///\brief Sets the bottom left corner + ///(should only bee used for non-empty box) + void bottomLeft(xy p) { + bottom_left = p; + } + + ///\brief Gives back the top right corner + ///(if the bounding box is empty, then the return value is not defined) xy topRight() const { return top_right; } - ///Gives back the bottom right corner (if the bounding box is empty, then the return value is not defined) + ///\brief Sets the top right corner + ///(should only bee used for non-empty box) + void topRight(xy p) { + top_right = p; + } + + ///\brief Gives back the bottom right corner + ///(if the bounding box is empty, then the return value is not defined) xy bottomRight() const { return xy(top_right.x,bottom_left.y); } - ///Gives back the top left corner (if the bounding box is empty, then the return value is not defined) + ///\brief Sets the bottom right corner + ///(should only bee used for non-empty box) + void bottomRight(xy p) { + top_right.x = p.x; + bottom_left.y = p.y; + } + + ///\brief Gives back the top left corner + ///(if the bounding box is empty, then the return value is not defined) xy topLeft() const { return xy(bottom_left.x,top_right.y); } - ///Gives back the bottom of the box (if the bounding box is empty, then the return value is not defined) + ///\brief Sets the top left corner + ///(should only bee used for non-empty box) + void topLeft(xy p) { + top_right.y = p.y; + bottom_left.x = p.x; + } + + ///\brief Gives back the bottom of the box + ///(if the bounding box is empty, then the return value is not defined) T bottom() const { return bottom_left.y; } - ///Gives back the top of the box (if the bounding box is empty, then the return value is not defined) + ///\brief Sets the bottom of the box + ///(should only bee used for non-empty box) + void bottom(T t) { + bottom_left.y = t; + } + + ///\brief Gives back the top of the box + ///(if the bounding box is empty, then the return value is not defined) T top() const { return top_right.y; } - ///Gives back the left side of the box (if the bounding box is empty, then the return value is not defined) + ///\brief Sets the top of the box + ///(should only bee used for non-empty box) + void top(T t) { + top_right.y = t; + } + + ///\brief Gives back the left side of the box + ///(if the bounding box is empty, then the return value is not defined) T left() const { return bottom_left.x; } - ///Gives back the right side of the box (if the bounding box is empty, then the return value is not defined) + ///\brief Sets the left side of the box + ///(should only bee used for non-empty box) + void left(T t) { + bottom_left.x = t; + } + + ///\brief Gives back the right side of the box + ///(if the bounding box is empty, then the return value is not defined) T right() const { return top_right.x; } - ///Gives back the height of the box (if the bounding box is empty, then the return value is not defined) + ///\brief Sets the right side of the box + ///(should only bee used for non-empty box) + void right(T t) { + top_right.x = t; + } + + ///\brief Gives back the height of the box + ///(if the bounding box is empty, then the return value is not defined) T height() const { return top_right.y-bottom_left.y; } - ///Gives back the width of the box (if the bounding box is empty, then the return value is not defined) + ///\brief Gives back the width of the box + ///(if the bounding box is empty, then the return value is not defined) T width() const { return top_right.x-bottom_left.x; }