9#include <QtGui/QMatrix4x4>
16#include <QtPositioning/private/qwebmercator_p.h>
17#include <QtPositioning/private/qdoublevector2d_p.h>
18#include <QtPositioning/private/qdoublevector3d_p.h>
19#include <QtPositioning/private/qlocationutils_p.h>
48 d_ptr->m_dirtyGeometry =
true;
50 d_ptr->m_intZoomLevel =
static_cast<int>(std::floor(
d_ptr->m_camera.zoomLevel()));
51 d_ptr->m_sideLength = 1 <<
d_ptr->m_intZoomLevel;
56 return d_ptr->m_camera;
61 if (
d_ptr->m_visibleArea == visibleArea)
64 d_ptr->m_visibleArea = visibleArea;
65 d_ptr->m_dirtyGeometry =
true;
73 d_ptr->m_dirtyGeometry =
true;
79 if (
d_ptr->m_pluginString == pluginString)
82 d_ptr->m_dirtyMetadata =
true;
83 d_ptr->m_pluginString = pluginString;
88 if (
d_ptr->m_mapType == mapType)
91 d_ptr->m_dirtyMetadata =
true;
92 d_ptr->m_mapType = mapType;
97 return d_ptr->m_mapType;
102 if (
d_ptr->m_mapVersion == mapVersion)
105 d_ptr->m_dirtyMetadata =
true;
106 d_ptr->m_mapVersion = mapVersion;
114 d_ptr->m_dirtyGeometry =
true;
120 d_ptr->m_viewExpansion = viewExpansion;
121 d_ptr->m_dirtyGeometry =
true;
126 return d_ptr->m_tileSize;
131 if (
d_ptr->m_dirtyGeometry) {
132 d_ptr->m_tiles.clear();
133 d_ptr->updateGeometry();
134 d_ptr->m_dirtyGeometry =
false;
137 if (
d_ptr->m_dirtyMetadata) {
138 d_ptr->updateMetadata();
139 d_ptr->m_dirtyMetadata =
false;
142 return d_ptr->m_tiles;
155 for (;
i !=
end; ++
i) {
168#ifdef QT_LOCATION_DEBUG
174#ifdef QT_LOCATION_DEBUG
175 m_frustumFootprint = footprint;
180#ifdef QT_LOCATION_DEBUG
181 m_clippedFootprint = polygons;
203 double apertureSize = 1.0;
207#ifdef QT_LOCATION_DEBUG
208 m_createFrustum_center = center;
216 double altitude = (
f / (2.0 *
z)) / apertureSize;
240 double nearPlane = 1.0 / 32.0;
244 double farPlane = altitude + 8.0;
249 double hhn,hwn,hhf,hwf = 0.0;
253 viewExpansion *= apertureSize;
255 hhn = viewExpansion * nearPlane;
256 hwn = hhn * aspectRatio;
258 hhf = viewExpansion * farPlane;
259 hwf = hhf * aspectRatio;
272#ifdef QT_LOCATION_DEBUG
273 m_createFrustum_eye = eye;
282 QPointF diff = screenCenter - vaCenter;
286 double wn = (2 * hwn) * xdiffpct;
287 double hn = (2 * hhn) * ydiffpct;
288 double wf = (2 * hwf) * xdiffpct;
289 double hf = (2 * hhf) * ydiffpct;
313 if ((
f >= 0) && (
f <= 1.0)) {
360 const double v =
polygon.at(
i).get(axis);
378 int prevComp = comparisons[prevIndex];
379 int comp = comparisons[
index];
380 int nextComp = comparisons[nextIndex];
383 if (prevComp == -1) {
388 }
else if (prevComp == 1) {
390 if (nextComp == -1) {
393 }
else if (prevComp == 0) {
394 if (nextComp == -1) {
396 }
else if (nextComp == 1) {
398 }
else if (nextComp == 0) {
405 }
else if (comp == 1) {
413 if ((nextComp != 0) && (nextComp != comp)) {
417 double p1v =
p1.get(axis);
418 double p2v =
p2.get(axis);
420 double f = (p1v -
value) / (p1v - p2v);
422 if (((0 <=
f) && (
f <= 1.0))
426 polygonBelow.
append(midPoint);
427 polygonAbove.
append(midPoint);
439 v.setX(
v.x() + xoff);
450 double minX = std::numeric_limits<double>::max();
451 double maxX = std::numeric_limits<double>::lowest();
476 minX =
qMin(
v.x(), minX);
480 double footprintWidth =
maxX - minX;
484 if (footprintWidth > side) {
503 if (pair.first.isEmpty()) {
505 for (
const auto &
v : std::as_const(pair.second)) {
507 pair.first.append(
v);
509 if (pair.first.size() == 2) {
510 double y0 = pair.first[0].y();
511 double y1 = pair.first[1].y();
517 }
else if (pair.first.size() == 1) {
523 double y = pair.first.at(0).y();
531 if (footprintWidth > side)
539 if (pair.second.isEmpty()) {
541 for (
const auto &
v : std::as_const(pair.first)) {
543 pair.second.append(
v);
545 if (pair.second.size() == 2) {
546 double y0 = pair.second[0].y();
547 double y1 = pair.second[1].y();
553 }
else if (pair.second.size() == 1) {
559 double y = pair.second.at(0).y();
567 if (footprintWidth > side)
650 for (
qsizetype i1 = 0; i1 < numPoints; ++i1) {
651 const qsizetype i2 = (i1 + 1) % numPoints;
710 if (xFixed && xIntegral) {
712 xOther =
qMax(0,
x - 1);
716 if (yFixed && yIntegral) {
718 yOther =
qMax(0,
y - 1);
726 map.add(xOther, yOther);
736 const qsizetype iPrev = (i1 + numPoints - 1) % numPoints;
737 const double xPrevious =
polygon.at(iPrev).get(0);
738 const double yPrevious =
polygon.at(iPrev).get(1);
740 if (xIntegral && xPreviousFixed && yIntegral && yFixed) {
741 if ((
x2 >
x1) && (yPrevious >
y1)) {
742 if ((
x - 1) > 0 && (
y - 1) > 0)
743 map.add(
x - 1,
y - 1);
744 }
else if ((
x2 <
x1) && (yPrevious <
y1)) {
756 if (nextX.first < nextY.first) {
761 }
else if (nextX.first > nextY.first) {
767 map.add(
x, nextY.second);
768 map.add(nextX.second,
y);
777 while (!xIntersects.
isEmpty()) {
780 if (yIntegral && yFixed)
785 while (!yIntersects.
isEmpty()) {
788 if (xIntegral && xFixed)
799 int maxX =
i->second;
800 for (
int x = minX;
x <=
maxX; ++
x)
811 if (
data.contains(tileY)) {
812 int oldMinX =
data.value(tileY).first;
813 int oldMaxX =
data.value(tileY).second;
static QDoubleVector3D normal(const QDoubleVector3D &v1, const QDoubleVector3D &v2)
double fieldOfView() const
QGeoCoordinate center() const
PolygonVector frustumFootprint(const Frustum &frustum) const
Frustum createFrustum(double viewExpansion) const
QSet< QGeoTileSpec > tilesFromPolygon(const PolygonVector &polygon) const
QList< QPair< double, int > > tileIntersections(double p1, int t1, double p2, int t2) const
QPair< PolygonVector, PolygonVector > splitPolygonAtAxisValue(const PolygonVector &polygon, int axis, double value) const
ClippedFootprint clipFootprintToMap(const PolygonVector &footprint) const
QSet< QGeoTileSpec > m_tiles
void setMapType(const QGeoMapType &mapType)
const QSet< QGeoTileSpec > & createTiles()
void setMapVersion(int mapVersion)
QGeoCameraData cameraData() const
QGeoMapType activeMapType() const
std::unique_ptr< QGeoCameraTilesPrivate > d_ptr
void setScreenSize(const QSize &size)
void setViewExpansion(double viewExpansion)
void setTileSize(int tileSize)
void setCameraData(const QGeoCameraData &camera)
void setPluginString(const QString &pluginString)
void setVisibleArea(const QRectF &visibleArea)
void removeFirst() noexcept
bool isEmpty() const noexcept
iterator insert(qsizetype i, parameter_type t)
const_reference at(qsizetype i) const noexcept
void append(parameter_type t)
static double radians(double degrees)
const_iterator constBegin() const
const_iterator constEnd() const
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
void rotate(float angle, const QVector3D &vector)
Multiples this matrix by another that rotates coordinates through angle degrees about vector.
QPoint map(const QPoint &point) const
Maps point by multiplying this matrix by point.
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
constexpr QPointF center() const noexcept
Returns the center point of the rectangle.
const_iterator constBegin() const noexcept
const_iterator constEnd() const noexcept
QSet< T > & unite(const QSet< T > &other)
iterator insert(const T &value)
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QVector3D class represents a vector or vertex in 3D space.
static QDoubleVector2D coordToMercator(const QGeoCoordinate &coord)
QMap< QString, QString > map
[6]
Combined button and popup list for selecting options.
std::pair< T1, T2 > QPair
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter * iter
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
static QDoubleVector3D toDoubleVector3D(const QVector3D &in)
static bool appendZIntersects(const QDoubleVector3D &start, const QDoubleVector3D &end, double z, QList< QDoubleVector3D > &results)
static QVector3D toVector3D(const QDoubleVector3D &in)
static void addXOffset(PolygonVector &footprint, double xoff)
QList< QDoubleVector3D > PolygonVector
static QT_BEGIN_NAMESPACE const int tileSize
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLsizei const GLfloat * v
[13]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat x1
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
[4]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint GLfloat GLfloat y0
GLfloat GLfloat GLfloat GLfloat maxX
GLfixed GLfixed GLint GLint GLfixed points
GLfixed GLfixed GLfixed y2
QDoubleVector3D topRightFar
QDoubleVector3D topRightNear
QDoubleVector3D bottomLeftNear
QDoubleVector3D topLeftNear
QDoubleVector3D bottomLeftFar
QDoubleVector3D bottomRightFar
QDoubleVector3D topLeftFar
QDoubleVector3D bottomRightNear
void add(int tileX, int tileY)