OpenCPN Partial API docs
Loading...
Searching...
No Matches
navobj_db.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2025 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 _NAVOBJ_DB_H__
25#define _NAVOBJ_DB_H__
26
27#include <wx/timer.h>
28
29#include "observable/evtvar.h"
30
31#include "notification.h"
32#include "comm_appmsg.h"
33#include <sqlite3.h>
34#include "track.h"
35
37class NavObj_dB {
38public:
39 static NavObj_dB &GetInstance();
40
41 NavObj_dB(const NavObj_dB &) = delete;
42 NavObj_dB &operator=(const NavObj_dB &) = delete;
43
44 void Close();
45 void LoadNavObjects();
46
47 // Tracks
48 bool LoadAllTracks();
49 bool InsertTrack(Track *track);
50 bool UpdateTrack(Track *track);
51 bool AddTrackPoint(Track *track, TrackPoint *point);
52 bool UpdateDBTrackAttributes(Track *track);
53 bool DeleteTrack(Track *track);
54
55 // Routes
56 bool LoadAllRoutes();
57 bool InsertRoute(Route *route);
58 bool UpdateRoute(Route *route);
59 bool UpdateRouteViz(Route *route);
60
61 bool UpdateDBRouteAttributes(Route *route);
62 bool UpdateDBRoutePointAttributes(RoutePoint *point);
63 bool UpdateDBRoutePointViz(RoutePoint *point);
64 bool DeleteRoute(Route *route);
65
66 // RoutePoints
67 bool LoadAllPoints();
68 bool InsertRoutePoint(RoutePoint *point);
69 bool DeleteRoutePoint(RoutePoint *point);
70 bool UpdateRoutePoint(RoutePoint *point);
71
72 // Legacy navobj import
73 bool ImportLegacyNavobj(wxFrame *frame);
74
75 // Maintainance
76 bool Backup(wxString fileName);
77 bool FullSchemaMigrate(wxFrame *frame);
78
79private:
80 NavObj_dB();
81 ~NavObj_dB();
82
83 bool ImportLegacyTracks();
84 bool ImportLegacyRoutes();
85 bool ImportLegacyPoints();
86 void CountImportNavObjects();
87
88 int m_open_result;
89 sqlite3 *m_db;
90 bool m_importing;
91 int m_nimportPoints;
92 int m_nimportRoutes;
93 int m_nimportTracks;
94 int m_nImportObjects;
95 int m_import_progesscount;
96 wxProgressDialog *m_pImportProgress;
97};
98
99#endif
The navobj SQLite container object, a singleton.
Definition navobj_db.h:37
Represents a waypoint or mark within the navigation system.
Definition route_point.h:71
Represents a navigational route in the navigation system.
Definition route.h:99
Represents a single point in a track.
Definition track.h:59
Represents a track, which is a series of connected track points.
Definition track.h:117
Decoded messages definitions.
User notification container.
Recorded track abstraction.