OpenCPN Partial API docs
Loading...
Searching...
No Matches
navutil_base.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2010 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 _NAVUTIL_BASE__
25#define _NAVUTIL_BASE__
26
27#include <wx/datetime.h>
28#include <wx/string.h>
29#include <wx/utils.h>
30
31#include "model/config_vars.h"
32#include "model/gpx_document.h"
33
34enum { SPEED_KTS = 0, SPEED_MPH, SPEED_KMH, SPEED_MS };
35enum { WSPEED_KTS = 0, WSPEED_MS, WSPEED_MPH, WSPEED_KMH };
36enum { DEPTH_FT = 0, DEPTH_M, DEPTH_FA };
39enum { HEIGHT_M = 0, HEIGHT_FT };
40enum { TEMPERATURE_C = 0, TEMPERATURE_F = 1, TEMPERATURE_K = 2 };
41
42enum {
43 DISTANCE_NMI = 0,
44 DISTANCE_MI,
45 DISTANCE_KM,
46 DISTANCE_M,
47 DISTANCE_FT,
48 DISTANCE_FA,
49 DISTANCE_IN,
50 DISTANCE_CM
51};
52
53extern wxString toSDMM(int NEflag, double a, bool hi_precision = true);
54extern double toUsrSpeed(double kts_speed, int unit = -1);
55extern double toUsrWindSpeed(double kts_speed, int unit = -1);
56extern wxString getUsrSpeedUnit(int unit = -1);
57extern wxString getUsrWindSpeedUnit(int unit = -1);
58extern wxString getUsrTempUnit(int unit = -1);
71extern wxString FormatDistanceAdaptive(double distance);
79extern double toUsrTemp(double cel_temp, int unit = -1);
80
88extern double toUsrDistance(double nm_distance, int unit = -1);
89extern wxString getUsrDistanceUnit(int unit = -1);
97extern double fromUsrDistance(double usr_distance, int unit,
98 int default_val = -1);
99extern double fromUsrSpeed(double usr_speed, int unit, int default_val);
100
108extern double toUsrDepth(double m_depth, int unit = -1);
109extern double fromUsrDepth(double usr_depth, int unit = -1);
110extern wxString getUsrDepthUnit(int unit = -1);
111
113extern double toUsrHeight(double m_height, int unit = -1);
115extern double fromUsrHeight(double usr_height, int unit = -1);
117extern wxString getUsrHeightUnit(int unit = -1);
118
132const wxChar *ParseGPXDateTime(wxDateTime &dt, const wxChar *datetime);
133
134extern wxString formatTimeDelta(wxTimeSpan span);
135extern wxString formatTimeDelta(wxDateTime startTime, wxDateTime endTime);
136extern wxString formatTimeDelta(wxLongLong secs);
137
138extern double fromDMM(wxString sdms);
139
140extern double toMagnetic(double deg_true);
141extern double toMagnetic(double deg_true, double variation);
142
143wxString SanitizeFileName(const wxString &input);
144#endif // _NAVUTIL_BASE__
Global variables stored in configuration file.
GPX files UUID support.
double toUsrHeight(double m_height, int unit=-1)
Convert height from meters to preferred height units.
const wxChar * ParseGPXDateTime(wxDateTime &dt, const wxChar *datetime)
This function parses a string containing a GPX time representation and returns a wxDateTime containin...
double toUsrDistance(double nm_distance, int unit=-1)
Convert a distance from nautical miles (NMi) to user display units.
double toUsrTemp(double cel_temp, int unit=-1)
Convert a temperature from Celsius to user display units.
wxString getUsrHeightUnit(int unit=-1)
Get the abbreviation for the preferred height unit.
double fromUsrHeight(double usr_height, int unit=-1)
Convert height from preferred height units to meters.
double toUsrDepth(double m_depth, int unit=-1)
Convert a depth from meters to user display units.
double fromUsrDistance(double usr_distance, int unit, int default_val=-1)
Convert distance from user units to nautical miles.
wxString FormatDistanceAdaptive(double distance)
Format a distance (given in nautical miles) using the current distance preference,...