⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 latlong.cpp

📁 This is a GPS communication source code to interrupt the NMEA code though serial port. Very good
💻 CPP
字号:
#include "nmea0183.h"
#pragma hdrstop

/*
** Author: Samuel R. Blackburn
** Internet: sam_blackburn@pobox.com
**
** You can use it any way you like as long as you don't try to sell it.
**
** Copyright, 1996, Samuel R. Blackburn
**
** $Workfile: latlong.cpp $
** $Revision: 5 $
** $Modtime: 10/13/98 6:39a $
*/

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

LATLONG::LATLONG()
{
   Empty();
}

LATLONG::~LATLONG()
{
   Empty();
}

void LATLONG::Empty( void )
{
   Latitude.Empty();
   Longitude.Empty();
}

BOOL LATLONG::Parse( int LatitudePositionFieldNumber, int NorthingFieldNumber, int LongitudePositionFieldNumber, int EastingFieldNumber, const SENTENCE& LineToParse )
{
   Latitude.Parse(  LatitudePositionFieldNumber, NorthingFieldNumber, LineToParse );
   Longitude.Parse( LongitudePositionFieldNumber, EastingFieldNumber, LineToParse );

   if ( Latitude.IsDataValid() && Longitude.IsDataValid() )
   {
      return( TRUE );
   }
   else
   {
      return( FALSE );
   }
}

CString LATLONG::PlainEnglish( void ) const
{
   CString return_string;

   return_string.Format( "Latitude %d %8.5lf", Latitude.GetWholeDegrees(), Latitude.GetDecimalMinutes() );

   if ( Latitude.Northing == North )
   {
      return_string += " North, Longitude ";
   }
   else
   {
      return_string += " South, Longitude ";
   }

   char temp_string[ 80 ];

   ::sprintf( temp_string, "%d %8.5lf", Longitude.GetWholeDegrees(), Longitude.GetDecimalMinutes() );

   return_string += temp_string;

   if ( Longitude.Easting == East )
   {
      return_string += " East";
   }
   else
   {
      return_string += " West";
   }

   return( return_string );
}

void LATLONG::Write( SENTENCE& sentence )
{
   Latitude.Write( sentence );
   Longitude.Write( sentence );
}

const LATLONG& LATLONG::operator = ( const LATLONG& source )
{
   Latitude  = source.Latitude;
   Longitude = source.Longitude;

   return( *this );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -