OpenCPN Partial API docs
Loading...
Searching...
No Matches
nav_object_database.h
1/******************************************************************************
2 *
3 * Project: OpenCPN
4 *
5 ***************************************************************************
6 * Copyright (C) 2010 by David S. Register *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22 ***************************************************************************
23 */
24
25#ifndef _NAVOBJECTCOLLECTION_H__
26#define _NAVOBJECTCOLLECTION_H__
27
28#include <memory>
29#include <vector>
30
31#include <wx/checkbox.h>
32#include <wx/string.h>
33
34#include "pugixml.hpp"
35#include "bbox.h"
36#include "observable_evtvar.h"
37
38class Track;
39class TrackPoint;
40class RouteList;
41class RoutePointList;
42class Route;
43class RoutePoint;
44
45// Bitfield definition controlling the GPX nodes output for point objects
46#define OUT_TYPE 1 << 1 // Output point type
47#define OUT_TIME 1 << 2 // Output time as ISO string
48#define OUT_NAME 1 << 3 // Output point name if defined
49#define OUT_NAME_FORCE 1 << 4 // Output point name, even if empty
50#define OUT_DESC 1 << 5 // Output description if defined
51#define OUT_DESC_FORCE 1 << 6 // Output description, even if empty
52#define OUT_SYM_FORCE 1 << 7 // Output symbol name, using "empty" if undefined
53#define OUT_GUID 1 << 8 // Output GUID if defined
54#define OUT_VIZ 1 << 9 // Output point viz, if non-zero(true)
55#define OUT_VIZ_NAME 1 << 10 // Output point name viz, if non-zero(true)
56#define OUT_SHARED 1 << 11 // Output point shared state, if non-zero(true)
57#define OUT_HYPERLINKS 1 << 13 // Output point Hyperlinks, if present
58#define OUT_ACTION_ADD 1 << 14 // opencpn:action node support
59#define OUT_ACTION_DEL 1 << 15
60#define OUT_ACTION_UPD 1 << 16
61#define OUT_EXTENSION 1 << 17
62#define OUT_ARRIVAL_RADIUS 1 << 18
63#define OUT_WAYPOINT_RANGE_RINGS 1 << 19
64#define OUT_WAYPOINT_SCALE 1 << 20
65#define OUT_TIDE_STATION 1 << 21
66#define OUT_RTE_PROPERTIES 1 << 22
67
68#define OPT_TRACKPT OUT_TIME
69#define OPT_WPT \
70 (OUT_TYPE) + (OUT_TIME) + (OUT_NAME) + (OUT_DESC) + (OUT_SYM_FORCE) + \
71 (OUT_GUID) + (OUT_VIZ) + (OUT_VIZ_NAME) + (OUT_SHARED) + \
72 (OUT_HYPERLINKS) + (OUT_ARRIVAL_RADIUS) + (OUT_WAYPOINT_RANGE_RINGS) + \
73 (OUT_WAYPOINT_SCALE) + (OUT_TIDE_STATION)
74#define OPT_ROUTEPT OPT_WPT + (OUT_RTE_PROPERTIES)
75
76// Bitfield definitions controlling the GPX nodes output for Route.Track
77// objects
78#define RT_OUT_ACTION_ADD 1 << 1 // opencpn:action node support
79#define RT_OUT_ACTION_DEL 1 << 2
80#define RT_OUT_ACTION_UPD 1 << 3
81#define RT_OUT_NO_RTPTS 1 << 4
82
83class NavObjectCollection1; // forward
84
85bool WptIsInRouteList(RoutePoint *pr);
86RoutePoint *WaypointExists(const wxString &name, double lat, double lon);
87RoutePoint *WaypointExists(const wxString &guid);
88Route *RouteExists(const wxString &guid);
89Route *RouteExists(Route *pTentRoute);
90Track *TrackExists(const wxString &guid);
91
92Route *FindRouteContainingWaypoint(RoutePoint *pWP);
93
94Route *GPXLoadRoute1(pugi::xml_node &wpt_node, bool b_fullviz, bool b_layer,
95 bool b_layerviz, int layer_id, bool b_change,
96 bool load_points = true);
97
98RoutePoint *GPXLoadWaypoint1(pugi::xml_node &wpt_node, wxString symbol_name,
99 wxString GUID, bool b_fullviz, bool b_layer,
100 bool b_layerviz, int layer_id,
101 bool b_nameviz = true);
102
103bool InsertRouteA(Route *pTentRoute, NavObjectCollection1 *navobj);
104bool InsertTrack(Track *pTentTrack, bool bApplyChanges = false);
105bool InsertWpt(RoutePoint *pWp, bool overwrite);
106
107Track *GPXLoadTrack1(pugi::xml_node &trk_node, bool b_fullviz, bool b_layer,
108 bool b_layerviz, int layer_id);
109
111public:
113 virtual ~NavObjectCollection1();
114
115 bool CreateNavObjGPXPoints(void);
116 bool CreateNavObjGPXRoutes(void);
117 bool CreateNavObjGPXTracks(void);
118
119 void AddGPXRoutesList(RouteList *pRoutes);
120 void AddGPXTracksList(std::vector<Track *> *pTracks);
121 bool AddGPXPointsList(RoutePointList *pRoutePoints);
122 bool AddGPXRoute(Route *pRoute);
123 bool AddGPXTrack(Track *pTrk);
124 bool AddGPXWaypoint(RoutePoint *pWP);
125
126 bool CreateAllGPXObjects();
127 bool LoadAllGPXObjects(bool b_full_viz, int &wpt_duplicates,
128 bool b_compute_bbox = false);
129 int LoadAllGPXObjectsAsLayer(int layer_id, bool b_layerviz,
130 wxCheckBoxState b_namesviz);
131 bool LoadAllGPXTrackObjects();
132 bool LoadAllGPXRouteObjects();
133 bool LoadAllGPXPointObjects();
134
135 bool SaveFile(const wxString filename);
136
137 void SetRootGPXNode(void);
138 bool IsOpenCPN();
139 LLBBox &GetBBox() { return BBox; };
140
141 LLBBox BBox;
142};
143
144#endif // _NAVOBJECTCOLLECTION_H__
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