29 #ifndef _CHARTMBTILES_H_
30 #define _CHARTMBTILES_H_
33 #include "chartbase.h"
34 #include "model/georef.h"
35 #include "OCPNRegion.h"
37 #include "TileDescriptor.hpp"
38 #include "WorkerThread.hpp"
39 #include "TileCache.hpp"
41 enum class MBTilesType : std::int8_t { BASE, OVERLAY };
42 enum class MBTilesScheme : std::int8_t { XYZ, TMS };
44 class WXDLLEXPORT ChartMbTiles;
57 class mbTileDescriptor;
81 virtual ThumbData *GetThumbData(
int tnx,
int tny,
float lat,
float lon);
83 virtual bool UpdateThumbData(
double lat,
double lon);
87 int GetNativeScale() {
return m_Chart_Scale; }
88 double GetNormalScaleMin(
double canvas_scale_factor,
bool b_allow_overzoom);
89 double GetNormalScaleMax(
double canvas_scale_factor,
int canvas_width);
91 virtual InitReturn Init(
const wxString &name, ChartInitFlag init_flags);
93 bool RenderRegionViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint,
96 virtual bool RenderRegionViewOnGL(
const wxGLContext &glc,
99 const LLRegion &Region);
101 virtual double GetNearestPreferredScalePPM(
double target_scale_ppm);
103 virtual void GetValidCanvasRegion(
const ViewPort &VPoint,
105 virtual LLRegion GetValidRegion();
107 virtual bool GetChartExtent(
Extent *pext);
109 void SetColorScheme(ColorScheme cs,
bool bApplyImmediate);
111 double GetPPM() {
return m_ppm_avg; }
112 double GetZoomFactor() {
return m_zoomScaleFactor; }
116 bool RenderViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint);
117 InitReturn PreInit(
const wxString &name, ChartInitFlag init_flags,
119 InitReturn PostInit(
void);
122 void PrepareTilesForZoom(
int zoomFactor,
bool bset_geom);
123 bool getTileTexture(mbTileDescriptor *tile);
124 void FlushTiles(
void);
125 bool RenderTile(mbTileDescriptor *tile,
int zoomLevel,
130 float m_LonMax, m_LonMin, m_LatMax, m_LatMin;
137 int m_minZoom, m_maxZoom;
138 TileCache *m_tileCache;
139 LLRegion m_minZoomRegion;
140 wxBitmapType m_imageType;
142 double m_zoomScaleFactor;
145 MBTilesScheme m_Scheme;
147 SQLite::Database *m_pDB;
149 std::string m_format;
152 uint32_t m_tileCount;
153 MbtTilesThread *m_workerThread;
158 void InitFromTiles(
const wxString &name);
159 wxPoint2DDouble GetDoublePixFromLL(
ViewPort &vp,
double lat,
double lon);