OpenCPN Partial API docs
Loading...
Searching...
No Matches
navutil_base.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose: Navigation Utility Functions without GUI dependencies.
5 * Author: David Register
6 *
7 ***************************************************************************
8 * Copyright (C) 2010 by David S. Register *
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
24 **************************************************************************/
25
26#ifndef _NAVUTIL_BASE__
27#define _NAVUTIL_BASE__
28
29#include <wx/datetime.h>
30#include <wx/string.h>
31#include <wx/utils.h>
32
33#include "model/config_vars.h"
34#include "model/gpx_document.h"
35
36enum { SPEED_KTS = 0, SPEED_MPH, SPEED_KMH, SPEED_MS };
37enum { WSPEED_KTS = 0, WSPEED_MS, WSPEED_MPH, WSPEED_KMH };
38enum { DEPTH_FT = 0, DEPTH_M, DEPTH_FA };
39enum { TEMPERATURE_C = 0, TEMPERATURE_F = 1, TEMPERATURE_K = 2 };
40
41enum {
42 DISTANCE_NMI = 0,
43 DISTANCE_MI,
44 DISTANCE_KM,
45 DISTANCE_M,
46 DISTANCE_FT,
47 DISTANCE_FA,
48 DISTANCE_IN,
49 DISTANCE_CM
50};
51
52extern wxString toSDMM(int NEflag, double a, bool hi_precision = true);
53extern double toUsrSpeed(double kts_speed, int unit = -1);
54extern double toUsrWindSpeed(double kts_speed, int unit = -1);
55extern wxString getUsrSpeedUnit(int unit = -1);
56extern wxString getUsrWindSpeedUnit(int unit = -1);
57extern wxString getUsrTempUnit(int unit = -1);
58extern wxString FormatDistanceAdaptive(double distance);
59extern double toUsrTemp(double cel_temp, int unit = -1);
60
61extern double toUsrDistance(double nm_distance, int unit = -1);
62extern wxString getUsrDistanceUnit(int unit = -1);
63extern double fromUsrDistance(double usr_distance, int unit, int default_val);
64extern double fromUsrSpeed(double usr_speed, int unit, int default_val);
65
66extern double toUsrDepth(double cel_depth, int unit = -1);
67extern double fromUsrDepth(double usr_depth, int unit = -1);
68extern wxString getUsrDepthUnit(int unit = -1);
69
83const wxChar *ParseGPXDateTime(wxDateTime &dt, const wxChar *datetime);
84
85extern wxString formatTimeDelta(wxTimeSpan span);
86extern wxString formatTimeDelta(wxDateTime startTime, wxDateTime endTime);
87extern wxString formatTimeDelta(wxLongLong secs);
88
89extern double fromDMM(wxString sdms);
90
91extern double toMagnetic(double deg_true);
92extern double toMagnetic(double deg_true, double variation);
93#endif // _NAVUTIL_BASE__
Class GpxDocument.