www.pudn.com > gfc.tar > CEarthCoordinate.cpp
#include#pragma hdrstop #pragma hdrstop /* ** Author: Samuel R. Blackburn ** Internet: sblackbu@erols.com ** ** You can use it any way you like as long as you don't try to sell it. ** ** Any attempt to sell GFC in source code form must have the permission ** of the original author. You can produce commercial executables with ** GFC but you can't sell GFC. ** ** Copyright, 1998, Samuel R. Blackburn ** ** $Workfile: CEarthCoordinate.cpp $ ** $Revision: 4 $ ** $Modtime: 2/07/98 10:34a $ */ CEarthCoordinate::CEarthCoordinate( void ) { m_X_CoordinateInMeters = 0.0; m_Y_CoordinateInMeters = 0.0; m_Z_CoordinateInMeters = 0.0; } CEarthCoordinate::CEarthCoordinate( const CEarthCoordinate& source ) { Copy( source ); } CEarthCoordinate::~CEarthCoordinate( void ) { m_X_CoordinateInMeters = 0.0; m_Y_CoordinateInMeters = 0.0; m_Z_CoordinateInMeters = 0.0; } void CEarthCoordinate::Copy( const CEarthCoordinate& source ) { m_X_CoordinateInMeters = source.m_X_CoordinateInMeters; m_Y_CoordinateInMeters = source.m_Y_CoordinateInMeters; m_Z_CoordinateInMeters = source.m_Z_CoordinateInMeters; } void CEarthCoordinate::Get( double& x_coordinate, double& y_coordinate, double& z_coordinate ) const { x_coordinate = m_X_CoordinateInMeters; y_coordinate = m_Y_CoordinateInMeters; z_coordinate = m_Z_CoordinateInMeters; } double CEarthCoordinate::GetXCoordinateInMeters( void ) const { return( m_X_CoordinateInMeters ); } double CEarthCoordinate::GetYCoordinateInMeters( void ) const { return( m_Y_CoordinateInMeters ); } double CEarthCoordinate::GetZCoordinateInMeters( void ) const { return( m_Z_CoordinateInMeters ); } void CEarthCoordinate::Set( double x_coordinate, double y_coordinate, double z_coordinate ) { m_X_CoordinateInMeters = x_coordinate; m_Y_CoordinateInMeters = y_coordinate; m_Z_CoordinateInMeters = z_coordinate; } void CEarthCoordinate::SetXCoordinateInMeters( double x_coordinate ) { m_X_CoordinateInMeters = x_coordinate; } void CEarthCoordinate::SetYCoordinateInMeters( double y_coordinate ) { m_Y_CoordinateInMeters = y_coordinate; } void CEarthCoordinate::SetZCoordinateInMeters( double z_coordinate ) { m_Z_CoordinateInMeters = z_coordinate; } CEarthCoordinate& CEarthCoordinate::operator=( const CEarthCoordinate& source ) { Copy( source ); return( *this ); } #if 0 #endif GFC - CEarthCoordinate CEarthCoordinate
$Revision: 4 $
Description
This class encapsulates an Earth-Centered-Earth-Fixed coordinate. This is also known as a cartesian coordinate. It is made up of three distances all originating at the center of the Earth.Constructors
CEarthCoordinate() CEarthCoordinate( const CEarthCoordinate& source )- Constructs an empty coordinate or copies another CEarthCoordinate.
Methods
void Copy( const CEarthCoordinate& coordinate )- Copies the contents of another CEarthCoordinate.
void Get( double& x_coordinate, double& y_coordinate, double& z_coordinate )- This allows you to retrieve all the data members in one function call.
double GetXCoordinateInMeters( void ) const- This method returns the X axis coordinate in meters. Positive values point towards the intersection of the Prime Meridian and the Equator.
double GetYCoordinateInMeters( void ) const- This method returns the Y axis coordinate in meters. Positive values point towards the intersection of 90 degrees east of Prime Meridian and the Equator.
double GetZCoordinateInMeters( void ) const- This method returns the Z axis coordinate in meters. Positive values point towards the North Pole, negative values towards the South Pole.
void Set( double x_coordinate, double y_coordinate, double z_coordinate )- This lets you set all of the data members in a single function call.
void SetXCoordinateInMeters( double x_coordinate )- This method sets the X axis coordinate in meters.
void SetYCoordinateInMeters( double y_coordinate )- This method sets the Y axis coordinate in meters.
void SetZCoordinateInMeters( double z_coordinate )- This method sets the Z axis coordinate in meters.
Operators
= ( const CEarthCoordinate& source )- Basically calls Copy().
Example
Copyright, 1998, Samuel R. Blackburn#include <stdio.h> #include <GFC.h> #pragma hdrstop void main( void ) { CPolarCoordinate here; CEarthCoordinate there; // here is 39 degrees 12.152 minutes North Latitude, 76 degrees 46.795 minutes West Longitude here.SetUpDownAngleInDegrees( CMath::ConvertDegreesMinutesSecondsCoordinateToDecimalDegrees( 39.0, 12.152, 0.0 ) ); here.SetLeftRightAngleInDegrees( CMath::ConvertDegreesMinutesSecondsCoordinateToDecimalDegrees( -76.0, 46.795, 0.0 ) ); here.SetDistanceFromSurfaceInMeters( 1000.0 ); CEarth earth; earth.Convert( here, there ); }
$Workfile: CEarthCoordinate.cpp $
$Modtime: 2/07/98 10:34a $