Class GTNWrapper

java.lang.Object
org.ka2ddo.yaac.osm.GTNWrapper
All Implemented Interfaces:
Comparable<GTNWrapper>

public class GTNWrapper extends Object implements Comparable<GTNWrapper>
This class wraps a OpenStreetMap record (way or node) found by the OsmSearcher to conveniently provide its position and distance from the map center so the GUI can sort it in with other search results.
Author:
Andrew Pavlin, KA2DDO
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final float
    Direction from map center to this Way or Node.
    The Way or Node that was found by the OsmSearcher,
    final int
    Latitude of this Node, or nearest latitude of this Way.
    final int
    Longitude of this Node, or nearest longitude of this Way.
    final int
    Distance in meters from the map center to this Way or Node.
    static final Comparator<GTNWrapper>
    Comparator for sorting wrapped GTNWrapper objects by their radial distance away from the search center point.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GTNWrapper(GenericTaggedNode<?> gtn, double radiusM, float bearing, int lat, int lon)
    Constructor for a GTNWrapper.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares this object with the specified object for order.
    boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns a hash code value for the object.
    Returns a string representation of the object.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • gtn

      public final GenericTaggedNode<?> gtn
      The Way or Node that was found by the OsmSearcher,
    • radiusM

      public final int radiusM
      Distance in meters from the map center to this Way or Node.
    • bearing

      public final float bearing
      Direction from map center to this Way or Node.
    • nearestLat

      public final int nearestLat
      Latitude of this Node, or nearest latitude of this Way.
    • nearestLon

      public final int nearestLon
      Longitude of this Node, or nearest longitude of this Way.
    • SORT_BY_RADIUS

      public static final Comparator<GTNWrapper> SORT_BY_RADIUS
      Comparator for sorting wrapped GTNWrapper objects by their radial distance away from the search center point.
  • Constructor Details

    • GTNWrapper

      public GTNWrapper(GenericTaggedNode<?> gtn, double radiusM, float bearing, int lat, int lon)
      Constructor for a GTNWrapper.
      Parameters:
      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.
  • Method Details

    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object.
    • equals

      public boolean equals(Object obj)
      Indicates whether some other object is "equal to" this one.
      Overrides:
      equals in class Object
      Parameters:
      obj - the reference object with which to compare.
      Returns:
      true if this object is the same as the obj argument; false otherwise.
      See Also:
    • hashCode

      public int hashCode()
      Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object.
      See Also:
    • compareTo

      public int compareTo(GTNWrapper o)
      Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      Specified by:
      compareTo in interface Comparable<GTNWrapper>
      Parameters:
      o - the object to be compared.
      Returns:
      a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
      Throws:
      NullPointerException - if the specified object is null
      ClassCastException - if the specified object's type prevents it from being compared to this object.