10#include "Kanoop/kanoopcommon.h"
31 Rectangle(
const QPointF& topLeft,
const QSizeF& size) : QRectF(topLeft, size) {}
39 Rectangle(
double x,
double y,
int w,
int h) : QRectF(x, y, w, h) {}
211 class List :
public QList<Rectangle> {};
A list of Line objects with spatial query helpers.
Represents a 2D line segment between two Point endpoints.
A list of Point objects with corner-finding helpers.
A 2D floating-point point extending QPointF with movement and spatial query methods.
A simple list type for Rectangle objects.
A 2D rectangle extending QRectF with edge, corner, and geometric query helpers.
Line rightEdge() const
Return the right edge as a Line.
Rectangle(const QRect &other)
Construct from a QRect (integer coordinates).
QMap< Geo::Side, Line > edgeMap() const
Return a map from Side to edge Line for all four edges.
Geo::Side closestSideToPoint(const Point &point) const
Return which side of the rectangle is closest to a point.
Rectangle scaled(double scale) const
Return a scaled copy of this rectangle.
bool isPointOnEdge(const Point &point) const
Test whether a point lies on any edge.
static Rectangle fromCenterPoint(const Point ¢erPoint, double expand)
Create a rectangle centred on a point with a given half-size.
static Rectangle fromString(const QString &value)
Parse a Rectangle from a string produced by toString().
bool isPointOnEdge(const Point &point, Line &foundEdge) const
Test whether a point lies on any edge, outputting the edge.
QString toString() const
Format this rectangle as a human-readable string.
Rectangle(const QRectF &other)
Construct from a QRectF.
Point closestCorner(const Point &origin) const
Return the corner of this rectangle closest to an origin point.
Rectangle(const QPointF &topLeft, const QSizeF &size)
Construct from a top-left point and size.
Rectangle shrunk(double amount) const
Return a shrunk copy of this rectangle.
Rectangle()
Default constructor — creates a null rectangle.
static Rectangle fromPoints(const Point::List &points)
Build the bounding rectangle of a list of points.
Rectangle(double x, double y, int w, int h)
Construct from explicit position and dimensions.
Rectangle & shrink(double amount)
Shrink the rectangle by contracting all edges inward.
Point::List corners() const
Return all four corners of the rectangle.
Rectangle & scale(double scale)
Scale the rectangle dimensions by a factor, keeping the top-left corner fixed.
static Rectangle fromCenterLine(const Line ¢erLine, double expand)
Create a rectangle centred on a line with a given width.
Point centerPoint() const
Return the geometric centre point of the rectangle.
bool containsAnyPoint(const Line &line) const
Test whether a line's endpoints include any point within this rectangle.
Line::List horizontalLines() const
Return the two horizontal edges.
Line bottomEdge() const
Return the bottom edge as a Line.
Rectangle grown(double amount) const
Return a grown copy of this rectangle.
Line leftEdge() const
Return the left edge as a Line.
static Rectangle fromPoints(const Point &p1, const Point &p2)
Build the bounding rectangle of two points.
Rectangle & grow(double amount)
Grow the rectangle by expanding all edges outward.
Line::List verticalLines() const
Return the two vertical edges.
Line closestEdge(const Point &point)
Return the edge closest to a given point.
Line topEdge() const
Return the top edge as a Line.
Line::List edges() const
Return all four edges of the rectangle as lines.
Side
Bitmask identifying which side(s) of a rectangle are relevant.