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 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
73private:
74 NavObj_dB();
75 ~NavObj_dB();
76
77 bool ImportLegacyTracks();
78 bool ImportLegacyRoutes();
79 bool ImportLegacyPoints();
80 void CountImportNavObjects();
81
82 int m_open_result;
83 sqlite3 *m_db;
84 bool m_importing;
85 int m_nimportPoints;
86 int m_nimportRoutes;
87 int m_nimportTracks;
88 int m_nImportObjects;
89 int m_import_progesscount;
90 wxProgressDialog *m_pImportProgress;
91};
92
93#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.