public class GTNWrapper extends java.lang.Object implements java.lang.Comparable<GTNWrapper>
OsmSearcher
to conveniently provide its position and distance from the map center so the GUI can
sort it in with other search results.Modifier and Type | Field and Description |
---|---|
float |
bearing
Direction from map center to this Way or Node.
|
GenericTaggedNode<?> |
gtn
The Way or Node that was found by the OsmSearcher,
|
int |
nearestLat
Latitude of this Node, or nearest latitude of this Way.
|
int |
nearestLon
Longitude of this Node, or nearest longitude of this Way.
|
int |
radiusM
Distance in meters from the map center to this Way or Node.
|
static java.util.Comparator<GTNWrapper> |
SORT_BY_RADIUS
Comparator for sorting wrapped GTNWrapper objects by their radial distance away
from the search center point.
|
Constructor and Description |
---|
GTNWrapper(GenericTaggedNode<?> gtn,
double radiusM,
float bearing,
int lat,
int lon)
Constructor for a GTNWrapper.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(GTNWrapper o)
Compares this object with the specified object for order.
|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
int |
hashCode()
Returns a hash code value for the object.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
public final GenericTaggedNode<?> gtn
public int radiusM
public float bearing
public final int nearestLat
public final int nearestLon
public static final java.util.Comparator<GTNWrapper> SORT_BY_RADIUS
public GTNWrapper(GenericTaggedNode<?> gtn, double radiusM, float bearing, int lat, int lon)
gtn
- The Way or Node that was found by the OsmSearcher,radiusM
- Distance in meters from the map center to this Way or Node.bearing
- bearing in degrees from True North from map center to this Way or Node.lat
- Latitude of this Node, or nearest latitude of this Way.lon
- Longitude of this Node, or nearest longitude of this Way.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.hashCode()
,
Hashtable
public int hashCode()
java.util.Hashtable
.hashCode
in class java.lang.Object
Object.equals(Object)
,
Hashtable
public int compareTo(GTNWrapper o)
compareTo
in interface java.lang.Comparable<GTNWrapper>
o
- the object to be compared.java.lang.NullPointerException
- if the specified object is nulljava.lang.ClassCastException
- if the specified object's type prevents it
from being compared to this object.