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

📄 lat.cpp

📁 GPS的协议为NMEA0183
💻 CPP
字号:
#include "nmea0183.h"
#pragma hdrstop

/*
** Author: Samuel R. Blackburn
** CI$: 76300,326
** Internet: sammy@sed.csc.com
**
** You can use it any way you like.
*/

IMPLEMENT_DYNAMIC( LATITUDE, CObject );

LATITUDE::LATITUDE()
{
   Empty();
}

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

void LATITUDE::Empty( void )
{
   ASSERT_VALID( this );

   Latitude = 0.0;
   Northing = NS_Unknown;
}

BOOL LATITUDE::IsDataValid( void )
{
   if ( Northing != North && Northing != South )
   {
      return( FALSE );
   }

   return( TRUE );
}

void LATITUDE::Parse( int position_field_number, int north_or_south_field_number, const SENTENCE& sentence )
{
   ASSERT_VALID( this );
   Set( sentence.Double( position_field_number ), sentence.Field( north_or_south_field_number ) );
}

void LATITUDE::Set( double position, const char *north_or_south )
{
   ASSERT_VALID( this );
   ASSERT( north_or_south != NULL );

   Latitude = position;
   
   if ( north_or_south[ 0 ] == 'N' )
   {
      Northing = North;
   }
   else if ( north_or_south[ 0 ] == 'S' )
   {
      Northing = South;
   }
   else
   {
      Northing = NS_Unknown;
   }
}

void LATITUDE::Write( SENTENCE& sentence )
{
   ASSERT_VALID( this );

   char temp_string[ 80 ];

   sprintf( temp_string, "%.f,", Latitude );
   sentence += temp_string;
   
   if ( Northing == North )
   {
      sentence += "N";
   }
   else if ( Northing == South )
   {
      sentence += "S";
   }
   else
   {
      /*
      ** Add Nothing
      */
   }
}

const LATITUDE& LATITUDE::operator = ( const LATITUDE& source )
{
   ASSERT_VALID( this );

   Latitude = source.Latitude;
   Northing = source.Northing;

   return( *this );
}

⌨️ 快捷键说明

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