8#include "Kanoop/kanoopcommon.h"
15class KANOOP_EXPORT
Point :
public QPointF
22 Point(
const QPointF& other) : QPointF(other) {}
25 Point(
const QPoint& other) : QPointF(other) {}
31 Point(
double x,
double y) : QPointF(x, y) {}
36 bool isLeftOf(
const QPointF& other)
const {
return x() < other.x(); }
40 bool isRightOf(
const QPointF& other)
const {
return x() > other.x(); }
44 bool isAbove(
const QPointF& other)
const {
return y() < other.y(); }
48 bool isBelow(
const QPointF& other)
const {
return y() > other.y(); }
97 QString
toString()
const {
return QString(
"%1, %2").arg(x()).arg(y()); }
109 class KANOOP_EXPORT
List :
public QList<Point>
117 List(
const QList<Point>& other)
119 for(
const Point& p : other) {
141 QList<QPoint> result;
142 for(
const Point& point : *
this) {
143 result.append(point.toPoint());
A list of Point objects with corner-finding helpers.
QList< QPoint > toPointList() const
Convert to a list of integer QPoint objects.
Point bottomRight() const
Return the bottom-right point (maximum X and Y).
Point topLeft() const
Return the top-left point (minimum X and Y).
Point topRight() const
Return the top-right point (maximum X, minimum Y).
Point bottomLeft() const
Return the bottom-left point (minimum X, maximum Y).
List()
Default constructor.
List(const QList< Point > &other)
Construct from a QList<Point>.
A 2D floating-point point extending QPointF with movement and spatial query methods.
bool isBelow(const QPointF &other) const
Test whether this point is below other (larger Y).
static Point fromString(const QString &value)
Parse a Point from a string produced by toString().
Point & move(Geo::Direction direction, double amount)
Move this point in a cardinal direction by the given amount.
bool isLeftOf(const QPointF &other) const
Test whether this point is to the left of other (smaller X).
Point(const QPointF &other)
Construct from a QPointF.
QString toString() const
Format this point as "x, y".
bool isAbove(const QPointF &other) const
Test whether this point is above other (smaller Y).
Point(double x, double y)
Construct from explicit X and Y coordinates.
Point(const QPoint &other)
Construct from a QPoint (integer coordinates).
Point & round()
Round both coordinates to the nearest integer in place.
Point & moveDelta(double dx, double dy)
Translate this point by a (dx, dy) delta.
Point & offset(double x, double y)
Offset this point by the given (x, y) amounts.
Point delta(const Point &other) const
Compute the (dx, dy) vector from this point to another.
Point()
Default constructor — creates a point at the origin.
bool isRightOf(const QPointF &other) const
Test whether this point is to the right of other (larger X).
Point & move(double bearing, double distance)
Move this point by a bearing and distance.
Direction
Cardinal directions, aliased to the corresponding Side values.