Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

Spatial Reference Model (SRM) C++ API

Version 4.1

Introduction

This is the documentation for the SRM C++ API.

The SRM classes provide the following functionality:

A sample program to convert a Celestiodetic 3D coordinate to a Celestiocentric 3D coordinate is as follows:

#include "BaseSRF.h"
#include "srf_all.h"
#include "Exception.h"
#include <iostream>

using namespace std;

int main (int argc, char* argv[])
{
  cout << "Running SRM Sample test program... \n" << endl;
  
  srm::SRF_Celestiocentric* CC_SRF;
  srm::SRF_Celestiodetic* CD_SRF;

  try {
    // create CC and CD SRFs
    CC_SRF = srm::SRF_Celestiocentric::create( SRM_ORMCOD_WGS_1984, SRM_RTCOD_WGS_1984_IDENTITY );
    
    CD_SRF = srm::SRF_Celestiodetic::create( SRM_ORMCOD_WGS_1984, SRM_RTCOD_WGS_1984_IDENTITY );
    
    cout << "Source Celestiodetic SRF parameters: " << endl;
    cout << CD_SRF->toString() << endl;
    cout << "Target Celestiocentric SRF parameters: " << endl;
    cout << CC_SRF->toString() << endl;
  } catch ( srm::Exception( ex) ) {
    cout << "Caught an exception=> " << ex.getWhat() << endl;
    return 0;
  }

  // create CD and CC 3D coordinate
  srm::Coord3D_Celestiodetic CD_Coord( CD_SRF, 0.0, 0.785398163397, 0.0 );
  srm::Coord3D_Celestiocentric CC_Coord( CC_SRF );

  // Convert from CD SRF to CC SRF
  try { 
    CC_SRF->changeCoordinate3DSRF( CD_Coord, CC_Coord );
    
    cout << "Executed changeCoordinate3DSRF" << endl;    
  } 
  catch ( srm::Exception& ex) {
    cout << "Caught an exception=> " << ex.getWhat() << endl;
    return 0;
  }

  // Print Celestiocentric coordinate values
  cout << "Source Celestiodetic 3D coordinate: "
       << "[ " << CD_Coord.get_longitude() << ", " << CD_Coord.get_latitude() 
       << ", " << CD_Coord.get_ellipsoidal_height() << " ]" << endl;
  cout << "Target (converted) Celestiocentric 3D coordinate: "
       << "[ " << CC_Coord.get_u() << ", " << CC_Coord.get_v() 
       << ", " << CC_Coord.get_w() << " ]" << endl << endl;

  // Free SRFs
  CC_SRF->release();
  cout << "Released CC SRF" << endl;
  CD_SRF->release();
  cout << "Released CD SRF" << endl;

  return 0;
}

Running the sample program above will produce the output as follows:

Running SRM Sample test program... 

Source Celestiodetic SRF parameters: 
orm=> 250
rt=> 341

Target Celestiocentric SRF parameters:
orm=> 250
rt=> 341

Executed changeCoordinate3DSRF
Source Celestiodetic 3D coordinate: [ 0, 0.785398, 0 ]
Target (converted) Celestiocentric 3D coordinate: [ 4.51759e+06, 0, 4.48735e+06 ]

Released CC SRF
Released CD SRF

Spatial Reference Model C++ API Version 4.1 - 26 Jun 2006
Copyright © 2006 SEDRIS Docs by Doxygen 1.3.2