ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Source/MiscGISKit/MiscWorldCoord.m

This is MiscWorldCoord.m in view mode; [Download] [Up]

/*=========================== MiscWorldCoord.m ==============================*/
/* MiscWorldCoord class contains and supports values representing locations
   in a World coordinate system. Angles are stored internally as radians
   at all times, but may be stored or retrieved as degrees.

   It uses the instance of MiscPlanetCoordConverter for converting to other
   coordinate systems.

   DMA Release 0.8, Copyright @1993 by Genesis Project, Ltd. All Rights
   Reserved. For further information on terms and conditions see:
		Documentation/GISKit/Agreements-Legal-README

HISTORY
25-Feb-93  Dale Amon at GPL
	   Created.
*/

#import <misckit/miscgiskit.h>

@implementation MiscWorldCoord

/*===========================================================================*/
/* Initialization methods */
/*===========================================================================*/
/* DESIGNATED INITIALIZER */

-initDescription: (char *) txt constants: anObject
 {
	[super initDescription: txt
		     converter: [MiscPlanetCoordConverter new]
		     constants: anObject];
	return self;
 }

/*---------------------------------------------------------------------------*/
/* Block the designated initializer of our parent class */

-initDescription: (char *) txt
       converter: (id <MiscCoordConverterServer>) aConverter
       constants: anObject
 {	[self error:"  %s class should not be sent '%s' messages\n",
            [[self class] name], sel_getName(_cmd)];
	return self;
 }


/*===========================================================================*/
/* Coordinate handling methods */
/*===========================================================================*/
/* set World Coord value from radians */

-setCoordLatitudeRadians: (double) lat
        longitudeRadians: (double) lon
	        altitude: (double) alt
 {	[self setCoord: lat : lon : alt];
	return self;
 }

/*---------------------------------------------------------------------------*/
/* set World Coord value from degrees */

-setCoordLatitudeDegrees: (double) lat
        longitudeDegrees: (double) lon
	        altitude: (double) alt
 {	[self setCoord: [MiscCoord degreesToRadians: lat]
		      : [MiscCoord degreesToRadians: lon]
		      : alt];

	return self;
 }

/*---------------------------------------------------------------------------*/
//* Get World Coord value in radians */

-coordLatitudeRadians: (double *) lat
     longitudeRadians: (double *) lon
	     altitude: (double *) alt
 {	[self coord: lat : lon : alt];
	return self;
 }

/*---------------------------------------------------------------------------*/
/* Get World Coord value in degrees */

-coordLatitudeDegrees: (double *) lat
     longitudeDegrees: (double *) lon
	     altitude: (double *) alt
 {	[self coord: lat : lon : alt];

	*lat = [MiscCoord degreesToRadians: *lat];
	*lon = [MiscCoord degreesToRadians: *lon];
	return self;
 }

/*---------------------------------------------------------------------------*/
/* World coordinates are: latitude, longitude and altitude */

-(double) latitudeRadians  {return [self coord1];}
-(double) latitudeDegrees  {return [MiscCoord radiansToDegrees: [self coord1]];}
-(double) longitudeRadians {return [self coord2];}
-(double) longitudeDegrees {return [MiscCoord radiansToDegrees: [self coord2]];}
-(double) altitude	   {return [self coord3];}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.