Okular
area.cpp
66 * @brief Calculates distance of the point @p x @p y @p xScale @p yScale to the line segment from @p start to @p end
68 double NormalizedPoint::distanceSqr(double x, double y, double xScale, double yScale, const NormalizedPoint &start, const NormalizedPoint &end)
217 return (isNull() && r.isNull()) || (fabs(left - r.left) < 1e-4 && fabs(right - r.right) < 1e-4 && fabs(top - r.top) < 1e-4 && fabs(bottom - r.bottom) < 1e-4);
228 str << "[" <<r.left() << "," << r.top() << "] x "<< "[" <<r.right() << "," << r.bottom() << "]";
234 int l = (int)(left * xScale), t = (int)(top * yScale), r = (int)(right * xScale), b = (int)(bottom * yScale);
241 int l = (int)(left * xScale + 0.5), t = (int)(top * yScale + 0.5), r = (int)(right * xScale + 0.5), b = (int)(bottom * yScale + 0.5);
271 str.nospace() << "NormRect(" << r.left << "," << r.top << " x " << (r.right - r.left) << "+" << (r.bottom - r.top) << ")";
314 ObjectRect::ObjectRect(double l, double t, double r, double b, bool ellipse, ObjectType type, void *object)
371 return QRect((int)(br.left() * xScale), (int)(br.top() * yScale), (int)(br.width() * xScale), (int)(br.height() * yScale));
390 return NormalizedRect(rect.x(), rect.y(), rect.right(), rect.bottom()).distanceSqr(x, y, xScale, yScale);
421 qCDebug(OkularCoreDebug).nospace() << "Object deletion not implemented for type '" << m_objectType << "'.";
497 NonOwningObjectRect::NonOwningObjectRect(double left, double top, double right, double bottom, bool ellipse, ObjectType type, void *object)
void append(const T &value)
double distanceSqr(double x, double y, double xScale, double yScale) const
Returns squared distance to normalized point (x, y) on a reference area of size xScale x yScale.
Definition: area.cpp:51
This class describes the object rectangle for a source reference.
Definition: area.h:598
QPoint map(const QPoint &point) const const
qreal left() const const
ObjectType objectType() const
Returns the object type of the object rectangle.
Definition: area.cpp:352
An area with normalized coordinates, consisting of NormalizedShape objects.
Definition: area.h:670
void addPolygon(const QPolygonF &polygon)
NormalizedRect operator&(const NormalizedRect &other) const
Returns the intersection of this normalized rectangle with the specified other.
Definition: area.cpp:199
virtual QRect boundingRect(double xScale, double yScale) const
Returns the bounding rect of the object rectangle for the scaling factor xScale and yScale.
Definition: area.cpp:367
Annotation struct holds properties shared by all annotations.
Definition: annotations.h:95
virtual void transform(const QTransform &matrix)
Transforms the object rectangle with the operations defined by matrix.
Definition: area.cpp:379
qreal x() const const
qreal y() const const
HighlightAreaRect(const RegularAreaRect *area=nullptr)
Creates a new highlight area rect with the coordinates of the given area.
Definition: area.cpp:299
QDebug & nospace()
NormalizedPoint is a helper class which stores the coordinates of a normalized point.
Definition: area.h:116
QRect boundingRect(double xScale, double yScale) const override
Returns the bounding rect of the source reference object rectangle for the scaling factor xScale and ...
Definition: area.cpp:482
QDebug & space()
QDataStream & operator<<(QDataStream &out, const KDateTime &dateTime)
virtual bool contains(double x, double y, double xScale, double yScale) const
Returns whether the object rectangle contains the point with absolute coordinates (x,...
Definition: area.cpp:374
bool contains(const QRect &rectangle, bool proper) const const
ObjectRect(double left, double top, double right, double bottom, bool ellipse, ObjectType type, void *object)
Creates a new object rectangle.
Definition: area.cpp:314
bool isNull() const
Returns whether this normalized rectangle is a null normalized rect.
Definition: area.cpp:155
void addEllipse(const QRectF &boundingRectangle)
NormalizedRect operator|(const NormalizedRect &other) const
Returns the normalized bounding rectangle of the normalized rectangle combined with the other normali...
Definition: area.cpp:180
Annotation * annotation() const
Returns the annotation object of the annotation object rectangle.
Definition: area.cpp:433
QRect geometry(int xScale, int yScale) const
Returns the rectangle mapped to a reference area of xScale x yScale.
Definition: area.cpp:232
SourceRefObjectRect(const NormalizedPoint &point, void *srcRef)
Creates a new source reference object rectangle.
Definition: area.cpp:470
bool contains(const QPointF &point) const const
Q_SCRIPTABLE Q_NOREPLY void start()
This is a list of NormalizedRect, to describe an area consisting of multiple rectangles using normali...
Definition: area.h:932
QRectF boundingRect() const const
QRect boundingRect(double xScale, double yScale) const override
Returns the bounding rect of the annotation object rectangle for the scaling factor xScale and yScale...
Definition: area.cpp:438
const void * object() const
Returns the storable object of the object rectangle.
Definition: area.cpp:357
static NormalizedRect fromQRectF(const QRectF &rect)
Build a normalized rect from a QRectF, which already has normalized coordinates.
Definition: area.cpp:144
const QPainterPath & region() const
Returns the region that is covered by the object rectangle.
Definition: area.cpp:362
qreal bottom() const const
KCALENDARCORE_EXPORT uint qHash(const KCalendarCore::Period &key)
NormalizedPoint & operator=(const NormalizedPoint &)
QPoint center() const const
void addRect(const QRectF &rectangle)
QList< T > & operator=(const QList< T > &other)
A NormalizedRect is a rectangle which can be defined by two NormalizedPoints.
Definition: area.h:188
static QRect annotationGeometry(const Annotation *annotation, double scaleX, double scaleY)
Returns the geometry of the given annotation scaled by scaleX and scaleY.
Definition: annotations.cpp:155
qreal top() const const
qreal right() const const
NonOwningObjectRect(double left, double top, double right, double bottom, bool ellipse, ObjectType type, void *object)
class NonOwningObjectRect
Definition: area.cpp:497
typedef ConstIterator
double distanceSqr(double x, double y, double xScale, double yScale) const
Returns the squared distance of the normalized point (x, y) to the closest edge, or 0 if the point is...
Definition: area.h:387
void transform(const QTransform &matrix)
Transforms the normalized point with the operations defined by matrix.
Definition: area.cpp:42
QRectF geometryF(float xScale, float yScale) const
Same functionality as geometry, but nothing is converted into int.
Definition: area.cpp:246
void transform(const QTransform &matrix)
Transforms the normalized rectangle with the operations defined by matrix.
Definition: area.cpp:253
qreal width() const const
NormalizedRect & operator|=(const NormalizedRect &other)
Sets the normalized rectangle to the normalized bounding rectangle of itself combined with the other ...
Definition: area.cpp:190
QList::iterator begin()
double distanceSqr(double x, double y, double xScale, double yScale) const
Returns the squared distance between the object and the point with normalized coordinates (x,...
Definition: area.cpp:384
bool intersects(const NormalizedRect &other) const
Returns whether the normalized rectangle intersects the other normalized rectangle.
Definition: area.cpp:165
bool contains(double x, double y) const
Returns whether the normalized rectangle contains the normalized point (x, y).
Definition: area.cpp:160
bool contains(double x, double y, double xScale, double yScale) const override
Returns whether the source reference object rectangle contains the point x, y for the scaling factor ...
Definition: area.cpp:490
QRectF normalized() const const
QRect mapRect(const QRect &rectangle) const const
AnnotationObjectRect(Annotation *annotation)
Creates a new annotation object rectangle with the given annotation.
Definition: area.cpp:427
QList::iterator end()
NormalizedRect & operator=(const NormalizedRect &other)
QRect roundedGeometry(int xScale, int yScale) const
Same functionality as geometry, but the output is now rounded before typecasting to int.
Definition: area.cpp:239
void transform(const QTransform &matrix) override
Transforms the annotation object rectangle with the operations defined by matrix.
Definition: area.cpp:463
An area with normalized coordinates that contains a reference to an object.
Definition: area.h:457
bool contains(double x, double y, double xScale, double yScale) const override
Returns whether the annotation object rectangle contains the point x, y for the scaling factor xScale...
Definition: area.cpp:451
bool operator==(const NormalizedRect &other) const
Returns whether the normalized rectangle is equal to the other normalized rectangle.
Definition: area.cpp:215
qreal height() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Sep 22 2023 04:09:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Sep 22 2023 04:09:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.