📄 long.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( LONGITUDE, CObject )
LONGITUDE::LONGITUDE()
{
Empty();
}
LONGITUDE::~LONGITUDE()
{
Empty();
}
void LONGITUDE::Empty( void )
{
ASSERT_VALID( this );
Longitude = 0.0;
Easting = EW_Unknown;
}
BOOL LONGITUDE::IsDataValid( void )
{
if ( Easting != East && Easting != West )
{
return( FALSE );
}
return( TRUE );
}
void LONGITUDE::Parse( int position_field_number, int east_or_west_field_number, const SENTENCE& sentence )
{
ASSERT_VALID( this );
Set( sentence.Double( position_field_number ), sentence.Field( east_or_west_field_number ) );
}
void LONGITUDE::Set( double position, const char *east_or_west )
{
ASSERT_VALID( this );
ASSERT( east_or_west != NULL );
Longitude = position;
if ( east_or_west[ 0 ] == 'E' )
{
Easting = East;
}
else if ( east_or_west[ 0 ] == 'W' )
{
Easting = West;
}
else
{
Easting = EW_Unknown;
}
}
void LONGITUDE::Write( SENTENCE& sentence )
{
ASSERT_VALID( this );
char temp_string[ 80 ];
sprintf( temp_string, "%.f,", Longitude );
sentence += temp_string;
if ( Easting == East )
{
sentence += "E";
}
else if ( Easting == West )
{
sentence += "W";
}
else
{
/*
** Add Nothing
*/
}
}
const LONGITUDE& LONGITUDE::operator = ( const LONGITUDE& source )
{
ASSERT_VALID( this );
Longitude = source.Longitude;
Easting = source.Easting;
return( *this );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -