Inkscape
Vector Graphics Editor
|
Axis-aligned generic rectangle that can be empty. More...
#include <generic-rect.h>
Public Types | |
using | D1Value = CInterval |
using | D1Reference = CInterval & |
using | D1ConstReference = CInterval const & |
Public Member Functions | |
C | area () const |
Compute the rectangle's area. | |
bool | hasZeroArea () const |
Check whether the rectangle has zero area. | |
OptCRect | regularized () const |
Returns an empty optional (testing false) if the rectangle has zero area. | |
Check other rectangles and points for inclusion. | |
bool | empty () const |
Check for emptiness. | |
bool | intersects (CRect const &r) const |
Check whether the rectangles have any common points. | |
bool | contains (CRect const &r) const |
Check whether the rectangle includes all points in the given rectangle. | |
bool | intersects (OptCRect const &r) const |
Check whether the rectangles have any common points. | |
bool | contains (OptCRect const &r) const |
Check whether the rectangle includes all points in the given rectangle. | |
bool | contains (CPoint const &p) const |
Check whether the given point is within the rectangle. | |
Modify the potentially empty rectangle. | |
void | unionWith (CRect const &b) |
Enlarge the rectangle to contain the argument. | |
void | unionWith (OptCRect const &b) |
Enlarge the rectangle to contain the argument. | |
void | intersectWith (CRect const &b) |
Leave only the area overlapping with the argument. | |
void | intersectWith (OptCRect const &b) |
Leave only the area overlapping with the argument. | |
void | expandTo (CPoint const &p) |
Create or enlarge the rectangle to contain the given point. | |
Operators | |
GenericOptRect< C > & | operator|= (OptCRect const &b) |
Union with b. | |
GenericOptRect< C > & | operator&= (CRect const &b) |
Intersect with b. | |
GenericOptRect< C > & | operator&= (OptCRect const &b) |
Intersect with b. | |
bool | operator== (OptCRect const &other) const |
Test for equality. | |
bool | operator== (CRect const &other) const |
Private Types | |
using | CInterval = typename CoordTraits< C >::IntervalType |
using | OptCInterval = typename CoordTraits< C >::OptIntervalType |
using | CPoint = typename CoordTraits< C >::PointType |
using | CRect = typename CoordTraits< C >::RectType |
using | OptCRect = typename CoordTraits< C >::OptRectType |
using | Base = std::optional< CRect > |
Create potentially empty rectangles. | |
GenericOptRect ()=default | |
GenericOptRect (GenericRect< C > const &a) | |
GenericOptRect (CPoint const &a, CPoint const &b) | |
GenericOptRect (C x0, C y0, C x1, C y1) | |
GenericOptRect (OptCInterval const &x_int, OptCInterval const &y_int) | |
Creates an empty OptRect when one of the argument intervals is empty. | |
template<typename InputIterator > | |
static OptCRect | from_range (InputIterator start, InputIterator end) |
Create a rectangle from a range of points. | |
Axis-aligned generic rectangle that can be empty.
Definition at line 346 of file generic-rect.h.
|
private |
Definition at line 360 of file generic-rect.h.
|
private |
Definition at line 355 of file generic-rect.h.
|
private |
Definition at line 357 of file generic-rect.h.
|
private |
Definition at line 358 of file generic-rect.h.
using Geom::GenericOptRect< C >::D1ConstReference = CInterval const & |
Definition at line 364 of file generic-rect.h.
using Geom::GenericOptRect< C >::D1Reference = CInterval & |
Definition at line 363 of file generic-rect.h.
using Geom::GenericOptRect< C >::D1Value = CInterval |
Definition at line 362 of file generic-rect.h.
|
private |
Definition at line 356 of file generic-rect.h.
|
private |
Definition at line 359 of file generic-rect.h.
|
default |
|
inline |
Definition at line 369 of file generic-rect.h.
|
inline |
Definition at line 370 of file generic-rect.h.
|
inline |
Definition at line 371 of file generic-rect.h.
|
inline |
Creates an empty OptRect when one of the argument intervals is empty.
Definition at line 373 of file generic-rect.h.
|
inline |
Compute the rectangle's area.
Definition at line 424 of file generic-rect.h.
Referenced by Inkscape::DrawingItem::_cacheScore(), SPHatch::_calculateStripExtents(), Geom::RTree::find_enlargement(), get_visual_bbox(), and Inkscape::DrawingItem::update().
|
inline |
Check whether the given point is within the rectangle.
An empty rectangle will not contain any points.
Definition at line 420 of file generic-rect.h.
|
inline |
Check whether the rectangle includes all points in the given rectangle.
Empty rectangles will be contained in any non-empty rectangle.
Definition at line 407 of file generic-rect.h.
Referenced by Inkscape::UI::Tools::TextTool::_updateCursor(), pathv_fully_contains(), scroll_to_show_item(), sp_item_group_ungroup(), and Inkscape::UI::Tools::sp_tweak_dilate_recursive().
|
inline |
Check whether the rectangle includes all points in the given rectangle.
Empty rectangles will be contained in any non-empty rectangle. An empty rectangle will not contain other empty rectangles.
Definition at line 416 of file generic-rect.h.
|
inline |
Check for emptiness.
Definition at line 401 of file generic-rect.h.
Referenced by Inkscape::ObjectSet::_sizeistItem(), Inkscape::DistributionSnapper::constrainedSnap(), Geom::RTree::find_enlargement(), and Inkscape::DistributionSnapper::freeSnap().
|
inline |
Create or enlarge the rectangle to contain the given point.
If the rectangle is empty, after calling this method it will be non-empty and it will contain only the given point.
Definition at line 474 of file generic-rect.h.
Referenced by Inkscape::UI::ControlPointSelection::_updateBounds(), and Geom::aligned_bbox().
|
inlinestatic |
Create a rectangle from a range of points.
The resulting rectangle will contain all points from the range. If the range contains no points, the result will be an empty rectangle. The return type of iterators must be convertible to the corresponding point type (Point or IntPoint).
start | Beginning of the range |
end | End of the range |
Definition at line 389 of file generic-rect.h.
|
inline |
Check whether the rectangle has zero area.
Definition at line 426 of file generic-rect.h.
Referenced by Inkscape::DrawingPattern::_updateItem(), and Inkscape::DrawingPattern::renderPattern().
|
inline |
Check whether the rectangles have any common points.
Empty rectangles will not intersect with any other rectangle.
Definition at line 404 of file generic-rect.h.
Referenced by Inkscape::DistributionSnapper::_collectBBoxes(), Inkscape::DrawingItem::_invalidateFilterBackground(), Inkscape::ObjectSet::lower(), Geom::monotonic_smash_intersect(), Geom::pair_intersect(), Inkscape::ObjectSet::raise(), smash_intersect(), and Inkscape::UI::Tools::sp_tweak_color_recursive().
|
inline |
Check whether the rectangles have any common points.
Empty rectangles will not intersect with any other rectangle. Two empty rectangles will not intersect each other.
Definition at line 412 of file generic-rect.h.
|
inline |
Leave only the area overlapping with the argument.
If the rectangles do not have any points in common, after calling this method the rectangle will be empty.
Definition at line 452 of file generic-rect.h.
References Geom::X, and Geom::Y.
Referenced by Geom::operator&(), Geom::operator&(), Inkscape::DrawingItem::render(), Inkscape::DrawingItem::update(), and SPItem::visualBounds().
|
inline |
Leave only the area overlapping with the argument.
If the argument is empty or the rectangles do not have any points in common, after calling this method the rectangle will be empty.
Definition at line 464 of file generic-rect.h.
|
inline |
Intersect with b.
Definition at line 491 of file generic-rect.h.
|
inline |
Intersect with b.
Definition at line 496 of file generic-rect.h.
|
inline |
Definition at line 506 of file generic-rect.h.
|
inline |
|
inline |
Union with b.
Definition at line 486 of file generic-rect.h.
|
inline |
Returns an empty optional (testing false) if the rectangle has zero area.
Definition at line 428 of file generic-rect.h.
|
inline |
Enlarge the rectangle to contain the argument.
If this rectangle is empty, after callng this method it will be equal to the argument.
Definition at line 435 of file generic-rect.h.
Referenced by Inkscape::DrawingGroup::_updateItem(), Inkscape::DrawingShape::_updateItem(), Inkscape::Text::Layout::bounds(), Geom::PathVector::boundsExact(), Geom::PathVector::boundsFast(), Inkscape::LivePathEffect::GroupBBoxEffect::clip_mask_bbox(), enclose_items(), Inkscape::ObjectSet::geometricBounds(), SPClipPath::geometricBounds(), SPMask::geometricBounds(), SPGradient::getAllItemsBox(), Inkscape::PageManager::getDesktopRect(), getMarkerBounds(), Inkscape::LivePathEffect::GroupBBoxEffect::original_bbox(), Inkscape::LivePathEffect::Parameter::param_higlight(), sp_validate_marker(), Inkscape::ObjectSet::strokedBounds(), Inkscape::Extension::Internal::PdfBuilder::Document::style_to_transparency_mask(), Inkscape::DrawingItem::update(), Inkscape::ObjectSet::visualBounds(), and SPMask::visualBounds().
|
inline |
Enlarge the rectangle to contain the argument.
Unioning with an empty rectangle results in no changes. If this rectangle is empty, after calling this method it will be equal to the argument.
Definition at line 446 of file generic-rect.h.