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#include "notification.h"
29#include "observable_evtvar.h"
30#include "comm_appmsg.h"
31#include <sqlite3.h>
32#include "track.h"
33
35class NavObj_dB {
36public:
37 static NavObj_dB &GetInstance();
38
39 NavObj_dB(const NavObj_dB &) = delete;
40 NavObj_dB &operator=(const NavObj_dB &) = delete;
41
42 void Close();
43 void LoadNavObjects();
44
45 // Tracks
46 bool LoadAllTracks();
47 bool InsertTrack(Track *track);
48 bool UpdateTrack(Track *track);
49 bool AddTrackPoint(Track *track, TrackPoint *point);
50 bool UpdateDBTrackAttributes(Track *track);
51 bool DeleteTrack(Track *track);
52
53 // Routes
54 bool LoadAllRoutes();
55 bool InsertRoute(Route *route);
56 bool UpdateRoute(Route *route);
57 bool UpdateRouteViz(Route *route);
58
59 bool UpdateDBRouteAttributes(Route *route);
60 bool UpdateDBRoutePointAttributes(RoutePoint *point);
61 bool UpdateDBRoutePointViz(RoutePoint *point);
62 bool DeleteRoute(Route *route);
63
64 // RoutePoints
65 bool LoadAllPoints();
66 bool InsertRoutePoint(RoutePoint *point);
67 bool DeleteRoutePoint(RoutePoint *point);
68 bool UpdateRoutePoint(RoutePoint *point);
69
70 // Legacy navobj import
71 bool ImportLegacyNavobj(wxFrame *frame);
72
73 // Maintainance
74 bool Backup(wxString fileName);
75
76private:
77 NavObj_dB();
78 ~NavObj_dB();
79
80 bool ImportLegacyTracks();
81 bool ImportLegacyRoutes();
82 bool ImportLegacyPoints();
83 void CountImportNavObjects();
84
85 int m_open_result;
86 sqlite3 *m_db;
87 bool m_importing;
88 int m_nimportPoints;
89 int m_nimportRoutes;
90 int m_nimportTracks;
91 int m_nImportObjects;
92 int m_import_progesscount;
93 wxProgressDialog *m_pImportProgress;
94};
95
96#endif
The navobj SQLite container object, a singleton.
Definition navobj_db.h:35
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.
A common variable shared between producer and consumer which supports Listen() and Notify().
Recorded track abstraction.