uk.me.jstott.jcoord
Class IrishRef

java.lang.Object
  extended by uk.me.jstott.jcoord.CoordinateSystem
      extended by uk.me.jstott.jcoord.IrishRef

public class IrishRef
extends CoordinateSystem

This class is part of the Jcoord package. Visit the Jcoord website for more information.

Class to represent an Irish National Grid reference.

Irish National Grid

(c) 2006 Jonathan Stott

Created on 11-02-2006

Since:
1.1
Version:
1.1
Author:
Jonathan Stott

Field Summary
static double FALSE_ORIGIN_EASTING
           
static double FALSE_ORIGIN_LATITUDE
           
static double FALSE_ORIGIN_LONGITUDE
           
static double FALSE_ORIGIN_NORTHING
           
static double SCALE_FACTOR
           
 
Constructor Summary
IrishRef(double easting, double northing)
          Create a new Ordnance Survey grid reference using a given easting and northing.
IrishRef(LatLng ll)
          Create an IrishRef object from the given latitude and longitude.
IrishRef(java.lang.String ref)
          Take a string formatted as a six-figure OS grid reference (e.g.
 
Method Summary
 double getEasting()
          Get the easting in metres relative the origin of the British National Grid.
 double getNorthing()
          Get the northing in metres relative to the origin of the British National Grid.
 void setEasting(double easting)
          Set the easting for this OSRef.
 void setNorthing(double northing)
          Set the northing for this OSRef
 LatLng toLatLng()
          Convert this Irish grid reference to a latitude/longitude pair using the Ireland 1965 datum.
 java.lang.String toSixFigureString()
          Return a String representation of this Irish grid reference using the six-figure notation in the form X123456
 java.lang.String toString()
          Return a String representation of this Irish grid reference showing the easting and northing in metres.
 
Methods inherited from class uk.me.jstott.jcoord.CoordinateSystem
getDatum, setDatum
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SCALE_FACTOR

public static final double SCALE_FACTOR
See Also:
Constant Field Values

FALSE_ORIGIN_LATITUDE

public static final double FALSE_ORIGIN_LATITUDE
See Also:
Constant Field Values

FALSE_ORIGIN_LONGITUDE

public static final double FALSE_ORIGIN_LONGITUDE
See Also:
Constant Field Values

FALSE_ORIGIN_EASTING

public static final double FALSE_ORIGIN_EASTING
See Also:
Constant Field Values

FALSE_ORIGIN_NORTHING

public static final double FALSE_ORIGIN_NORTHING
See Also:
Constant Field Values
Constructor Detail

IrishRef

public IrishRef(double easting,
                double northing)
         throws java.lang.IllegalArgumentException
Create a new Ordnance Survey grid reference using a given easting and northing. The easting and northing must be in metres and must be relative to the origin of the British National Grid.

Parameters:
easting - the easting in metres. Must be greater than or equal to 0.0 and less than 800000.0.
northing - the northing in metres. Must be greater than or equal to 0.0 and less than 1400000.0.
Throws:
java.lang.IllegalArgumentException - if either the easting or the northing are invalid.
Since:
1.1

IrishRef

public IrishRef(java.lang.String ref)
         throws java.lang.IllegalArgumentException
Take a string formatted as a six-figure OS grid reference (e.g. "TG514131") and create a new OSRef object that represents that grid reference. The first character must be H, N, S, O or T. The second character can be any uppercase character from A through Z excluding I.

Parameters:
ref - a String representing a six-figure Ordnance Survey grid reference in the form XY123456
Throws:
java.lang.IllegalArgumentException - if ref is not of the form XY123456
Since:
1.1

IrishRef

public IrishRef(LatLng ll)
Create an IrishRef object from the given latitude and longitude.

Since:
1.1
Method Detail

toString

public java.lang.String toString()
Return a String representation of this Irish grid reference showing the easting and northing in metres.

Overrides:
toString in class java.lang.Object
Returns:
a String represenation of this Irish grid reference
Since:
1.1

toSixFigureString

public java.lang.String toSixFigureString()
Return a String representation of this Irish grid reference using the six-figure notation in the form X123456

Returns:
a String representing this Irish grid reference in six-figure notation
Since:
1.0

toLatLng

public LatLng toLatLng()
Convert this Irish grid reference to a latitude/longitude pair using the Ireland 1965 datum. Note that, the LatLng object may need to be converted to the WGS84 datum depending on the application.

Specified by:
toLatLng in class CoordinateSystem
Returns:
a LatLng object representing this Irish grid reference using the Ireland 1965 datum
Since:
1.1

getEasting

public double getEasting()
Get the easting in metres relative the origin of the British National Grid.

Returns:
the easting in metres.
Since:
1.1

getNorthing

public double getNorthing()
Get the northing in metres relative to the origin of the British National Grid.

Returns:
the northing in metres.
Since:
1.1

setEasting

public void setEasting(double easting)
                throws java.lang.IllegalArgumentException
Set the easting for this OSRef.

Parameters:
easting - the easting in metres. Must be greater than or equal to 0.0 and less than 400000.0.
Throws:
java.lang.IllegalArgumentException - if the easting is invalid.
Since:
1.1

setNorthing

public void setNorthing(double northing)
                 throws java.lang.IllegalArgumentException
Set the northing for this OSRef

Parameters:
northing - the northing in metres. Must be greater than or equal to 0.0 and less than or equal to 500000.0.
Throws:
java.lang.IllegalArgumentException - if either the northing is invalid.
Since:
1.1