<commit_before>/* +---------------------------------------------------------------------------+
   |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |
   |                                                                           |
   |                   http://mrpt.sourceforge.net/                            |
   |                                                                           |
   |   Copyright (C) 2005-2010  University of Malaga                           |
   |                                                                           |
   |    This software was written by the Machine Perception and Intelligent    |
   |      Robotics Lab, University of Malaga (Spain).                          |
   |    Contact: <NAME>  <<EMAIL>>                     |
   |                                                                           |
   |  This file is part of the MRPT project.                                   |
   |                                                                           |
   |     MRPT is free software: you can redistribute it and/or modify          |
   |     it under the terms of the GNU General Public License as published by  |
   |     the Free Software Foundation, either version 3 of the License, or     |
   |     (at your option) any later version.                                   |
   |                                                                           |
   |   MRPT is distributed in the hope that it will be useful,                 |
   |     but WITHOUT ANY WARRANTY; without even the implied warranty of        |
   |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |
   |     GNU General Public License for more details.                          |
   |                                                                           |
   |     You should have received a copy of the GNU General Public License     |
   |     along with MRPT.  If not, see <http://www.gnu.org/licenses/>.         |
   |                                                                           |
   +---------------------------------------------------------------------------+ */
#ifndef  data_types_H
#define  data_types_H

#include <mrpt/utils/utils_defs.h>
#include <mrpt/math/lightweight_geom_data.h>

#include <mrpt/topography/link_pragmas.h>

namespace mrpt
{
	namespace topography
	{
		using namespace std;
		using namespace mrpt::utils;


	/** =======================================================================
	   @name Data structures
	   @{ */

		/** 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.
		  */
		struct TOPO_IMPEXP TCoords
		{
			// Only keep one of the possible representations:
			double decimal_value; //!< Also obtained directly through the double(void) operator using a TCoords anywhere were a double is expected.

			inline TCoords( const int _deg, const int _min, const double _sec ) { setDegMinSec(_deg,_min,_sec); }
			inline TCoords( const double dec ) { setFromDecimal(dec); }

			/** Automatic conversion to a double value (read-only) */
			inline operator double(void) const { return decimal_value; }

			/** Automatic conversion to a double value (read-only) */
			inline operator double& (void) { return decimal_value; }

			/** Set from a decimal value (XX.YYYYY) in degrees. */
			inline void setFromDecimal( const double dec ) { decimal_value = dec; }

			/** Get the decimal value (XX.YYYYY), in degrees - you can also use the automatic conversion between TCoords and a double.  */
			inline double getDecimalValue() const { return decimal_value; }

			/** Return the Deg Min' Sec'' representation of this value. */
			inline void getDegMinSec( int &degrees, int &minutes, double &seconds) const
			{
				double aux = std::abs(decimal_value);
				degrees = (int)aux;
				minutes = (int)((aux - degrees)*60.0f);
				seconds = ((aux - degrees)*60.0f - minutes)*60.0f;
				if( decimal_value<0 ) degrees = -degrees;
			}

			/** Set the coordinate from its Deg Min' Deg'' parts. */
			inline void setDegMinSec(const int degrees, const int minutes, const double seconds)
			{
				decimal_value = std::abs(degrees)+minutes/60.0+seconds/3600.0;
				if(degrees<0)  decimal_value  = - decimal_value;
			}

			/** Return a string in the format "DEGdeg MIN' SEC''" */
			inline std::string getAsString() const
			{
				int deg,min;
				double sec;
				getDegMinSec( deg,min,sec);
				return mrpt::format("%ddeg %d' %.010f''",deg,min,sec );
			}

		};

		bool TOPO_IMPEXP operator ==(const TCoords &a, const TCoords &o);
		bool TOPO_IMPEXP operator !=(const TCoords &a, const TCoords &o);
		
		std::ostream TOPO_IMPEXP & operator<<( std::ostream& out, const TCoords &o );

		struct TOPO_IMPEXP TEllipsoid
		{
			inline TEllipsoid() : sa( 6378137.0 ), sb( 6356752.314245 ), name("WGS84") {}
			inline TEllipsoid( const double _sa, const double _sb, const string _name ) : sa(_sa), sb(_sb), name(_name) {}

			double sa;		//!< largest semiaxis of the reference ellipsoid (in meters)
			double sb;		//!< smallest semiaxis of the reference ellipsoid (in meters)
			string name;	//!< the ellipsoid name


