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

Spatial Reference Model (SRM) Java API

Version 4.0.0

Introduction

This is the documentation for the SRM Java API.

All classes in this API are in the SRM package.

The SRM classes provide the following functionality:

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

import SRM.*;

public class CdToCcConv
{ 

    public static void main (String args[]) 
    {   
    System.out.println( "*** Sample program using SRM Java API to convert a 3D coordinate" );
    System.out.println( "*** from a Celestiodetic SRF to a Celestiocentric SRF." );
    
    // Declare reference variables for the CD and CC SRFs
    SRF_Celestiodetic CdSrf = null;
    SRF_Celestiodetic CdSrf1 = null;
    SRF_Celestiocentric CcSrf = null;

    try {
        
        // Create a Celestiodetic SRF with WGS 1984 and Identity transformation
        CdSrf = new SRF_Celestiodetic(SRM_ORM_Code.ORM_WGS_1984,
                          SRM_HSR_Code.HSR_WGS_1984_IDENTITY);

        // Create a Celesticentric SRF with WGS 1984 and Identity transformation
        CcSrf = new SRF_Celestiocentric(SRM_ORM_Code.ORM_WGS_1984,
                        SRM_HSR_Code.HSR_WGS_1984_IDENTITY);

        // Create a 3D Celestiodetic coordinate with 
        // longitude           => 10.0 degrees (note: this input parameter is converted to radians)
        // latitude            => 20.0 degrees (note: this input parameter is converted to radians)
        // ellipsopidal height => 100.0 meters
        Coord3D_Celestiodetic CdCoord = 
        (Coord3D_Celestiodetic)CdSrf.createCoordinate3D(Math.toRadians(10.0),
                                Math.toRadians(20.0),
                                100.0);

        // Instantiate a 3D Celestiocentric coordinate
        // This is an alternative method for instantiate a 3D coordinate
        Coord3D_Celestiocentric CcCoord = new Coord3D_Celestiocentric( CcSrf );
    
        // print out the SRF parameter calues and the coordinate component values
        System.out.println("CdSrf parameter =>  \n" + CdSrf);
        System.out.println("CcSrf parameter =>  \n" + CcSrf);
        System.out.println("CdCoord components (source) => \n" + CdCoord);

        // convert the 3D Celestiodetic coordinate to 3D Celestiocentric coordinate
        SRM_Coordinate_Valid_Region_Code valRegion = 
        CcSrf.changeCoordinateSRF( CdCoord, CcCoord );
    
        // print out the values of the resulting 3D Celestiocentric coordinate
        System.out.println("CcCoord components (destination) => \n" + CcCoord + " is " + valRegion );

    }
    catch (SrmException ex) {
        // catch SrmException and print out the error code and text.
        System.out.println("Exception caught=> " + ex.what() + ", " + ex);
    }
    
    }
}

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

*** Sample program using SRM Java API to convert a 3D coordinate
*** from a Celestiodetic SRF to a Celestiocentric SRF.
CdSrf parameter =>
orm: WGS_1984
hsr: WGS_1984_IDENTITY
CcSrf parameter =>
orm: WGS_1984
hsr: WGS_1984_IDENTITY
CdCoord components (source) =>
[ 0.17453292519943295, 0.3490658503988659, 100.0 ]
CcCoord components (destination) =>
[ 5904838.698311626, 1041182.3792437915, 2167730.9898430835 ] is VALID

Spatial Reference Model Java API Version 4.0.0 - 29 Jul 2004
Copyright © 2004 SEDRIS Docs by Doxygen 1.3.2