34#include "OCPNRegion.h"
37typedef enum ScaleTypeEnum {
42class WXDLLEXPORT ChartImg;
48typedef enum PaletteDir { PaletteFwd, PaletteRev } _PaletteDir;
50typedef enum BSB_Color_Capability {
51 COLOR_RGB_DEFAULT = 0,
60} _BSB_Color_Capability;
71class wxFFileInputStream;
125 void FreeLineCacheRows(
int start = 0,
int end = -1);
126 bool HaveLineCacheRow(
int row);
129 virtual ThumbData *GetThumbData(
int tnx,
int tny,
float lat,
float lon);
130 virtual ThumbData *GetThumbData() {
return pThumbData; }
131 virtual bool UpdateThumbData(
double lat,
double lon);
133 int GetNativeScale() {
return m_Chart_Scale; }
134 double GetNormalScaleMin(
double canvas_scale_factor,
bool b_allow_overzoom);
135 double GetNormalScaleMax(
double canvas_scale_factor,
int canvas_width);
137 virtual InitReturn Init(
const wxString &name, ChartInitFlag init_flags);
139 virtual int latlong_to_pix_vp(
double lat,
double lon,
double &pixx,
141 virtual int vp_pix_to_latlong(
ViewPort &vp,
double pixx,
double pixy,
142 double *lat,
double *lon);
144 bool RenderRegionViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint,
147 virtual bool RenderRegionViewOnGL(
const wxGLContext &glc,
150 const LLRegion &Region);
153 virtual double GetNearestPreferredScalePPM(
double target_scale_ppm);
155 virtual void GetValidCanvasRegion(
const ViewPort &VPoint,
157 virtual LLRegion GetValidRegion();
159 virtual bool GetChartExtent(
Extent *pext);
161 void SetColorScheme(ColorScheme cs,
bool bApplyImmediate);
165 void SetVPRasterParms(
const ViewPort &vpt);
167 virtual void ComputeSourceRectangle(
const ViewPort &vp, wxRect *pSourceRect);
168 virtual double GetRasterScaleFactor(
const ViewPort &vp);
169 virtual bool GetChartBits(wxRect &source,
unsigned char *pPix,
int sub_samp);
170 virtual int GetSize_X() {
return Size_X; }
171 virtual int GetSize_Y() {
return Size_Y; }
173 virtual void latlong_to_chartpix(
double lat,
double lon,
double &pixx,
175 virtual void chartpix_to_latlong(
double pixx,
double pixy,
double *plat,
178 double GetPPM() {
return m_ppm_avg; }
183 wxRect GetSourceRect() {
return Rsrc; }
185 virtual bool GetAndScaleData(
unsigned char *ppn,
size_t data_size,
186 wxRect &source,
int source_stride, wxRect &dest,
187 int dest_stride,
double scale_factor,
188 ScaleTypeEnum scale_type);
189 bool RenderViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint);
191 bool IsCacheValid() {
return cached_image_ok; }
192 void InvalidateCache() { cached_image_ok = 0; }
193 bool IsRenderCacheable(wxRect &source, wxRect &dest);
195 void CreatePaletteEntry(
char *buffer,
int palette_index);
196 PaletteDir GetPaletteDir(
void);
197 int *GetPalettePtr(BSB_Color_Capability);
199 double GetClosestValidNaturalScalePPM(
double target_scale,
200 double scale_factor_min,
201 double scale_factor_max);
203 virtual void InvalidateLineCache();
204 virtual bool CreateLineIndex(
void);
206 virtual wxBitmap *CreateThumbnail(
int tnx,
int tny, ColorScheme cs);
207 virtual int BSBGetScanline(
unsigned char *pLineBuf,
int y,
int xs,
int xl,
210 bool GetViewUsingCache(wxRect &source, wxRect &dest,
const OCPNRegion &Region,
211 ScaleTypeEnum scale_type);
212 bool GetView(wxRect &source, wxRect &dest, ScaleTypeEnum scale_type);
214 virtual int BSBScanScanline(wxInputStream *pinStream);
215 virtual int ReadBSBHdrLine(wxInputStream *,
char *,
int);
216 virtual int AnalyzeRefpoints(
bool b_testSolution =
true);
217 virtual bool AnalyzeSkew(
void);
219 virtual bool SetMinMax(
void);
221 InitReturn PreInit(
const wxString &name, ChartInitFlag init_flags,
223 InitReturn PostInit(
void);
225 double AdjustLongitude(
double lon);
234 double m_proj_parameter;
248 wxRect cache_rect_scaled;
249 bool cached_image_ok;
250 ScaleTypeEnum cache_scale_method;
251 double m_cached_scale_ppm;
252 wxRect m_last_vprect;
255 double m_raster_scale_factor;
265 wxInputStream *ifs_hdr;
266 wxInputStream *ifss_bitmap;
267 wxBufferedInputStream *ifs_bitmap;
269 wxString *pBitmapFilePath;
271 unsigned char *ifs_buf;
272 unsigned char *ifs_bufend;
274 unsigned char *ifs_lp;
276 int nFileOffsetDataStart;
281 double wpx[12], wpy[12], pwx[12], pwy[12];
282 int wpx_type, wpy_type, pwx_type, pwy_type;
283 int n_wpx, n_wpy, n_pwx, n_pwy;
284 bool bHaveEmbeddedGeoref;
288 BSB_Color_Capability m_mapped_color_index;
292 int m_bilinear_limit;
302 PaletteDir palette_direction;
312 double m_proj_lat, m_proj_lon;
316 wxCriticalSection m_critSect;
317 wxULongLong m_filesize;
330 InitReturn Init(
const wxString &name, ChartInitFlag init_flags);
343 InitReturn Init(
const wxString &name, ChartInitFlag init_flags);
360 virtual wxString GetFileSearchMask(
void);
362 virtual InitReturn Init(
const wxString &name, ChartInitFlag init_flags);
365 virtual ThumbData *GetThumbData(
int tnx,
int tny,
float lat,
float lon);
367 virtual bool UpdateThumbData(
double lat,
double lon);
369 double GetNormalScaleMin(
double canvas_scale_factor,
bool b_allow_overzoom);
370 double GetNormalScaleMax(
double canvas_scale_factor,
int canvas_width);
372 virtual bool GetChartExtent(
Extent *pext);
374 virtual bool RenderRegionViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint,
377 virtual bool RenderRegionViewOnGL(
const wxGLContext &glc,
380 const LLRegion &Region);
384 virtual void GetValidCanvasRegion(
const ViewPort &VPoint,
387 virtual void SetColorScheme(ColorScheme cs,
bool bApplyImmediate);
389 virtual double GetNearestPreferredScalePPM(
double target_scale_ppm);
393 virtual int GetCOVREntries();
394 virtual int GetCOVRTablePoints(
int iTable);
395 virtual int GetCOVRTablenPoints(
int iTable);
396 virtual float *GetCOVRTableHead(
int iTable);
398 virtual int GetNoCOVREntries();
399 virtual int GetNoCOVRTablePoints(
int iTable);
400 virtual int GetNoCOVRTablenPoints(
int iTable);
401 virtual float *GetNoCOVRTableHead(
int iTable);
406 virtual void ComputeSourceRectangle(
const ViewPort &vp, wxRect *pSourceRect);
407 virtual double GetRasterScaleFactor(
const ViewPort &vp);
408 virtual bool GetChartBits(wxRect &source,
unsigned char *pPix,
int sub_samp);
409 virtual int GetSize_X();
410 virtual int GetSize_Y();
411 virtual void latlong_to_chartpix(
double lat,
double lon,
double &pixx,
413 virtual void chartpix_to_latlong(
double pixx,
double pixy,
double *plat,
417 virtual bool RenderRegionViewOnDCNoText(wxMemoryDC &dc,
421 virtual bool RenderRegionViewOnDCTextOnly(wxMemoryDC &dc,
425 virtual bool RenderRegionViewOnGLNoText(
const wxGLContext &glc,
428 const LLRegion &Region);
430 virtual bool RenderRegionViewOnGLTextOnly(
const wxGLContext &glc,
434 virtual void ClearPLIBTextList();
439 wxCriticalSection m_critSect;