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

Spatial Reference Model (SRM) C API

Version: 4.4

Introduction

This is the documentation for the SRM C API.

The SRM C API provides the following functionality:

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

#include <stdio.h>
#include <string.h>

#include "srm.h"


int main
(
    int   argc,
    char *argv[]
)
{
    SRM_Coordinate_Valid_Region val_region;

    SRM_Celestiocentric cc_srf;
    SRM_Celestiodetic   cd_srf;
    SRM_Coordinate3D    cc_coord;
    SRM_Coordinate3D    cd_coord;
    SRM_Long_Float      ord1,ord2,ord3;

    printf( "Running SRM Sample test program...\n" );

    if (SRM_CD_Create(SRM_ORMCOD_WGS_1984,
                      SRM_RTCOD_WGS_1984_IDENTITY,
                      &cd_srf) != SRM_STATCOD_SUCCESS)
        fprintf( stderr, "Failed to create CD SRF\n" );
    else
    {
        if (SRM_CC_Create(SRM_ORMCOD_WGS_1984,
                          SRM_RTCOD_WGS_1984_IDENTITY,
                          &cc_srf ) != SRM_STATCOD_SUCCESS )
            fprintf( stderr, "Failed to create CC SRF\n" );
        else
        {
            if ( cd_srf.methods->CreateCoordinate3D( &cd_srf,
                                                    0.0,
                                                    0.785398163397,
                                                    0.0,
                                                   &cd_coord ) != SRM_STATCOD_SUCCESS )
                fprintf( stderr, "Failed to create CD coordinate\n" );
            else
            {
                if ( cc_srf.methods->CreateCoordinate3D( &cc_srf,
                                                        0.0,
                                                        0.0,
                                                        0.0,
                                                        &cc_coord ) != SRM_STATCOD_SUCCESS )
                    fprintf( stderr, "Failed to create CC coordinate\n" );
                else
                {
                    if ( cc_srf.methods->ChangeCoordinate3DSRF( &cc_srf,
                                                                &cd_srf,
                                                                &cd_coord,
                                                                &cc_coord,
                                                                &val_region)
                         != SRM_STATCOD_SUCCESS )
                        fprintf( stderr, "SRM_ChangeCoordinateSRF failed\n" );
                    else
                    {
                        if ( cc_srf.methods->GetCoordinate3DValues( &cc_srf,
                                                                    &cc_coord,
                                                                    &ord1,
                                                                    &ord2,
                                                                    &ord3 ) != SRM_STATCOD_SUCCESS )
                            fprintf( stderr, "Failed getting the CC coordinate values\n" );

                        else
                            printf("[ %lf, %lf, %lf ]\n\n", ord1, ord2, ord3 );
                    }
                    cc_srf.methods->DestroyCoordinate3D(&cc_srf,
                                                        &cc_coord);
                }
                cd_srf.methods->DestroyCoordinate3D(&cd_srf,
                                                    &cd_coord);
            }
            cc_srf.methods->Destroy(&cc_srf);
        }
        cd_srf.methods->Destroy(&cd_srf);
    }
    return 0;
}

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

Running SRM Sample test program...
[ 4517590.878846, 0.000000, 4487348.408859 ]

C API Version: 4.4 - December 7, 2009
Copyright © 2009 SEDRIS Docs by Doxygen 1.3.2