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, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 **************************************************************************/
19
25#ifndef _NAVOBJ_DB_H__
26#define _NAVOBJ_DB_H__
27
28#include <wx/timer.h>
29#include "notification.h"
30#include "observable_evtvar.h"
31#include "comm_appmsg.h"
32#include <sqlite3.h>
33#include "track.h"
34
36class NavObj_dB {
37public:
38 static NavObj_dB &GetInstance();
39
40 NavObj_dB(const NavObj_dB &) = delete;
41 NavObj_dB &operator=(const NavObj_dB &) = delete;
42
43 void Close();
44 void LoadNavObjects();
45
46 // Tracks
47 bool LoadAllTracks();
48 bool InsertTrack(Track *track);
49 bool UpdateTrack(Track *track);
50 bool AddTrackPoint(Track *track, TrackPoint *point);
51 bool UpdateDBTrackAttributes(Track *track);
52 bool DeleteTrack(Track *track);
53
54 // Routes
55 bool LoadAllRoutes();
56 bool InsertRoute(Route *route);
57 bool UpdateRoute(Route *route);
58 bool UpdateRouteViz(Route *route);
59
60 bool UpdateDBRouteAttributes(Route *route);
61 bool UpdateDBRoutePointAttributes(RoutePoint *point);
62 bool UpdateDBRoutePointViz(RoutePoint *point);
63 bool DeleteRoute(Route *route);
64
65 // RoutePoints
66 bool LoadAllPoints();
67 bool InsertRoutePoint(RoutePoint *point);
68 bool DeleteRoutePoint(RoutePoint *point);
69 bool UpdateRoutePoint(RoutePoint *point);
70
71 // Legacy navobj import
72 bool ImportLegacyNavobj(wxFrame *frame);
73
74 // Maintainance
75 bool Backup(wxString fileName);
76
77private:
78 NavObj_dB();
79 ~NavObj_dB();
80
81 bool ImportLegacyTracks();
82 bool ImportLegacyRoutes();
83 bool ImportLegacyPoints();
84 void CountImportNavObjects();
85
86 int m_open_result;
87 sqlite3 *m_db;
88 bool m_importing;
89 int m_nimportPoints;
90 int m_nimportRoutes;
91 int m_nimportTracks;
92 int m_nImportObjects;
93 int m_import_progesscount;
94 wxProgressDialog *m_pImportProgress;
95};
96
97#endif
The navobj SQLite container object, a singleton.
Definition navobj_db.h:36
Represents a waypoint or mark within the navigation system.
Definition route_point.h:70
Represents a navigational route in the navigation system.
Definition route.h:98
Represents a single point in a track.
Definition track.h:53
Represents a track, which is a series of connected track points.
Definition track.h:111
Class Notification.
A common variable shared between producer and consumer which supports Listen() and Notify().