struct mrpt::topography::TCoords

Python API: mrpt.topography.TCoords

Overview

A coordinate that is stored as a simple “decimal” angle in degrees, but can be retrieved/set in the form of DEGREES + arc-MINUTES + arc-SECONDS.

#include <mrpt/topography/data_types.h>

struct TCoords
{
    // fields

    double decimal_value = 0;

    // construction

    TCoords(
        const int _deg,
        const int _min,
        const double _sec
        );

    TCoords(const double dec);
    TCoords();

    // methods

    operator double () const;
    operator double & ();
    void setFromDecimal(const double dec);
    double getDecimalValue() const;
    void getDegMinSec(int& degrees, int& minutes, double& seconds) const;
    void setDegMinSec(const int degrees, const int minutes, const double seconds);
    std::string getAsString() const;
};

Fields

double decimal_value = 0

Also obtained directly through the double(void) operator using a TCoords anywhere were a double is expected.

Methods

operator double () const

Automatic conversion to a double value (read-only)

operator double & ()

Automatic conversion to a mutable reference to the underlying decimal value, so a TCoords can be assigned to directly as if it were a plain double.

void setFromDecimal(const double dec)

Set from a decimal value (XX.YYYYY) in degrees.

double getDecimalValue() const

Get the decimal value (XX.YYYYY), in degrees - you can also use the automatic conversion between TCoords and a double.

void getDegMinSec(int& degrees, int& minutes, double& seconds) const

Return the Deg Min’ Sec’’ representation of this value.

For negative values, the sign is carried by the first non-zero part (e.g. -0.5 is returned as 0deg -30’ 0’’).

void setDegMinSec(const int degrees, const int minutes, const double seconds)

Set the coordinate from its Deg Min’ Sec’’ parts.

The value is negative if any of the parts is negative.

std::string getAsString() const

Return a std::string in the format “DEGdeg MIN’ SEC’’” (with a leading ‘-’ for negative values)