OpenCPN Partial API docs
|
Implement navutil_base.h – navigation Utility Functions without GUI deps. More...
#include <iomanip>
#include <sstream>
#include <wx/datetime.h>
#include <wx/math.h>
#include <wx/string.h>
#include <wx/translation.h>
#include "model/navutil_base.h"
#include "model/own_ship.h"
#include "vector2D.h"
Go to the source code of this file.
Functions | |
wxString | toSDMM (int NEflag, double a, bool hi_precision) |
double | toUsrSpeed (double kts_speed, int unit) |
double | toUsrWindSpeed (double kts_wspeed, int unit) |
double | toUsrDistance (double nm_distance, int unit) |
Convert a distance from nautical miles (NMi) to user display units. | |
double | toUsrTemp (double cel_temp, int unit) |
Convert a temperature from Celsius to user display units. | |
wxString | getUsrTempUnit (int unit) |
wxString | getUsrDistanceUnit (int unit) |
wxString | getUsrSpeedUnit (int unit) |
wxString | getUsrWindSpeedUnit (int unit) |
wxString | FormatDistanceAdaptive (double distance) |
Format a distance (given in nautical miles) using the current distance preference, adapting unit and precision for readability when appropriate. | |
double | fromUsrSpeed (double usr_speed, int unit, int default_val) |
double | fromUsrDistance (double usr_distance, int unit, int default_val) |
Convert distance from user units to nautical miles. | |
double | toUsrDepth (double m_depth, int unit) |
Convert a depth from meters to user display units. | |
double | fromUsrDepth (double usr_depth, int unit) |
wxString | getUsrDepthUnit (int unit) |
double | toUsrHeight (double m_height, int unit) |
Convert height from meters to preferred height units. | |
double | fromUsrHeight (double usr_height, int unit) |
Convert height from preferred height units to meters. | |
wxString | getUsrHeightUnit (int unit) |
Get the abbreviation for the preferred height unit. | |
double | vGetLengthOfNormal (pVector2D a, pVector2D b, pVector2D n) |
double | vDotProduct (pVector2D v0, pVector2D v1) |
pVector2D | vAddVectors (pVector2D v0, pVector2D v1, pVector2D v) |
pVector2D | vSubtractVectors (pVector2D v0, pVector2D v1, pVector2D v) |
double | vVectorSquared (pVector2D v0) |
double | vVectorMagnitude (pVector2D v0) |
const wxChar * | ParseGPXDateTime (wxDateTime &dt, const wxChar *datetime) |
This function parses a string containing a GPX time representation and returns a wxDateTime containing the UTC corresponding to the input. | |
wxString | formatTimeDelta (wxTimeSpan span) |
wxString | formatTimeDelta (wxDateTime startTime, wxDateTime endTime) |
wxString | formatTimeDelta (wxLongLong secs) |
double | fromDMM (wxString sdms) |
double | toMagnetic (double deg_true) |
double | toMagnetic (double deg_true, double variation) |
wxString | SanitizeFileName (const wxString &input) |
Implement navutil_base.h – navigation Utility Functions without GUI deps.
Definition in file navutil_base.cpp.
wxString FormatDistanceAdaptive | ( | double | distance | ) |
Format a distance (given in nautical miles) using the current distance preference, adapting unit and precision for readability when appropriate.
distance
as nautical miles (NMi).distance | Distance in nautical miles to format. |
Definition at line 344 of file navutil_base.cpp.
wxString formatTimeDelta | ( | wxDateTime | startTime, |
wxDateTime | endTime | ||
) |
Definition at line 689 of file navutil_base.cpp.
wxString formatTimeDelta | ( | wxLongLong | secs | ) |
Definition at line 699 of file navutil_base.cpp.
wxString formatTimeDelta | ( | wxTimeSpan | span | ) |
Definition at line 671 of file navutil_base.cpp.
double fromDMM | ( | wxString | sdms | ) |
Definition at line 728 of file navutil_base.cpp.
double fromUsrDepth | ( | double | usr_depth, |
int | unit | ||
) |
Definition at line 449 of file navutil_base.cpp.
double fromUsrDistance | ( | double | usr_distance, |
int | unit, | ||
int | default_val = -1 |
||
) |
Convert distance from user units to nautical miles.
usr_distance | Distance in user units |
unit | Unit to convert from, or -1 to use default_val |
default_val | Default unit when unit=-1, or -1 to use the global default |
Definition at line 394 of file navutil_base.cpp.
double fromUsrHeight | ( | double | usr_height, |
int | unit | ||
) |
Convert height from preferred height units to meters.
Definition at line 500 of file navutil_base.cpp.
double fromUsrSpeed | ( | double | usr_speed, |
int | unit, | ||
int | default_val | ||
) |
Definition at line 370 of file navutil_base.cpp.
wxString getUsrDepthUnit | ( | int | unit | ) |
Definition at line 469 of file navutil_base.cpp.
wxString getUsrDistanceUnit | ( | int | unit | ) |
Definition at line 266 of file navutil_base.cpp.
wxString getUsrHeightUnit | ( | int | unit | ) |
Get the abbreviation for the preferred height unit.
Definition at line 514 of file navutil_base.cpp.
wxString getUsrSpeedUnit | ( | int | unit | ) |
Definition at line 301 of file navutil_base.cpp.
wxString getUsrTempUnit | ( | int | unit | ) |
Definition at line 246 of file navutil_base.cpp.
wxString getUsrWindSpeedUnit | ( | int | unit | ) |
Definition at line 324 of file navutil_base.cpp.
const wxChar * ParseGPXDateTime | ( | wxDateTime & | dt, |
const wxChar * | datetime | ||
) |
This function parses a string containing a GPX time representation and returns a wxDateTime containing the UTC corresponding to the input.
The function return value is a pointer past the last valid character parsed (if successful) or NULL (if the string is invalid).
Valid GPX time strings are in ISO 8601 format as follows:
[-]<YYYY>-<MM>-T<hh>:<mm>:<ss>Z|(+|-<hh>:<mm>)
For example, 2010-10-30T14:34:56Z and 2010-10-30T14:34:56-04:00 are the same time. The first is UTC and the second is EDT.
Definition at line 603 of file navutil_base.cpp.
wxString SanitizeFileName | ( | const wxString & | input | ) |
Definition at line 819 of file navutil_base.cpp.
double toMagnetic | ( | double | deg_true | ) |
Definition at line 794 of file navutil_base.cpp.
double toMagnetic | ( | double | deg_true, |
double | variation | ||
) |
Definition at line 810 of file navutil_base.cpp.
wxString toSDMM | ( | int | NEflag, |
double | a, | ||
bool | hi_precision | ||
) |
Definition at line 44 of file navutil_base.cpp.
double toUsrDepth | ( | double | m_depth, |
int | unit = -1 |
||
) |
Convert a depth from meters to user display units.
m_depth | Depth in meters to convert. |
unit | Output unit or -1 to use the global depth format. |
Definition at line 429 of file navutil_base.cpp.
double toUsrDistance | ( | double | nm_distance, |
int | unit = -1 |
||
) |
Convert a distance from nautical miles (NMi) to user display units.
nm_distance | Distance in nautical miles to convert. |
unit | Output unit or -1 to use the global distance format. |
Definition at line 191 of file navutil_base.cpp.
double toUsrHeight | ( | double | m_height, |
int | unit | ||
) |
Convert height from meters to preferred height units.
Definition at line 486 of file navutil_base.cpp.
double toUsrSpeed | ( | double | kts_speed, |
int | unit | ||
) |
Definition at line 148 of file navutil_base.cpp.
double toUsrTemp | ( | double | cel_temp, |
int | unit = -1 |
||
) |
Convert a temperature from Celsius to user display units.
cel_temp | Temperature in Celsius to convert. |
unit | Output unit or -1 to use the global temperature format. |
Definition at line 226 of file navutil_base.cpp.
double toUsrWindSpeed | ( | double | kts_wspeed, |
int | unit | ||
) |
Definition at line 171 of file navutil_base.cpp.
pVector2D vAddVectors | ( | pVector2D | v0, |
pVector2D | v1, | ||
pVector2D | v | ||
) |
Definition at line 563 of file navutil_base.cpp.
double vDotProduct | ( | pVector2D | v0, |
pVector2D | v1 | ||
) |
Definition at line 554 of file navutil_base.cpp.
double vGetLengthOfNormal | ( | pVector2D | a, |
pVector2D | b, | ||
pVector2D | n | ||
) |
Definition at line 531 of file navutil_base.cpp.
pVector2D vSubtractVectors | ( | pVector2D | v0, |
pVector2D | v1, | ||
pVector2D | v | ||
) |
Definition at line 573 of file navutil_base.cpp.
double vVectorMagnitude | ( | pVector2D | v0 | ) |
Definition at line 593 of file navutil_base.cpp.
double vVectorSquared | ( | pVector2D | v0 | ) |
Definition at line 583 of file navutil_base.cpp.