33#include "ocpn_types.h"
37class wxGenericProgressDialog;
44 wxString magic_number;
51static const int DB_VERSION_PREVIOUS = 17;
52static const int DB_VERSION_CURRENT = 18;
77 int nNoCovrPlyEntries;
99 int nNoCovrPlyEntries;
154 float **pAuxPlyTable;
162 : nTableEntries(tableEntries), nDirEntries(dirEntries) {}
164 void Read(wxInputStream &is);
165 void Write(wxOutputStream &os);
167 int GetDirEntries()
const {
return nDirEntries; }
168 int GetTableEntries()
const {
return nTableEntries; }
169 char *GetDBVersionString() {
return dbVersion; }
191 void SetValid(
bool valid) { bValid = valid; }
192 time_t GetFileTime()
const {
return file_date; }
193 time_t GetChartEditionDate()
const {
return edition_date; }
195 int GetnPlyEntries()
const {
return nPlyEntries; }
196 float *GetpPlyTable()
const {
return pPlyTable; }
198 int GetnAuxPlyEntries()
const {
return nAuxPlyEntries; }
199 float *GetpAuxPlyTableEntry(
int index)
const {
return pAuxPlyTable[index]; }
200 int GetAuxCntTableEntry(
int index)
const {
return pAuxCntTable[index]; }
202 int GetnNoCovrPlyEntries()
const {
return nNoCovrPlyEntries; }
203 float *GetpNoCovrPlyTableEntry(
int index)
const {
204 return pNoCovrPlyTable[index];
206 int GetNoCovrCntTableEntry(
int index)
const {
return pNoCovrCntTable[index]; }
208 const LLBBox &GetBBox()
const {
return m_bbox; }
210 char *GetpFullPath()
const {
return pFullPath; }
211 float GetLonMax()
const {
return LonMax; }
212 float GetLonMin()
const {
return LonMin; }
213 float GetLatMax()
const {
return LatMax; }
214 float GetLatMin()
const {
return LatMin; }
215 int GetScale()
const {
return Scale; }
216 int GetChartType()
const {
return ChartType; }
217 int GetChartFamily()
const {
return ChartFamily; }
218 int GetChartProjectionType()
const {
return ProjectionType; }
219 float GetChartSkew()
const {
return Skew; }
221 bool GetbValid() {
return bValid; }
222 void SetEntryOffset(
int n) { EntryOffset = n; }
223 const wxString *GetpFileName(
void)
const {
return m_pfilename; }
224 wxString *GetpsFullPath(
void)
const {
return m_psFullPath; }
225 wxString GetFullSystemPath()
const {
return m_fullSystemPath; }
227 const std::vector<int> &GetGroupArray(
void)
const {
return m_GroupArray; }
228 void ClearGroupArray(
void) { m_GroupArray.clear(); }
229 void AddIntToGroupArray(
int val) { m_GroupArray.push_back(val); }
230 void SetAvailable(
bool avail) { m_bavail = avail; }
232 std::vector<float> GetReducedPlyPoints();
233 std::vector<float> GetReducedAuxPlyPoints(
int iTable);
235 LLRegion quilt_candidate_region;
237 void SetScale(
int scale);
238 bool Scale_eq(
int b)
const {
return abs(Scale - b) <= rounding; }
239 bool Scale_ge(
int b)
const {
return Scale_eq(b) || Scale > b; }
240 bool Scale_gt(
int b)
const {
return Scale > b && !Scale_eq(b); }
258 float **pAuxPlyTable;
263 int nNoCovrPlyEntries;
264 int *pNoCovrCntTable;
265 float **pNoCovrPlyTable;
267 std::vector<int> m_GroupArray;
268 wxString *m_pfilename;
269 wxString *m_psFullPath;
270 wxString m_fullSystemPath;
275 std::vector<float> m_reducedPlyPoints;
277 std::vector<std::vector<float>> m_reducedAuxPlyPointsVector;
280enum { BUILTIN_DESCRIPTOR = 0, PLUGIN_DESCRIPTOR };
288 : m_class_name(classn), m_search_mask(mask), m_descriptor_type(type){};
290 wxString m_class_name;
291 wxString m_search_mask;
292 int m_descriptor_type;
307 bool Create(ArrayOfCDI &dir_array, wxGenericProgressDialog *pprog);
308 bool Update(ArrayOfCDI &dir_array,
bool bForce,
309 wxGenericProgressDialog *pprog);
311 bool Read(
const wxString &filePath);
312 bool Write(
const wxString &filePath);
314 bool AddSingleChart(wxString &fullpath,
bool b_force_full_search =
true);
315 bool RemoveSingleChart(wxString &ChartFullPath);
317 const wxString &GetDBFileName()
const {
return m_DBFileName; }
318 ArrayOfCDI &GetChartDirArray() {
return m_dir_array; }
319 wxArrayString &GetChartDirArrayString() {
return m_chartDirs; }
320 void SetChartDirArray(ArrayOfCDI array) { m_dir_array = array; }
321 bool CompareChartDirArray(ArrayOfCDI &test_array);
322 wxString GetMagicNumberCached(wxString dir);
324 void UpdateChartClassDescriptorArray(
void);
326 int GetChartTableEntries()
const {
return active_chartTable.size(); }
329 inline ChartTable &GetChartTable() {
return active_chartTable; }
331 bool IsValid()
const {
return bValid; }
332 int DisableChart(wxString &PathToDisable);
333 bool GetCentroidOfLargestScaleChart(
double *clat,
double *clon,
334 ChartFamilyEnum family);
335 int GetDBChartType(
int dbIndex);
336 int GetDBChartFamily(
int dbIndex);
337 float GetDBChartSkew(
int dbIndex);
338 int GetDBChartProj(
int dbIndex);
339 int GetDBChartScale(
int dbIndex);
341 bool GetDBBoundingBox(
int dbindex, LLBBox &box);
342 const LLBBox &GetDBBoundingBox(
int dbIndex);
344 int GetnAuxPlyEntries(
int dbIndex);
345 int GetDBPlyPoint(
int dbIndex,
int plyindex,
float *lat,
float *lon);
346 int GetDBAuxPlyPoint(
int dbIndex,
int plyindex,
int iAuxPly,
float *lat,
348 int GetVersion() {
return m_dbversion; }
349 wxString GetFullChartInfo(
ChartBase *pc,
int dbIndex,
int *char_width,
351 int FinddbIndex(wxString PathToFind);
352 wxString GetDBChartFileName(
int dbIndex);
353 void ApplyGroupArray(ChartGroupArray *pGroupArray);
354 bool IsChartAvailable(
int dbIndex);
355 ChartTable active_chartTable;
356 std::map<wxString, int> active_chartTable_pathindex;
358 std::vector<float> GetReducedPlyPoints(
int dbIndex);
359 std::vector<float> GetReducedAuxPlyPoints(
int dbIndex,
int iTable);
361 bool IsBusy() {
return m_b_busy; }
364 virtual ChartBase *GetChart(
const wxChar *theFilePath,
366 int AddChartDirectory(
const wxString &theDir,
bool bshow_prog);
367 void SetValid(
bool valid) { bValid = valid; }
372 ArrayOfChartClassDescriptor m_ChartClassDescriptorArray;
373 ArrayOfCDI m_dir_array;
377 bool IsChartDirUsed(
const wxString &theDir);
379 int SearchDirAndAddCharts(wxString &dir_name_base,
381 wxGenericProgressDialog *pprog);
384 wxGenericProgressDialog *pprog,
385 wxString &dir_magic,
bool bForce);
386 bool DetectDirChange(
const wxString &dir_path,
const wxString &prog_label,
387 const wxString &magic, wxString &new_magic,
388 wxGenericProgressDialog *pprog);
391 wxGenericProgressDialog *pprog,
int isearch,
392 bool bthis_dir_in_dB);
394 bool Check_CM93_Structure(wxString dir_name);
397 wxArrayString m_chartDirs;
401 m_ChartTableEntryDummy;
402 wxString m_DBFileName;
418WX_DEFINE_ARRAY_PTR(
ChartGroup *, ChartGroupArray);
425 wxString m_element_name;
426 wxArrayString m_missing_name_array;
431 wxString m_group_name;
432 std::vector<ChartGroupElement> m_element_array;