OpenCPN Partial API docs
Loading...
Searching...
No Matches
senc_manager.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2010 by David S. Register *
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
24#ifndef SENCMGR_H_
25#define SENCMGR_H_
26
27#include <vector>
28
29#include <wx/event.h>
30#include <wx/string.h>
31#include <wx/thread.h>
32
33#include "s57chart.h"
34
35class SENCThreadManager; // forward
38extern const wxEventType wxEVT_OCPN_BUILDSENCTHREAD;
40class SENCBuildThread; // forward
41
42typedef enum {
43 THREAD_INACTIVE = 0,
44 THREAD_PENDING,
45 THREAD_STARTED,
46 THREAD_FINISHED
47} SENCThreadStatus;
48
49typedef enum {
50 SENC_BUILD_INACTIVE = 0,
51 SENC_BUILD_PENDING,
52 SENC_BUILD_STARTED,
53 SENC_BUILD_DONE_NOERROR,
54 SENC_BUILD_DONE_ERROR,
55} EVENTSENCResult;
56
57//----------------------------------------------------------------------------
58// s57 Chart Thread based SENC job ticket
59//----------------------------------------------------------------------------
61public:
64
65 s57chart *m_chart;
66 wxString m_FullPath000;
67 wxString m_SENCFileName;
68 double ref_lat, ref_lon;
69 double m_LOD_meters;
70
71 SENCBuildThread *m_thread;
72
73 SENCThreadStatus m_status;
74 EVENTSENCResult m_SENCResult;
75};
76
77//----------------------------------------------------------------------------
78// s57 Chart Thread based SENC creator status message
79//----------------------------------------------------------------------------
80class OCPN_BUILDSENC_ThreadEvent : public wxEvent {
81public:
82 OCPN_BUILDSENC_ThreadEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
84
85 // required for sending with wxPostEvent()
86 wxEvent *Clone() const;
87
88 int stat;
89 EVENTSENCResult type;
90 SENCJobTicket *m_ticket;
91
92private:
93};
94
101class SENCThreadManager : public wxEvtHandler {
102public:
105
106 void OnEvtThread(OCPN_BUILDSENC_ThreadEvent &event);
107
108 SENCThreadStatus ScheduleJob(SENCJobTicket *ticket);
109 void FinishJob(SENCJobTicket *ticket);
110 void StartTopJob();
111 bool IsChartInTicketlist(s57chart *chart);
112 bool SetChartPointer(s57chart *chart, void *new_ptr);
113 int GetJobCount();
114
115 int m_max_jobs;
116
117 std::vector<SENCJobTicket *> ticket_list;
118};
119
120//----------------------------------------------------------------------------
121// s57 Chart Thread based SENC creator
122//----------------------------------------------------------------------------
123class SENCBuildThread : public wxThread {
124public:
126 void *Entry();
127
128 wxString m_FullPath000;
129 wxString m_SENCFileName;
130 s57chart *m_chart;
131 SENCThreadManager *m_manager;
132 SENCJobTicket *m_ticket;
133};
134
135#endif // SENCMGR_H_
Manager for S57 chart SENC creation threads.
Represents an S57 format electronic navigational chart in OpenCPN.
Definition s57chart.h:90
S57 Chart Object.
const wxEventType wxEVT_OCPN_BUILDSENCTHREAD
Global instance.
SENCThreadManager * g_SencThreadManager
Global instance.