29#ifndef _CHARTMBTILES_H_
30#define _CHARTMBTILES_H_
34#include "OCPNRegion.h"
37enum class MBTilesType : std::int8_t { BASE, OVERLAY };
38enum class MBTilesScheme : std::int8_t { XYZ, TMS };
40class WXDLLEXPORT ChartMbTiles;
78 virtual ThumbData *GetThumbData(
int tnx,
int tny,
float lat,
float lon);
80 virtual bool UpdateThumbData(
double lat,
double lon);
84 int GetNativeScale() {
return m_Chart_Scale; }
85 double GetNormalScaleMin(
double canvas_scale_factor,
bool b_allow_overzoom);
86 double GetNormalScaleMax(
double canvas_scale_factor,
int canvas_width);
88 virtual InitReturn Init(
const wxString &name, ChartInitFlag init_flags);
90 bool RenderRegionViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint,
93 virtual bool RenderRegionViewOnGL(
const wxGLContext &glc,
96 const LLRegion &Region);
98 virtual double GetNearestPreferredScalePPM(
double target_scale_ppm);
100 virtual void GetValidCanvasRegion(
const ViewPort &VPoint,
102 virtual LLRegion GetValidRegion();
104 virtual bool GetChartExtent(
Extent *pext);
106 void SetColorScheme(ColorScheme cs,
bool bApplyImmediate);
108 double GetPPM() {
return m_ppm_avg; }
109 double GetZoomFactor() {
return m_zoomScaleFactor; }
113 bool RenderViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint);
114 InitReturn PreInit(
const wxString &name, ChartInitFlag init_flags,
116 InitReturn PostInit(
void);
119 void PrepareTilesForZoom(
int zoomFactor,
bool bset_geom);
121 void FlushTiles(
void);
122 void FlushTextures(
void);
128 float m_LonMax, m_LonMin, m_LatMax, m_LatMin;
135 int m_minZoom, m_maxZoom;
137 LLRegion m_minZoomRegion;
138 wxBitmapType m_imageType;
140 double m_zoomScaleFactor;
143 MBTilesScheme m_Scheme;
145 SQLite::Database *m_pDB;
147 std::string m_format;
152 void InitFromTiles(
const wxString &name);
153 wxPoint2DDouble GetDoublePixFromLL(
ViewPort &vp,
double lat,
double lon);