OpenCPN Partial API docs
Loading...
Searching...
No Matches
SencManager.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose: S57 Chart Object
5 * Author: David Register
6 *
7 ***************************************************************************
8 * Copyright (C) 2010 by David S. Register *
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
24 **************************************************************************/
25
26#ifndef __SENCMGR_H__
27#define __SENCMGR_H__
28
29#include <vector>
30
31// ----------------------------------------------------------------------------
32// Useful Prototypes
33// ----------------------------------------------------------------------------
34
35//----------------------------------------------------------------------------
36// Constants
37//----------------------------------------------------------------------------
38
39//----------------------------------------------------------------------------
40// Fwd Defns
41//----------------------------------------------------------------------------
42
43class s57chart;
44class SENCBuildThread;
45
46class SENCThreadManager; // forward
47extern SENCThreadManager *g_SencThreadManager;
48typedef enum {
49 THREAD_INACTIVE = 0,
50 THREAD_PENDING,
51 THREAD_STARTED,
52 THREAD_FINISHED
53} SENCThreadStatus;
54
55typedef enum {
56 SENC_BUILD_INACTIVE = 0,
57 SENC_BUILD_PENDING,
58 SENC_BUILD_STARTED,
59 SENC_BUILD_DONE_NOERROR,
60 SENC_BUILD_DONE_ERROR,
61} EVENTSENCResult;
62
63extern const wxEventType wxEVT_OCPN_BUILDSENCTHREAD;
64
65//----------------------------------------------------------------------------
66// s57 Chart Thread based SENC job ticket
67//----------------------------------------------------------------------------
68class SENCJobTicket {
69public:
72
73 s57chart *m_chart;
74 wxString m_FullPath000;
75 wxString m_SENCFileName;
76 double ref_lat, ref_lon;
77 double m_LOD_meters;
78
79 SENCBuildThread *m_thread;
80
81 SENCThreadStatus m_status;
82 EVENTSENCResult m_SENCResult;
83};
84
85//----------------------------------------------------------------------------
86// s57 Chart Thread based SENC creator status message
87//----------------------------------------------------------------------------
88class OCPN_BUILDSENC_ThreadEvent : public wxEvent {
89public:
90 OCPN_BUILDSENC_ThreadEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
92
93 // required for sending with wxPostEvent()
94 wxEvent *Clone() const;
95
96 int stat;
97 EVENTSENCResult type;
98 SENCJobTicket *m_ticket;
99
100private:
101};
102
109class SENCThreadManager : public wxEvtHandler {
110public:
113
114 void OnEvtThread(OCPN_BUILDSENC_ThreadEvent &event);
115
116 SENCThreadStatus ScheduleJob(SENCJobTicket *ticket);
117 void FinishJob(SENCJobTicket *ticket);
118 void StartTopJob();
119 bool IsChartInTicketlist(s57chart *chart);
120 bool SetChartPointer(s57chart *chart, void *new_ptr);
121 int GetJobCount();
122
123 int m_max_jobs;
124
125 std::vector<SENCJobTicket *> ticket_list;
126};
127
128//----------------------------------------------------------------------------
129// s57 Chart Thread based SENC creator
130//----------------------------------------------------------------------------
131class SENCBuildThread : public wxThread {
132public:
134 void *Entry();
135
136 wxString m_FullPath000;
137 wxString m_SENCFileName;
138 s57chart *m_chart;
139 SENCThreadManager *m_manager;
140 SENCJobTicket *m_ticket;
141};
142
143#endif
Manager for S57 chart SENC creation threads.
Represents an S57 format electronic navigational chart in OpenCPN.
Definition s57chart.h:122