10#include <QPainterPathStroker>
11#include <QtPositioning/QGeoCoordinate>
13#include <QtPositioning/private/qclipperutils_p.h>
26 const double t_x = p2_x - p1_x;
27 const double t_y = p2_y - p1_y;
28 const double p_x = p0_x - p1_x;
29 const double p_y = p0_y - p1_y;
30 const double tsqr = t_x * t_x + t_y * t_y;
35 double alpha = (p_x * t_x + p_y * t_y) / tsqr;
38 const double dx = p_x - t_x *
alpha;
39 const double dy = p_y - t_y *
alpha;
41 return dx * dx + dy * dy;
54 path <<
p.geoToMapProjection(
c);
57 wrappedPathPlus1.
clear();
58 wrappedPathMinus1.
clear();
66 const bool isPointLessThanUnwrapBelowX = (
coord.x() < leftBound.
x());
68 if (isPointLessThanUnwrapBelowX)
75 wrappedPathPlus1.
append(coordP1);
76 wrappedPathMinus1.
append(coordM1);
79 *leftBoundWrapped = leftBound;
90 path <<
p.geoToMapProjection(
c);
94 *leftBoundWrapped = leftBound;
109 const bool isPointLessThanUnwrapBelowX = (
coord.x() < geoLeftBound.
x());
111 if (isPointLessThanUnwrapBelowX)
125 clippedPaths.clear();
127 if (visibleRegion.
size()) {
134 if (leftBoundWrapped) {
139 if (
p.x() < lb.
x() || (
p.x() == lb.
x() &&
p.y() < lb.
y()))
152 *leftBoundWrapped = lb;
156 clippedPaths.append(wrappedPath);
164 projectedBbox.
clear();
166 for (
const auto &
coord : clippedBbox) {
181 double xMin =
qInf();
182 double xMax = -
qInf();
183 double yMin =
qInf();
184 double yMax = -
qInf();
191 return QRectF(xMin, yMin, xMax - xMin, yMax - yMin);
202 path.append(cornerPoints.
at(
i));
203 const double p_lat = cornerPoints.
at(
i).latitude() / 180.0 *
M_PI;
204 const double p_lon = cornerPoints.
at(
i).longitude() / 180.0 *
M_PI;
205 const double q_lat = cornerPoints.
at((
i + 1) % cornerPoints.
size()).latitude() / 180.0 *
M_PI;
206 const double q_lon = cornerPoints.
at((
i + 1) % cornerPoints.
size()).longitude() / 180.0 *
M_PI;
208 const double c_p_lat = cos(p_lat);
209 const double c_p_lon = cos(p_lon);
210 const double s_p_lat = sin(p_lat);
211 const double s_p_lon = sin(p_lon);
212 const double c_q_lat = cos(q_lat);
213 const double c_q_lon = cos(q_lon);
214 const double s_q_lat = sin(q_lat);
215 const double s_q_lon = sin(q_lon);
225 if (qp <= -1.0 || qp >= 1.0)
236 const double paramMax = sqrt(1 / (1 - qp * qp));
240 for (; t <= paramMax && t >= 0.0;
t +=
sign * paramMax / N / 2) {
243 const double s = -
t * qp +
sign * sqrt(
t *
t * (qp * qp - 1.0) + 1.0);
246 const double lat = asin(
s * s_p_lat +
t * s_q_lat);
247 const double lon = atan2(
s * c_p_lat * s_p_lon +
t * c_q_lat * s_q_lon,
248 s * c_p_lat * c_p_lon +
t * c_q_lat * c_q_lon);
251 t -= paramMax / N / 2;
void addClipPolygon(const QList< QDoubleVector2D > &path)
void addSubjectPath(const QList< QDoubleVector2D > &path, bool closed)
QList< QList< QDoubleVector2D > > execute(Operation op, PolyFillType subjFillType=pftNonZero, PolyFillType clipFillType=pftNonZero)
Q_DECL_CONSTEXPR QPointF toPointF() const
Q_DECL_CONSTEXPR double x() const
Q_DECL_CONSTEXPR double y() const
static Q_DECL_CONSTEXPR double dotProduct(const QDoubleVector3D &v1, const QDoubleVector3D &v2)
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
void append(parameter_type t)
void moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
void clear()
Clears the path elements stored.
void closeSubpath()
Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting ...
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
\inmodule QtCore\reentrant
void wrapPath(const QList< QGeoCoordinate > &perimeter, const QGeoCoordinate &geoLeftBound, const QGeoProjectionWebMercator &p, QList< QDoubleVector2D > &wrappedPath, QList< QDoubleVector2D > &wrappedPathMinus1, QList< QDoubleVector2D > &wrappedPathPlus1, QDoubleVector2D *leftBoundWrapped)
QList< QGeoCoordinate > greaterCirclePath(const QList< QGeoCoordinate > &cornerPoints, greaterCirclePathForm form, int N)
QRectF boundingRectangleFromList(const QList< QDoubleVector2D > &list)
void clipPolygon(const QList< QDoubleVector2D > &wrappedPath, const QGeoProjectionWebMercator &p, QList< QList< QDoubleVector2D > > &clippedPaths, QDoubleVector2D *leftBoundWrapped, bool closed)
double distanceSqrPointLine(double p0_x, double p0_y, double p1_x, double p1_y, double p2_x, double p2_y)
void projectBbox(const QList< QDoubleVector2D > &clippedBbox, const QGeoProjectionWebMercator &p, QPainterPath &projectedBbox)
Combined button and popup list for selecting options.
bool qIsFinite(qfloat16 f) noexcept
bool qIsInf(qfloat16 f) noexcept
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qInf()
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
GLfloat GLfloat GLfloat alpha