7#ifndef MARBLE_SCANLINETEXTUREMAPPERCONTEXT_H
8#define MARBLE_SCANLINETEXTUREMAPPERCONTEXT_H
13#include "GeoSceneTileDataset.h"
14#include "MarbleMath.h"
15#include "MathHelper.h"
21class StackedTileLoader;
24class ScanlineTextureMapperContext
27 ScanlineTextureMapperContext(StackedTileLoader *
const tileLoader,
int tileLevel);
29 void pixelValueF(
const qreal lon,
const qreal lat, QRgb *
const scanLine);
30 void pixelValue(
const qreal lon,
const qreal lat, QRgb *
const scanLine);
32 void pixelValueApproxF(
const qreal lon,
const qreal lat, QRgb *scanLine,
const int n);
33 void pixelValueApprox(
const qreal lon,
const qreal lat, QRgb *scanLine,
const int n);
35 static int interpolationStep(
const ViewportParams *viewport, MapQuality mapQuality);
37 static QImage::Format optimalCanvasImageFormat(
const ViewportParams *viewport);
39 int globalWidth()
const;
40 int globalHeight()
const;
44 void nextTile(
int &posx,
int &posy);
47 void nextTile(qreal &posx, qreal &posy);
51 qreal rad2PixelX(
const qreal lon)
const;
52 qreal rad2PixelY(
const qreal lat)
const;
56 bool isOutOfTileRange(
const int itLon,
const int itLat,
const int itStepLon,
const int itStepLat,
const int n)
const;
58 bool isOutOfTileRangeF(
const qreal itLon,
const qreal itLat,
const qreal itStepLon,
const qreal itStepLat,
const int n)
const;
61 StackedTileLoader *
const m_tileLoader;
62 GeoSceneAbstractTileProjection::Type
const m_textureProjection;
64 QSize const m_tileSize;
66 int const m_tileLevel;
67 int const m_globalWidth;
68 int const m_globalHeight;
69 qreal
const m_normGlobalWidth;
70 qreal
const m_normGlobalHeight;
72 const StackedTile *m_tile;
84 qreal m_toTileCoordinatesLon;
85 qreal m_toTileCoordinatesLat;
94inline int ScanlineTextureMapperContext::globalWidth()
const
99inline int ScanlineTextureMapperContext::globalHeight()
const
101 return m_globalHeight;
104inline qreal ScanlineTextureMapperContext::rad2PixelX(
const qreal lon)
const
106 return lon * m_normGlobalWidth;
109inline qreal ScanlineTextureMapperContext::rad2PixelY(
const qreal lat)
const
111 switch (m_textureProjection) {
112 case GeoSceneAbstractTileProjection::Equirectangular:
113 return -lat * m_normGlobalHeight;
114 case GeoSceneAbstractTileProjection::Mercator:
115 if (fabs(lat) < 1.4835) {
124 return -
gdInv(lat) * 0.5 * m_normGlobalHeight;
128 return -3.1309587 * 0.5 * m_normGlobalHeight;
131 return 3.1309587 * 0.5 * m_normGlobalHeight;
Binds a QML item to a specific geodetic location in screen coordinates.
qreal gdInv(qreal x)
This method is a fast Mac Laurin power series approximation of the.