uk.me.parabola.imgfmt.app
Class Coord

java.lang.Object
  extended by uk.me.parabola.imgfmt.app.Coord
All Implemented Interfaces:
java.lang.Comparable<Coord>
Direct Known Subclasses:
CoordNode, CoordPOI

public class Coord
extends java.lang.Object
implements java.lang.Comparable<Coord>

A point coordinate in unshifted map-units. A map unit is 360/2^24 degrees. In some places shifted coordinates are used, which means that they are divided by some power of two to save space in the file. You can create one of these with lat/long by calling the constructor with double args. This is an immutable class.

Author:
Steve Ratcliffe

Constructor Summary
Coord(double latitude, double longitude)
          Construct from regular latitude and longitude.
Coord(int latitude, int longitude)
          Construct from co-ordinates that are already in map-units.
 
Method Summary
 double bearingTo(Coord point)
           
 int compareTo(Coord other)
          Sort lexicographically by longitude, then latitude.
 double distance(Coord other)
          Distance to other point in meters.
 double distanceInDegreesSquared(Coord other)
           
 boolean equals(java.lang.Object obj)
           
 int getHighwayCount()
           
 long getId()
           
 int getLatitude()
           
 int getLongitude()
           
 boolean getOnBoundary()
           
 int hashCode()
           
 void incHighwayCount()
           
 Coord makeBetweenPoint(Coord other, double fraction)
           
 boolean preserved()
           
 void preserved(boolean preserved)
           
 double quickDistance(Coord other)
           
 void setOnBoundary(boolean onBoundary)
           
protected  double slowDistance(Coord other)
           
 java.lang.String toDegreeString()
           
 java.lang.String toOSMURL()
           
protected  java.lang.String toOSMURL(int zoom)
           
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Coord

public Coord(int latitude,
             int longitude)
Construct from co-ordinates that are already in map-units.

Parameters:
latitude - The latitude in map units.
longitude - The longitude in map units.

Coord

public Coord(double latitude,
             double longitude)
Construct from regular latitude and longitude.

Parameters:
latitude - The latitude in degrees.
longitude - The longitude in degrees.
Method Detail

getLatitude

public int getLatitude()

getLongitude

public int getLongitude()

getId

public long getId()

getHighwayCount

public int getHighwayCount()

incHighwayCount

public void incHighwayCount()

getOnBoundary

public boolean getOnBoundary()

setOnBoundary

public void setOnBoundary(boolean onBoundary)

preserved

public boolean preserved()

preserved

public void preserved(boolean preserved)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

distance

public double distance(Coord other)
Distance to other point in meters.


slowDistance

protected double slowDistance(Coord other)

quickDistance

public double quickDistance(Coord other)

distanceInDegreesSquared

public double distanceInDegreesSquared(Coord other)

makeBetweenPoint

public Coord makeBetweenPoint(Coord other,
                              double fraction)

bearingTo

public double bearingTo(Coord point)

compareTo

public int compareTo(Coord other)
Sort lexicographically by longitude, then latitude. This ordering is used for sorting entries in NOD3.

Specified by:
compareTo in interface java.lang.Comparable<Coord>

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.

toDegreeString

public java.lang.String toDegreeString()

toOSMURL

protected java.lang.String toOSMURL(int zoom)

toOSMURL

public java.lang.String toOSMURL()