diff options
Diffstat (limited to 'include/basegfx/range/b2ibox.hxx')
-rw-r--r-- | include/basegfx/range/b2ibox.hxx | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/include/basegfx/range/b2ibox.hxx b/include/basegfx/range/b2ibox.hxx index b5c4d33bfb63..09ae867c85b0 100644 --- a/include/basegfx/range/b2ibox.hxx +++ b/include/basegfx/range/b2ibox.hxx @@ -104,6 +104,13 @@ namespace basegfx return maRangeX.isEmpty() || maRangeY.isEmpty(); } + /// reset the object to empty state again, clearing all values + void reset() + { + maRangeX.reset(); + maRangeY.reset(); + } + bool operator==( const B2IBox& rBox ) const { return (maRangeX == rBox.maRangeX @@ -170,6 +177,24 @@ namespace basegfx ); } + /// return difference between upper and lower value. returns (0,0) for empty sets. + B2I64Tuple getRange() const + { + return B2I64Tuple( + maRangeX.getRange(), + maRangeY.getRange() + ); + } + + /// return center point of set. returns (0,0) for empty sets. + B2DPoint getCenter() const + { + return B2DPoint( + maRangeX.getCenter(), + maRangeY.getCenter() + ); + } + /// yields true if point is contained in set bool isInside(const B2ITuple& rTuple) const { @@ -179,6 +204,24 @@ namespace basegfx ); } + /// yields true if rBox is inside, or equal to set + bool isInside(const B2IBox& rBox) const + { + return ( + maRangeX.isInside(rBox.maRangeX) + && maRangeY.isInside(rBox.maRangeY) + ); + } + + /// yields true if rBox at least partly inside set + bool overlaps(const B2IBox& rBox) const + { + return ( + maRangeX.overlaps(rBox.maRangeX) + && maRangeY.overlaps(rBox.maRangeY) + ); + } + /// add point to the set, expanding as necessary void expand(const B2ITuple& rTuple) { @@ -186,6 +229,13 @@ namespace basegfx maRangeY.expand(rTuple.getY()); } + /// add rBox to the set, expanding as necessary + void expand(const B2IBox& rBox) + { + maRangeX.expand(rBox.maRangeX); + maRangeY.expand(rBox.maRangeY); + } + /// calc set intersection void intersect(const B2IBox& rBox) { @@ -193,6 +243,13 @@ namespace basegfx maRangeY.intersect(rBox.maRangeY); } + /// grow set by nValue on all sides + void grow(sal_Int32 nValue) + { + maRangeX.grow(nValue); + maRangeY.grow(nValue); + } + private: BasicBox maRangeX; BasicBox maRangeY; |