source: pacpussensors/trunk/NMEA0183/src/LATLONG.cpp@ 80

Last change on this file since 80 was 59, checked in by DHERBOMEZ Gérald, 10 years ago

Integration of new modules:

  • GPS NMEA0183 decoder
  • Span CPT Decoder

Update of:

File size: 2.1 KB
Line 
1#include "nmea0183.h"
2#pragma hdrstop
3
4/*
5** Author: Samuel R. Blackburn
6** Internet: sam_blackburn@pobox.com
7**
8** You can use it any way you like as long as you don't try to sell it.
9**
10** Copyright, 1996, Samuel R. Blackburn
11**
12** $Workfile: latlong.cpp $
13** $Revision: 5 $
14** $Modtime: 10/13/98 6:39a $
15*/
16
17#ifdef _MSC_VER
18# pragma warning(disable:4996)
19#endif // _MSC_VER
20
21LATLONG::LATLONG()
22{
23 Empty();
24}
25
26LATLONG::~LATLONG()
27{
28 Empty();
29}
30
31void LATLONG::Empty( void )
32{
33 Latitude.Empty();
34 Longitude.Empty();
35}
36
37BOOL LATLONG::Parse( int LatitudePositionFieldNumber, int NorthingFieldNumber, int LongitudePositionFieldNumber, int EastingFieldNumber, const SENTENCE& LineToParse )
38{
39 Latitude.Parse( LatitudePositionFieldNumber, NorthingFieldNumber, LineToParse );
40 Longitude.Parse( LongitudePositionFieldNumber, EastingFieldNumber, LineToParse );
41
42 if ( Latitude.IsDataValid() && Longitude.IsDataValid() )
43 {
44 return( TRUE );
45 }
46 else
47 {
48 return( FALSE );
49 }
50}
51
52QString LATLONG::PlainEnglish( void ) const
53{
54 QString return_string;
55
56 //return_string.Format( "Latitude %d %8.5lf", Latitude.GetWholeDegrees(), Latitude.GetDecimalMinutes() );
57 return_string = "Latitude " + QString::number(Latitude.GetWholeDegrees()) + " " + QString::number(Latitude.GetDecimalMinutes());
58
59 if ( Latitude.Northing == North )
60 {
61 return_string += " North, Longitude ";
62 }
63 else
64 {
65 return_string += " South, Longitude ";
66 }
67
68 char temp_string[ 80 ];
69
70 ::sprintf( temp_string, "%d %8.5lf", Longitude.GetWholeDegrees(), Longitude.GetDecimalMinutes() );
71
72 return_string += temp_string;
73
74 if ( Longitude.Easting == East )
75 {
76 return_string += " East";
77 }
78 else
79 {
80 return_string += " West";
81 }
82
83 return( return_string );
84}
85
86void LATLONG::Write( SENTENCE& sentence )
87{
88 Latitude.Write( sentence );
89 Longitude.Write( sentence );
90}
91
92const LATLONG& LATLONG::operator = ( const LATLONG& source )
93{
94 Latitude = source.Latitude;
95 Longitude = source.Longitude;
96
97 return( *this );
98}
Note: See TracBrowser for help on using the repository browser.