			static inline TEllipsoid Ellipsoid_WGS84() {					return TEllipsoid( 6378137.000, 6356752.314245, "WGS84" ); }
			static inline TEllipsoid Ellipsoid_WGS72() {					return TEllipsoid( 6378135.000, 6356750.519915, "WGS72"  ); }
			static inline TEllipsoid Ellipsoid_WGS66() {					return TEllipsoid( 6378145.000, 6356759.769356, "WGS66"  ); }
			static inline TEllipsoid Ellipsoid_Walbeck_1817() {			return TEllipsoid( 6376896.000, 6355834.846700, "Walbeck_1817"  ); }
			static inline TEllipsoid Ellipsoid_Sudamericano_1969() {		return TEllipsoid( 6378160.000, 6356774.720000, "Sudamericano_1969"  ); }
			static inline TEllipsoid Ellipsoid_Nuevo_Internacional_1967() {return TEllipsoid( 6378157.500, 6356772.200000, "Nuevo_Internacional_1967"  ); }<commit_msg>added missing default constructor for TCoords<commit_after>/* +---------------------------------------------------------------------------+
   |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |
   |                                                                           |
   |                   http://mrpt.sourceforge.net/                            |
   |                                                                           |
   |   Copyright (C) 2005-2010  University of Malaga                           |
   |                                                                           |
   |    This software was written by the Machine Perception and Intelligent    |
   |      Robotics Lab, University of Malaga (Spain).                          |
   |    Contact: <NAME>  <<EMAIL>>                     |
   |                                                                           |
   |  This file is part of the MRPT project.                                   |
   |                                                                           |
   |     MRPT is free software: you can redistribute it and/or modify          |
   |     it under the terms of the GNU General Public License as published by  |
   |     the Free Software Foundation, either version 3 of the License, or     |
   |     (at your option) any later version.                                   |
   |                                                                           |
   |   MRPT is distributed in the hope that it will be useful,                 |
   |     but WITHOUT ANY WARRANTY; without even the implied warranty of        |
   |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |
   |     GNU General Public License for more details.                          |
   |                                                                           |
   |     You should have received a copy of the GNU General Public License     |
   |     along with MRPT.  If not, see <http://www.gnu.org/licenses/>.         |
   |                                                                           |
   +---------------------------------------------------------------------------+ */
#ifndef  data_types_H
#define  data_types_H

#include <mrpt/utils/utils_defs.h>
#include <mrpt/math/lightweight_geom_data.h>

#include <mrpt/topography/link_pragmas.h>

namespace mrpt
{
	namespace topography
	{
		using namespace std;
		using namespace mrpt::utils;


	/** =======================================================================
	   @name Data structures
	   @{ */

		/** 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.
		  */
		struct TOPO_IMPEXP TCoords
		{
			// Only keep one of the possible representations:
			double decimal_value; //!< Also obtained directly through the double(void) operator using a TCoords anywhere were a double is expected.

			inline TCoords( const int _deg, const int _min, const double _sec ) { setDegMinSec(_deg,_min,_sec); }
			inline TCoords( const double dec ) { setFromDecimal(dec); }
			inline TCoords() { setFromDecimal(0); }

			/** Automatic conversion to a double value (read-only) */
			inline operator double(void) const { return decimal_value; }

			/** Automatic conversion to a double value (read-only) */
			inline operator double& (void) { return decimal_value; }

			/** Set from a decimal value (XX.YYYYY) in degrees. */
			inline void setFromDecimal( const double dec ) { decimal_value = dec; }

			/** Get the decimal value (XX.YYYYY), in degrees - you can also use the automatic conversion between TCoords and a double.  */
			inline double getDecimalValue() const { return decimal_value; }

			/** Return the Deg Min' Sec'' representation of this value. */
			inline void getDegMinSec( int &degrees, int &minutes, double &seconds) const
			{
				double aux = std::abs(decimal_value);
				degrees = (int)aux;
				minutes = (int)((aux - degrees)*60.0f);
				seconds = ((aux - degrees)*60.0f - minutes)*60.0f;
				if( decimal_value<0 ) degrees = -degrees;
			}

			/** Set the coordinate from its Deg Min' Deg'' parts. */
			inline void setDegMinSec(const int degrees, const int minutes, const double seconds)
			{
				decimal_value = std::abs(degrees)+minutes/60.0+seconds/3600.0;
				if(degrees<0)  decimal_value  = - decimal_value;
			}

			/** Return a string in the format "DEGdeg MIN' SEC''" */
			inline std::string getAsString() const
			{
				int deg,min;
				double sec;
				getDegMinSec( deg,min,sec);
				return mrpt::format("%ddeg %d' %.010f''",deg,min,sec );
			}

		};

		bool TOPO_IMPEXP operator ==(const TCoords &a, const TCoords &o);
		bool TOPO_IMPEXP operator !=(const TCoords &a, const TCoords &o);

		std::ostream TOPO_IMPEXP & operator<<( std::ostream& out, const TCoords &o );

		struct TOPO_IMPEXP TEllipsoid
		{
			inline TEllipsoid() : sa( 6378137.0 ), sb( 6356752.314245 ), name("WGS84") {}
			inline TEllipsoid( const double _sa, const double _sb, const string _name ) : sa(_sa), sb(_sb), name(_name) {}

			double sa;		//!< largest semiaxis of the reference ellipsoid (in meters)
			double sb;		//!< smallest semiaxis of the reference ellipsoid (in meters)
			string name;	//!< the ellipsoid name


			static inline TEllipsoid Ellipsoid_WGS84() {					return TEllipsoid( 6378137.000, 6356752.314245, "WGS84" ); }
			static inline TEllipsoid Ellipsoid_WGS72() {					return TEllipsoid( 6378135.000, 6356750.519915, "WGS72"  ); }
			static inline TEllipsoid Ellipsoid_WGS66() {					return TEllipsoid( 6378145.000, 6356759.769356, "WGS66"  ); }
			static inline TEllipsoid Ellipsoid_Walbeck_1817() {			return TEllipsoid( 6376896.000, 6355834.846700, "Walbeck_1817"  ); }
			static inline TEllipsoid Ellipsoid_Sudamericano_1969() {		return TEllipsoid( 6378160.000, 6356774.720000, "Sudamericano_1969"  ); }
			static inline TEllipsoid Ellipsoid_Nuevo_Internacional_1967() {return TEllipsoid( 6378157.500, 6356772.200000, "Nuevo_Internacional_1967"  ); }
{'fraction_non_alphanumeric': 0.12629571274566714, 'fraction_numerical': 0.03789700638527241, 'mean_word_length': 1.7903748264692272, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 52, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2886178', 'n_tokens_mistral': 3971, 'n_tokens_neox': 3306, 'n_words': 1028}