126 return d->setPath(
path);
158 for (
const auto &
c:
path) {
173 for (
const auto &
c:
d->path())
209 d->translate(degreesLatitude, degreesLongitude);
224 result.translate(degreesLatitude, degreesLongitude);
239 return d->length(indexFrom, indexTo);
251 if (
result > std::numeric_limits<int>::max())
262 d->addCoordinate(coordinate);
263 if (
d->size() > std::numeric_limits<int>::max())
273 d->insertCoordinate(
index, coordinate);
282 d->replaceCoordinate(
index, coordinate);
291 return d->coordinateAt(
index);
300 return d->containsCoordinate(coordinate);
309 d->removeCoordinate(coordinate);
318 d->removeCoordinate(
index);
332 for (
const auto &
p :
path())
384 if (!QGeoShapePrivate::operator==(
other))
415 double lineRadius =
qMax(
width() * 0.5, 0.2);
420 return (
m_path[0].distanceTo(coordinate) <= lineRadius);
440 double u = ((
p.x() -
a.x()) * (
b.x() -
a.x()) + (
p.y() -
a.y()) * (
b.y() -
a.y()) ) / (
b -
a).lengthSquared();
447 candidate = intersection;
450 if (candidate.
x() > 1.0)
455 double distanceMeters = coordinate.
distanceTo(closest);
456 if (distanceMeters <= lineRadius)
465 return (
m_path[0].distanceTo(coordinate) <= lineRadius);
490 bool wrap = indexTo == -1;
491 if (indexTo < 0 || indexTo >=
path().
size())
525 double m_minX, m_maxX, m_minLati, m_maxLati;
529 if (degreesLatitude > 0.0)
530 degreesLatitude =
qMin(degreesLatitude, 90.0 - m_maxLati);
532 degreesLatitude =
qMax(degreesLatitude, -90.0 - m_minLati);
534 p.setLatitude(
p.latitude() + degreesLatitude);
615 double m_minX, m_maxX, m_minLati, m_maxLati;
650 if (degreesLatitude > 0.0)
655 p.setLatitude(
p.latitude() + degreesLatitude);
673void QGeoPathPrivateEager::QGeoPathPrivateEager::computeBoundingBox()
675 computeBBox(m_path, m_deltaXs, m_minX, m_maxX, m_minLati, m_maxLati, m_bbox);
679void QGeoPathPrivateEager::QGeoPathPrivateEager::updateBoundingBox()
681 updateBBox(m_path, m_deltaXs, m_minX, m_maxX, m_minLati, m_maxLati, m_bbox);
714#include "moc_qgeopath_p.cpp"
715#include "moc_qgeopath.cpp"
Q_DECL_CONSTEXPR double x() const
Q_INVOKABLE qreal distanceTo(const QGeoCoordinate &other) const
Returns the distance (in meters) from this coordinate to the coordinate specified by other.
bool isValid
This property holds the validity of this geo coordinate.
virtual void computeBoundingBox() override
virtual void translate(double degreesLatitude, double degreesLongitude) override
virtual QGeoShapePrivate * clone() const override
virtual void markDirty() override
virtual void addCoordinate(const QGeoCoordinate &coordinate) override
virtual qreal width() const
virtual qsizetype size() const
virtual QGeoCoordinate coordinateAt(qsizetype index) const
virtual bool containsCoordinate(const QGeoCoordinate &coordinate) const
virtual void insertCoordinate(qsizetype index, const QGeoCoordinate &coordinate)
virtual bool contains(const QGeoCoordinate &coordinate) const override
QList< QGeoCoordinate > m_path
virtual void translate(double degreesLatitude, double degreesLongitude)
virtual void replaceCoordinate(qsizetype index, const QGeoCoordinate &coordinate)
virtual void addCoordinate(const QGeoCoordinate &coordinate)
virtual QGeoCoordinate center() const override
virtual double length(qsizetype indexFrom, qsizetype indexTo) const
virtual QGeoShapePrivate * clone() const override
virtual void setPath(const QList< QGeoCoordinate > &path)
virtual void setWidth(const qreal &width)
virtual void removeCoordinate(const QGeoCoordinate &coordinate)
size_t hash(size_t seed) const override
virtual bool isValid() const override
virtual void computeBoundingBox()
virtual const QList< QGeoCoordinate > & path() const
virtual bool lineContains(const QGeoCoordinate &coordinate) const
virtual bool operator==(const QGeoShapePrivate &other) const override
double m_leftBoundWrapped
virtual QGeoRectangle boundingGeoRectangle() const override
virtual bool isEmpty() const override
Q_INVOKABLE QGeoCoordinate coordinateAt(qsizetype index) const
Returns the coordinate at index .
Q_INVOKABLE void insertCoordinate(qsizetype index, const QGeoCoordinate &coordinate)
Inserts coordinate at the specified index.
Q_INVOKABLE qsizetype size() const
Returns the number of elements in the path.
void setPath(const QList< QGeoCoordinate > &path)
Sets all the elements of the path.
Q_INVOKABLE void translate(double degreesLatitude, double degreesLongitude)
Translates this geo path by degreesLatitude northwards and degreesLongitude eastwards.
Q_INVOKABLE double length(qsizetype indexFrom=0, qsizetype indexTo=-1) const
Returns the length of the path, in meters, from the element indexFrom to the element indexTo.
QVariantList variantPath() const
Returns all the elements of the path.
void setVariantPath(const QVariantList &path)
Sets all the elements of the path.
Q_INVOKABLE void removeCoordinate(const QGeoCoordinate &coordinate)
Removes the last occurrence of coordinate from the path.
QGeoPath()
Constructs a new, empty geo path.
qreal width
the width of the path in meters.
QGeoPath & operator=(const QGeoPath &other)
Assigns other to this geo path and returns a reference to this geo path.
Q_INVOKABLE bool containsCoordinate(const QGeoCoordinate &coordinate) const
Returns true if the path contains coordinate as one of the elements.
Q_INVOKABLE void addCoordinate(const QGeoCoordinate &coordinate)
Appends coordinate to the path.
void clearPath()
Clears the path.
QVariantList path
This property holds the list of coordinates for the geo path.
Q_INVOKABLE void replaceCoordinate(qsizetype index, const QGeoCoordinate &coordinate)
Replaces the path element at the specified index with coordinate.
~QGeoPath()
Destroys this path.
void setWidth(const qreal &width)
Q_INVOKABLE QGeoPath translated(double degreesLatitude, double degreesLongitude) const
Returns a copy of this geo path translated by degreesLatitude northwards and degreesLongitude eastwar...
Q_INVOKABLE QString toString() const
Returns the geo path properties as a string.
QGeoCoordinate topLeft
This property holds the top left coordinate of this geo rectangle.
QGeoCoordinate center
This property holds the center of this geo rectangle.
Q_INVOKABLE void translate(double degreesLatitude, double degreesLongitude)
Translates this geo rectangle by degreesLatitude northwards and degreesLongitude eastwards.
QGeoShape & operator=(const QGeoShape &other)
Assigns other to this geo shape and returns a reference to this geo shape.
QSharedDataPointer< QGeoShapePrivate > d_ptr
ShapeType type
This property holds the type of this geo shape.
qsizetype size() const noexcept
bool isEmpty() const noexcept
void removeAt(qsizetype i)
iterator insert(qsizetype i, parameter_type t)
const_reference at(qsizetype i) const noexcept
const_iterator cend() const noexcept
void append(parameter_type t)
const_iterator cbegin() const noexcept
static double wrapLong(double lng)
const T * constData() const noexcept
Returns a const pointer to the shared data object.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
static QDoubleVector2D coordToMercator(const QGeoCoordinate &coord)
static QGeoCoordinate mercatorToCoord(const QDoubleVector2D &mercator)
while(i.hasNext()) QString s
Combined button and popup list for selecting options.
bool qIsNaN(qfloat16 f) noexcept
QT_BEGIN_NAMESPACE constexpr auto kWarningString
static void updateBBox(const QList< QGeoCoordinate > &m_path, QList< double > &m_deltaXs, double &m_minX, double &m_maxX, double &m_minLati, double &m_maxLati, QGeoRectangle &m_bbox)
static QT_BEGIN_NAMESPACE void computeBBox(const QList< QGeoCoordinate > &m_path, QList< double > &m_deltaXs, double &m_minX, double &m_maxX, double &m_minLati, double &m_maxLati, QGeoRectangle &m_bbox)
size_t qHashRange(InputIterator first, InputIterator last, size_t seed=0) noexcept(noexcept(qHash(*first)))
constexpr QtPrivate::QHashMultiReturnType< T... > qHashMulti(size_t seed, const T &... args) noexcept(std::conjunction_v< QtPrivate::QNothrowHashable< T >... >)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLenum GLsizei length
GLenum GLsizei const void * pathString
GLsizei const GLchar *const * path
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
static QT_BEGIN_NAMESPACE QAsn1Element wrap(quint8 type, const QAsn1Element &child)
#define QStringLiteral(str)
static const QTextHtmlElement elements[Html_NumElements]
\inmodule QtCore \reentrant
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
qsizetype lastIndexOf(const AT &t, qsizetype from=-1) const noexcept