32 #include "chartbase.h"
33 #include "model/georef.h"
34 #include "OCPNRegion.h"
37 typedef enum ScaleTypeEnum {
42 class WXDLLEXPORT ChartImg;
48 typedef enum PaletteDir { PaletteFwd, PaletteRev } _PaletteDir;
50 typedef enum BSB_Color_Capability {
51 COLOR_RGB_DEFAULT = 0,
60 } _BSB_Color_Capability;
71 class wxFFileInputStream;
126 void FreeLineCacheRows(
int start = 0,
int end = -1);
127 bool HaveLineCacheRow(
int row);
130 virtual ThumbData *GetThumbData(
int tnx,
int tny,
float lat,
float lon);
131 virtual ThumbData *GetThumbData() {
return pThumbData; }
132 virtual bool UpdateThumbData(
double lat,
double lon);
134 int GetNativeScale() {
return m_Chart_Scale; }
135 double GetNormalScaleMin(
double canvas_scale_factor,
bool b_allow_overzoom);
136 double GetNormalScaleMax(
double canvas_scale_factor,
int canvas_width);
138 virtual InitReturn Init(
const wxString &name, ChartInitFlag init_flags);
140 virtual int latlong_to_pix_vp(
double lat,
double lon,
double &pixx,
142 virtual int vp_pix_to_latlong(
ViewPort &vp,
double pixx,
double pixy,
143 double *lat,
double *lon);
145 bool RenderRegionViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint,
148 virtual bool RenderRegionViewOnGL(
const wxGLContext &glc,
151 const LLRegion &Region);
154 virtual double GetNearestPreferredScalePPM(
double target_scale_ppm);
156 virtual void GetValidCanvasRegion(
const ViewPort &VPoint,
158 virtual LLRegion GetValidRegion();
160 virtual bool GetChartExtent(
Extent *pext);
162 void SetColorScheme(ColorScheme cs,
bool bApplyImmediate);
166 void SetVPRasterParms(
const ViewPort &vpt);
168 virtual void ComputeSourceRectangle(
const ViewPort &vp, wxRect *pSourceRect);
169 virtual double GetRasterScaleFactor(
const ViewPort &vp);
170 virtual bool GetChartBits(wxRect &source,
unsigned char *pPix,
int sub_samp);
171 virtual int GetSize_X() {
return Size_X; }
172 virtual int GetSize_Y() {
return Size_Y; }
174 virtual void latlong_to_chartpix(
double lat,
double lon,
double &pixx,
176 virtual void chartpix_to_latlong(
double pixx,
double pixy,
double *plat,
179 double GetPPM() {
return m_ppm_avg; }
184 wxRect GetSourceRect() {
return Rsrc; }
186 virtual bool GetAndScaleData(
unsigned char *ppn,
size_t data_size,
187 wxRect &source,
int source_stride, wxRect &dest,
188 int dest_stride,
double scale_factor,
189 ScaleTypeEnum scale_type);
190 bool RenderViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint);
192 bool IsCacheValid() {
return cached_image_ok; }
193 void InvalidateCache() { cached_image_ok = 0; }
194 bool IsRenderCacheable(wxRect &source, wxRect &dest);
196 void CreatePaletteEntry(
char *buffer,
int palette_index);
197 PaletteDir GetPaletteDir(
void);
198 int *GetPalettePtr(BSB_Color_Capability);
200 double GetClosestValidNaturalScalePPM(
double target_scale,
201 double scale_factor_min,
202 double scale_factor_max);
204 virtual void InvalidateLineCache();
205 virtual bool CreateLineIndex(
void);
207 virtual wxBitmap *CreateThumbnail(
int tnx,
int tny, ColorScheme cs);
208 virtual int BSBGetScanline(
unsigned char *pLineBuf,
int y,
int xs,
int xl,
211 bool GetViewUsingCache(wxRect &source, wxRect &dest,
const OCPNRegion &Region,
212 ScaleTypeEnum scale_type);
213 bool GetView(wxRect &source, wxRect &dest, ScaleTypeEnum scale_type);
215 virtual int BSBScanScanline(wxInputStream *pinStream);
216 virtual int ReadBSBHdrLine(wxInputStream *,
char *,
int);
217 virtual int AnalyzeRefpoints(
bool b_testSolution =
true);
218 virtual bool AnalyzeSkew(
void);
220 virtual bool SetMinMax(
void);
222 InitReturn PreInit(
const wxString &name, ChartInitFlag init_flags,
224 InitReturn PostInit(
void);
226 double AdjustLongitude(
double lon);
235 double m_proj_parameter;
249 wxRect cache_rect_scaled;
250 bool cached_image_ok;
251 ScaleTypeEnum cache_scale_method;
252 double m_cached_scale_ppm;
253 wxRect m_last_vprect;
256 double m_raster_scale_factor;
266 wxInputStream *ifs_hdr;
267 wxInputStream *ifss_bitmap;
268 wxBufferedInputStream *ifs_bitmap;
270 wxString *pBitmapFilePath;
272 unsigned char *ifs_buf;
273 unsigned char *ifs_bufend;
275 unsigned char *ifs_lp;
277 int nFileOffsetDataStart;
282 double wpx[12], wpy[12], pwx[12], pwy[12];
283 int wpx_type, wpy_type, pwx_type, pwy_type;
284 int n_wpx, n_wpy, n_pwx, n_pwy;
285 bool bHaveEmbeddedGeoref;
289 BSB_Color_Capability m_mapped_color_index;
293 int m_bilinear_limit;
303 PaletteDir palette_direction;
313 double m_proj_lat, m_proj_lon;
317 wxCriticalSection m_critSect;
318 wxULongLong m_filesize;
331 InitReturn Init(
const wxString &name, ChartInitFlag init_flags);
344 InitReturn Init(
const wxString &name, ChartInitFlag init_flags);
361 virtual wxString GetFileSearchMask(
void);
363 virtual InitReturn Init(
const wxString &name, ChartInitFlag init_flags);
366 virtual ThumbData *GetThumbData(
int tnx,
int tny,
float lat,
float lon);
368 virtual bool UpdateThumbData(
double lat,
double lon);
370 double GetNormalScaleMin(
double canvas_scale_factor,
bool b_allow_overzoom);
371 double GetNormalScaleMax(
double canvas_scale_factor,
int canvas_width);
373 virtual bool GetChartExtent(
Extent *pext);
375 virtual bool RenderRegionViewOnDC(wxMemoryDC &dc,
const ViewPort &VPoint,
378 virtual bool RenderRegionViewOnGL(
const wxGLContext &glc,
381 const LLRegion &Region);
385 virtual void GetValidCanvasRegion(
const ViewPort &VPoint,
388 virtual void SetColorScheme(ColorScheme cs,
bool bApplyImmediate);
390 virtual double GetNearestPreferredScalePPM(
double target_scale_ppm);
394 virtual int GetCOVREntries();
395 virtual int GetCOVRTablePoints(
int iTable);
396 virtual int GetCOVRTablenPoints(
int iTable);
397 virtual float *GetCOVRTableHead(
int iTable);
399 virtual int GetNoCOVREntries();
400 virtual int GetNoCOVRTablePoints(
int iTable);
401 virtual int GetNoCOVRTablenPoints(
int iTable);
402 virtual float *GetNoCOVRTableHead(
int iTable);
407 virtual void ComputeSourceRectangle(
const ViewPort &vp, wxRect *pSourceRect);
408 virtual double GetRasterScaleFactor(
const ViewPort &vp);
409 virtual bool GetChartBits(wxRect &source,
unsigned char *pPix,
int sub_samp);
410 virtual int GetSize_X();
411 virtual int GetSize_Y();
412 virtual void latlong_to_chartpix(
double lat,
double lon,
double &pixx,
414 virtual void chartpix_to_latlong(
double pixx,
double pixy,
double *plat,
418 virtual bool RenderRegionViewOnDCNoText(wxMemoryDC &dc,
422 virtual bool RenderRegionViewOnDCTextOnly(wxMemoryDC &dc,
426 virtual bool RenderRegionViewOnGLNoText(
const wxGLContext &glc,
429 const LLRegion &Region);
431 virtual bool RenderRegionViewOnGLTextOnly(
const wxGLContext &glc,
435 virtual void ClearPLIBTextList();
440 wxCriticalSection m_critSect;