Code Search for Developers
 
 
  

UTMReference.java from GridBlocks at Krugle


Show UTMReference.java syntax highlighted

//-----------------------------------------------------------------------------
// UTMReference.java
//
// (c) 2004 Jonathan Stott
//
// Created on 02-Mar-2004
//
// 0.2 - 02 Mar 2004
//  - Initial version
//-----------------------------------------------------------------------------

package fi.hip.gb.bluetooth.coordconv;

/**
 * An object to represent an UTM reference
 * 
 * @author Jonathan Stott
 * @version 0.2
 * @since 0.2
 */
public class UTMReference {
  private double easting = 0.0;
  private double northing = 0.0;
  private char latitudeZone = 'Z';
  private int longitudeZone = 0;
  
  /**
   * Create a new UTMReference object with an easting, northing and zones
   * 
   * @param inEasting
   * @param inNorthing
   * @param inLatitudeZone
   * @param inLongitudeZone
   */
  public UTMReference(double inEasting,
                      double inNorthing,
                      char inLatitudeZone,
                      int inLongitudeZone) {
    setEasting(inEasting);
    setNorthing(inNorthing);
    setLatitudeZone(inLatitudeZone);
    setLongitudeZone(inLongitudeZone);
  }
  
  
  /**
   * Return a String representation of the UTMReference object 
   * 
   * @see java.lang.Object#toString()
   */
  public String toString() {
    return getLongitudeZone() + Character.toString(getLatitudeZone()) + 
           " " + getEasting() + " " + getNorthing();
  }


  /**
   * Get the easting component of the reference
   * 
   * @return
   */
  public double getEasting() {
    return easting;
  }


  /**
   * Get the northing component of the reference
   * 
   * @return
   */
  public double getNorthing() {
    return northing;
  }
  

  /**
   * Get the latitude zone of the reference
   * 
   * @return
   */
  public char getLatitudeZone() {
    return latitudeZone;
  }
  
  
  /**
   * Get the longitude zone of the reference 
   * 
   * @return
   */
  public int getLongitudeZone() {
    return longitudeZone;
  }
  

  /**
   * Set the easting component of the reference
   * 
   * @param d
   */
  public void setEasting(double d) {
    easting = d;
  }


  /**
   * Set the northing component of the reference
   * 
   * @param d
   */
  public void setNorthing(double d) {
    northing = d;
  }


  /**
   * Set the latitude zone of the reference
   * 
   * @param inZone
   */
  public void setLatitudeZone(char inZone) {
    if (inZone < 'C' || inZone > 'X') {
      throw new IllegalArgumentException("Latitude zone must be from 'C' " +
                                         "through 'X'");
    }
    
    latitudeZone = inZone;
  }
  
  
  /**
   * Set the longitude zone of the reference 
   * 
   * @param inZone
   */
  public void setLongitudeZone(int inZone) {
    if (inZone < 1 || inZone > 60) {
      throw new IllegalArgumentException("Longitude zone must be from 1 " +
                                         "through 60");
    }
    
    longitudeZone = inZone;
  }
}




See more files for this project here

GridBlocks

GridBlocks builds a grid application framework via easy-to-use building blocks in distributed environment. The framework offers components for Grid security, distributed storage, computing, and Portlet web interfaces.

Project homepage: http://sourceforge.net/projects/gridblocks
Programming language(s): Java,JSP,XML
License: other

  GridReferenceConverter.java
  ReferenceEllipsoid.java
  ReferenceEllipsoids.java
  UTMReference.java