OpenCPN Partial API docs
Loading...
Searching...
No Matches
chartcatalog.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2011 by Pavel Kalian *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
16 **************************************************************************/
17
25#ifndef CHARTCATALOG_H_
26#define CHARTCATALOG_H_
27
28#include <memory>
29#include <vector>
30
31#include <wx/wxprec.h>
32
33#ifndef WX_PRECOMP
34#include <wx/wx.h>
35#endif
36
37#include "pugixml.hpp"
38
39class NoticeToMariners; // forward
40class Vertex; // forward
41class Panel; // forward
42class Chart; // forward
43class Location; // forward
44class RiverMiles; // forward
45class Area; // Forward
46class ChartFile; // Forward
47
48// Declarations
50public:
51 ChartCatalog() = default;
52 ~ChartCatalog() = default;
53 // public methods
54 bool LoadFromFile(const wxString &path, bool headerOnly = false);
55 bool LoadFromXml(pugi::xml_document *doc, bool headerOnly);
56 wxDateTime GetReleaseDate();
57 // public properties
58 wxString title;
59 wxDateTime date_created;
60 wxDateTime time_created;
61 wxDateTime date_valid;
62 wxDateTime time_valid;
63 wxDateTime dt_valid;
64 wxString ref_spec;
65 wxString ref_spec_vers;
66 wxString s62AgencyCode;
67 std::vector<std::unique_ptr<Chart>> charts;
68
69private:
70 bool ParseNoaaHeader(const pugi::xml_node &xmldata);
71};
72
73class Chart {
74public:
75 Chart(pugi::xml_node &xmldata);
76 virtual ~Chart();
77 // public methods
78 virtual wxString GetChartTitle() { return title; }
79 virtual wxString GetDownloadLocation() { return zipfile_location; }
80 virtual bool NeedsManualDownload() { return manual_download_url != ""; }
81 virtual wxString GetManualDownloadUrl() { return manual_download_url; }
82 virtual wxString GetChartFilename(bool to_check);
83 virtual wxDateTime GetUpdateDatetime() { return zipfile_datetime_iso8601; }
84
85 // public properties
86 wxString number; // chart number used for zip file name, BSB name, cell
87 // number .Paul.
88 wxString title; // RNC: <title>, ENC:<lname>
89 wxArrayString *coast_guard_districts;
90 wxArrayString *states;
91 wxArrayString *regions;
92 wxString zipfile_location;
93 wxString target_filename;
94 wxDateTime zipfile_datetime;
95 wxDateTime zipfile_datetime_iso8601;
96 int zipfile_size;
97 int edtn;
98 int updn;
99 wxDateTime uadt;
100 wxDateTime isdt;
101 wxString reference_file;
102 wxString manual_download_url;
103
105 NoticeToMariners *lnm;
106 std::vector<std::unique_ptr<Panel>> coverage;
107};
108
109class RasterChart : public Chart {
110public:
111 RasterChart(pugi::xml_node &xmldata);
112
113 int source_edition;
114 int raster_edition;
115 int ntm_edition;
116 wxString source_date;
117 wxString ntm_date;
118 wxString source_edition_last_correction;
119 wxString raster_edition_last_correction;
120 wxString ntm_edition_last_correction;
121};
122
123class EncCell : public Chart //<cell>
124{
125public:
126 EncCell(pugi::xml_node &xmldata);
127
128 wxString src_chart;
129 int cscale;
130 wxString status;
131 int edtn;
132 int updn;
133 wxDateTime uadt;
134 wxDateTime isdt;
135};
136
137class IEncCell : public Chart //<Cell>
138{
139public:
140 IEncCell(pugi::xml_node &xmldata);
141 ~IEncCell() override;
142 // public methods
143 wxString GetChartTitle() override;
144 wxString GetDownloadLocation() override;
145 wxDateTime GetUpdateDatetime() override;
146
147 // public properties
148 Location *location;
149 wxString river_name;
150 RiverMiles *river_miles;
151 Area *area;
152 wxString edition;
153 ChartFile *shp_file;
154 ChartFile *s57_file;
155 ChartFile *kml_file;
156};
157
159public:
160 ChartFile(pugi::xml_node &xmldata);
161
162 wxString location;
163 wxDateTime date_posted;
164 wxDateTime time_posted;
165 int file_size;
166};
167
168class Location {
169public:
170 Location(pugi::xml_node &xmldata);
171 // public methods
172
173 // public properties
174 wxString from;
175 wxString to;
176};
177
179public:
180 RiverMiles(pugi::xml_node &xmldata);
181
182 double begin;
183 double end;
184};
185
186class Area {
187public:
188 Area(pugi::xml_node &xmldata);
189
190 double north;
191 double south;
192 double east;
193 double west;
194};
195
196class NoticeToMariners // for <nm> and <lnm>
197{
198public:
200
201 wxString agency; //<nm_agency> or <lnm_agency>
202 wxString doc;
203 wxDateTime date;
204};
205
206class Vertex {
207public:
208 Vertex(pugi::xml_node &xmldata);
209 virtual ~Vertex() = default;
210
211 double lat;
212 double lon;
213};
214
215class Panel {
216public:
217 Panel(pugi::xml_node &xmldata);
218 virtual ~Panel() = default;
219
220 int panel_no;
221 std::vector<Vertex> vertexes;
222};
223
224class RncPanel : public Panel {
225public:
226 RncPanel(pugi::xml_node &xmldata);
227
228 wxString panel_title;
229 wxString file_name;
230 int scale;
231};
232
233class EncPanel : public Panel {
234public:
235 EncPanel(pugi::xml_node &xmldata);
236
237 wxString type;
238};
239
240#endif // CHARTCATALOG_H_