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