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