/*======================== MiscIrelandOldUTMCoord.m =========================*/
/* MiscIrelandOldUTMCoord class contains and supports values representing
   locations in an Irish Universal Transverse Mercator coordinate system
   using the airy constants of 1953.

   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
26-Mar-93  Dale Amon at GPL
	   Subsumed IrishGridOldUTMConstants class into this one.

21-Mar-93  Dale Amon at GPL
	   Created.
*/

#import <MiscFoundation/MiscIrelandOldUTMCoord.h>
#import "_MiscError.h"

@implementation MiscIrelandOldUTMCoord

/*===========================================================================*/
/* Internal methods */
/*===========================================================================*/
/* note that we override values because the document for the Irish grid
   has values which do not match the ones calculated from their own formulae
   and constants:

                eSqrd                   n
	calculated	0.006670540605897831814	0.001673220462817007959
	book		0.00667054015           0.001673220462
*/

static id theOldIrishGrid = nil;

+ makeGrid
  {
    if (!theOldIrishGrid)
	{theOldIrishGrid = [[MiscUTMConstants allocWithZone:[self zone]]
		       initGridName: @"Old Irish Grid"
			 trueOrigin: 53.5 : -8.0
			     inGrid: 200000.0    : 250000.0
			   onSphere: 6377340.189 : 6356034.446
	     centralMeridianScaling: 1.000035];

	 [theOldIrishGrid override_eSqrd: 0.00667054015 n: 0.001673220462];
	 [theOldIrishGrid setProtected];
	}
    return theOldIrishGrid;
  }


/*===========================================================================*/
/* Initialization methods. If we don't already have a UTM constants object
   for the Old Irish Grid, create one instance that all will share and that
   cannot be deleted.

   Values are from the Irish Ordinance Survey document, "Tables for the
   Transverse Mercator Projection of Ireland", 1953, reprinted 1971.

*/
/*===========================================================================*/
/* DESIGNATED INITIALIZER */

-initDescription: (NSString *) txt
 {
    [super initDescription: txt constants: [MiscIrelandOldUTMCoord makeGrid]];

    /* over ride the standard converter */
    converter = [MiscIrelandCoordConverter new];
    return self;
 }


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

-initDescription: (NSString *) txt constants: anObject
{
	MISC_ERROR_BAIL;
	return self;
 }


/*===========================================================================*/
/* Archive methods */
/*===========================================================================*/
- initWithCoder:(NSCoder *)aCoder
{	self = [super initWithCoder:aCoder];
	[constants setUnprotected];
	[constants release];
	[MiscIrelandOldUTMCoord makeGrid];
	return self;
}

@end
