| 1 | /**************************************************************************** | 
| 2 | ** | 
| 3 | ** Copyright (C) 2018 The Qt Company Ltd. | 
| 4 | ** Contact: http://www.qt.io/licensing/ | 
| 5 | ** | 
| 6 | ** This file is part of the QtLocation module of the Qt Toolkit. | 
| 7 | ** | 
| 8 | ** $QT_BEGIN_LICENSE:LGPL3$ | 
| 9 | ** Commercial License Usage | 
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | 
| 11 | ** accordance with the commercial license agreement provided with the | 
| 12 | ** Software or, alternatively, in accordance with the terms contained in | 
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | 
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | 
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | 
| 16 | ** | 
| 17 | ** GNU Lesser General Public License Usage | 
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
| 19 | ** General Public License version 3 as published by the Free Software | 
| 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the | 
| 21 | ** packaging of this file. Please review the following information to | 
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | 
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. | 
| 24 | ** | 
| 25 | ** GNU General Public License Usage | 
| 26 | ** Alternatively, this file may be used under the terms of the GNU | 
| 27 | ** General Public License version 2.0 or later as published by the Free | 
| 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in | 
| 29 | ** the packaging of this file. Please review the following information to | 
| 30 | ** ensure the GNU General Public License version 2.0 requirements will be | 
| 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. | 
| 32 | ** | 
| 33 | ** $QT_END_LICENSE$ | 
| 34 | ** | 
| 35 | ****************************************************************************/ | 
| 36 | #ifndef QGEOCAMERATILES_P_P_H | 
| 37 | #define QGEOCAMERATILES_P_P_H | 
| 38 |  | 
| 39 | // | 
| 40 | //  W A R N I N G | 
| 41 | //  ------------- | 
| 42 | // | 
| 43 | // This file is not part of the Qt API.  It exists purely as an | 
| 44 | // implementation detail.  This header file may change from version to | 
| 45 | // version without notice, or even be removed. | 
| 46 | // | 
| 47 | // We mean it. | 
| 48 | // | 
| 49 |  | 
| 50 | #include "qgeocameratiles_p.h" | 
| 51 | #include <QtPositioning/private/qwebmercator_p.h> | 
| 52 | #include <QtPositioning/private/qdoublevector2d_p.h> | 
| 53 | #include <QtPositioning/private/qdoublevector3d_p.h> | 
| 54 | #include "qgeomaptype_p.h" | 
| 55 | #include "qgeocameradata_p.h" | 
| 56 | #include "qgeotilespec_p.h" | 
| 57 |  | 
| 58 | #include <QtCore/qvector.h> | 
| 59 | #include <QtCore/qset.h> | 
| 60 |  | 
| 61 | QT_BEGIN_NAMESPACE | 
| 62 |  | 
| 63 | struct Q_LOCATION_PRIVATE_EXPORT Frustum | 
| 64 | { | 
| 65 |     QDoubleVector3D apex; | 
| 66 |     QDoubleVector3D topLeftNear; | 
| 67 |     QDoubleVector3D topLeftFar; | 
| 68 |     QDoubleVector3D topRightNear; | 
| 69 |     QDoubleVector3D topRightFar; | 
| 70 |     QDoubleVector3D bottomLeftNear; | 
| 71 |     QDoubleVector3D bottomLeftFar; | 
| 72 |     QDoubleVector3D bottomRightNear; | 
| 73 |     QDoubleVector3D bottomRightFar; | 
| 74 | }; | 
| 75 |  | 
| 76 | typedef QVector<QDoubleVector3D> PolygonVector; | 
| 77 |  | 
| 78 | class Q_LOCATION_PRIVATE_EXPORT QGeoCameraTilesPrivate | 
| 79 | { | 
| 80 | public: | 
| 81 |     struct  | 
| 82 |     { | 
| 83 |         () | 
| 84 |         {} | 
| 85 |         (const PolygonVector &left_, const PolygonVector &mid_, const PolygonVector &right_) | 
| 86 |             : left(left_), mid(mid_), right(right_) | 
| 87 |         {} | 
| 88 |         PolygonVector ; | 
| 89 |         PolygonVector ; | 
| 90 |         PolygonVector ; | 
| 91 |     }; | 
| 92 |  | 
| 93 |     struct TileMap | 
| 94 |     { | 
| 95 |         TileMap(); | 
| 96 |  | 
| 97 |         void add(int tileX, int tileY); | 
| 98 |  | 
| 99 |         QMap<int, QPair<int, int> > data; | 
| 100 |     }; | 
| 101 |  | 
| 102 |     QGeoCameraTilesPrivate(); | 
| 103 |     ~QGeoCameraTilesPrivate(); | 
| 104 |  | 
| 105 |  | 
| 106 |     void updateMetadata(); | 
| 107 |     void updateGeometry(); | 
| 108 |  | 
| 109 |     Frustum createFrustum(double viewExpansion) const; | 
| 110 |     PolygonVector (const Frustum &frustum) const; | 
| 111 |  | 
| 112 |     QPair<PolygonVector, PolygonVector> splitPolygonAtAxisValue(const PolygonVector &polygon, int axis, double value) const; | 
| 113 |     ClippedFootprint (const PolygonVector &) const; | 
| 114 |  | 
| 115 |     QList<QPair<double, int> > tileIntersections(double p1, int t1, double p2, int t2) const; | 
| 116 |     QSet<QGeoTileSpec> tilesFromPolygon(const PolygonVector &polygon) const; | 
| 117 |  | 
| 118 |     static QGeoCameraTilesPrivate *get(QGeoCameraTiles *o) { | 
| 119 |         return o->d_ptr.data(); | 
| 120 |     } | 
| 121 |  | 
| 122 | public: | 
| 123 |     QString m_pluginString; | 
| 124 |     QGeoMapType m_mapType; | 
| 125 |     int m_mapVersion; | 
| 126 |     QGeoCameraData m_camera; | 
| 127 |     QSize m_screenSize; | 
| 128 |     QRectF m_visibleArea; | 
| 129 |     int m_tileSize; | 
| 130 |     QSet<QGeoTileSpec> m_tiles; | 
| 131 |  | 
| 132 |     int m_intZoomLevel; | 
| 133 |     int m_sideLength; | 
| 134 |     bool m_dirtyGeometry; | 
| 135 |     bool m_dirtyMetadata; | 
| 136 |     double m_viewExpansion; | 
| 137 |  | 
| 138 | #ifdef QT_LOCATION_DEBUG | 
| 139 |     // updateGeometry | 
| 140 |     ClippedFootprint m_clippedFootprint; | 
| 141 |     PolygonVector m_frustumFootprint; | 
| 142 |     Frustum m_frustum; | 
| 143 |  | 
| 144 |     // createFrustum | 
| 145 |     mutable QDoubleVector3D m_createFrustum_center; | 
| 146 |     mutable QDoubleVector3D m_createFrustum_eye; | 
| 147 | #endif | 
| 148 | }; | 
| 149 |  | 
| 150 | QT_END_NAMESPACE | 
| 151 |  | 
| 152 | #endif // QGEOCAMERATILES_P_P_H | 
| 153 |  |