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 wxString reference_file;
104 wxString manual_download_url;
105
107 NoticeToMariners *lnm;
108 std::vector<std::unique_ptr<Panel>> coverage;
109};
110
111class RasterChart : public Chart //<chart>
112{
113public:
114 RasterChart(pugi::xml_node &xmldata);
115 // public methods
116
117 // public properties
118 int source_edition;
119 int raster_edition;
120 int ntm_edition;
121 wxString source_date;
122 wxString ntm_date;
123 wxString source_edition_last_correction;
124 wxString raster_edition_last_correction;
125 wxString ntm_edition_last_correction;
126};
127
128class EncCell : public Chart //<cell>
129{
130public:
131 EncCell(pugi::xml_node &xmldata);
132 // public methods
133
134 // public properties
135 // wxString name; use wxString number in class Chart .Paul.
136 wxString src_chart;
137 int cscale;
138 wxString status;
139 int edtn;
140 int updn;
141 wxDateTime uadt;
142 wxDateTime isdt;
143};
144
145class IEncCell : public Chart //<Cell>
146{
147public:
148 IEncCell(pugi::xml_node &xmldata);
149 ~IEncCell();
150 // public methods
151 wxString GetChartTitle();
152 wxString GetDownloadLocation();
153 wxDateTime GetUpdateDatetime();
154
155 // public properties
156 // wxString name; use wxString number in class Chart .Paul.
157 Location *location;
158 wxString river_name;
159 RiverMiles *river_miles;
160 Area *area;
161 wxString edition;
162 ChartFile *shp_file;
163 ChartFile *s57_file;
164 ChartFile *kml_file;
165};
166
168public:
169 ChartFile(pugi::xml_node &xmldata);
170 // public methods
171
172 // public properties
173 wxString location;
174 wxDateTime date_posted;
175 wxDateTime time_posted;
176 int file_size;
177};
178
179class Location {
180public:
181 Location(pugi::xml_node &xmldata);
182 // public methods
183
184 // public properties
185 wxString from;
186 wxString to;
187};
188
190public:
191 RiverMiles(pugi::xml_node &xmldata);
192 // public methods
193
194 // public properties
195 double begin;
196 double end;
197};
198
199class Area {
200public:
201 Area(pugi::xml_node &xmldata);
202 // public methods
203
204 // public properties
205 double north;
206 double south;
207 double east;
208 double west;
209};
210
211class NoticeToMariners // for <nm> and <lnm>
212{
213public:
215 // public methods
216
217 // public properties
218 wxString agency; //<nm_agency> or <lnm_agency>
219 wxString doc;
220 wxDateTime date;
221};
222
223class Vertex {
224public:
225 Vertex(pugi::xml_node &xmldata);
226 virtual ~Vertex() {};
227 // public methods
228
229 // public properties
230 double lat;
231 double lon;
232};
233
234class Panel {
235public:
236 Panel(pugi::xml_node &xmldata);
237 virtual ~Panel();
238 // public methods
239
240 // public properties
241 int panel_no;
242 std::vector<Vertex> vertexes;
243};
244
245class RncPanel : public Panel {
246public:
247 RncPanel(pugi::xml_node &xmldata);
248 // public methods
249
250 // public properties
251 wxString panel_title;
252 wxString file_name;
253 int scale;
254};
255
256class EncPanel : public Panel {
257public:
258 EncPanel(pugi::xml_node &xmldata);
259 // public methods
260
261 // public properties
262 wxString type;
263};
264
265#endif //_CHARTCATALOG_H_