gars-ios 1.1.5 Documentation

Class GARS

public class GARS: Hashable  
  • Global Area Reference System Coordinate
GARS GARS Hashable Hashable GARS->Hashable

Conforms To

Hashable

Initializers

init(_:​_:​)

public convenience init(_ longitude: Int, _ latitude: String)  
  • Initialize, default southwest corner quadrant
  • GARSConstants.DEFAULT_QUADRANT and keypad
  • GARSConstants.DEFAULT_KEYPAD
  • @param longitude
  •        longitudinal band number
    
  • @param latitude
  •        latitudinal band letters
    

init(_:​_:​_:​_:​)

public init(_ longitude: Int, _ latitude: String, _ quadrant: Int, _ keypad: Int)  
  • Initialize
  • @param longitude
  •        longitudinal band number
    
  • @param latitude
  •        latitudinal band letters
    
  • @param quadrant
  •        15 minute quadrant
    
  • @param keypad
  •        5 minute keypad
    

Properties

longitude

public let longitude: Int
  • Longitudinal band number

latitude

public let latitude: String
  • Latitudinal band letters

quadrant

public let quadrant: Int
  • 15 minute quadrant

keypad

public let keypad: Int
  • 5 minute keypad

description

public var description: String  

Methods

coordinate()

public func coordinate() -> String  
  • Get the GARS coordinate with five minute precision
  • @return GARS coordinate

coordinate(_:​)

public func coordinate(_ type: GridType?) -> String  
  • Get the GARS coordinate with specified grid precision
  • @param type
  •        grid type precision
    
  • @return GARS coordinate

to​Point()

public func toPoint() -> GridPoint  
  • Convert to a point
  • @return point

to​Coordinate()

public func toCoordinate() -> CLLocationCoordinate2D  
  • Convert to a location coordinate
  • @return coordinate

hash(into:​)

public func hash(into hasher: inout Hasher)  

is​GARS(_:​)

public static func isGARS(_ gars: String) -> Bool  
  • Return whether the given string is valid GARS string
  • @param gars
  •        potential GARS string
    
  • @return true if GARS string is valid, false otherwise

from(_:​)

public static func from(_ point: GridPoint) -> GARS  
  • Encodes a point as a GARS
  • @param point
  •        point
    
  • @return GARS

from(_:​)

public static func from(_ coordinate: CLLocationCoordinate2D) -> GARS  
  • Encodes a coordinate as a GARS
  • @param coordinate
  •        coordinate
    
  • @return GARS

from(_:​_:​)

public static func from(_ longitude: Double, _ latitude: Double) -> GARS  
  • Convert the coordinate to GARS
  • @param longitude
  •        longitude
    
  • @param latitude
  •        latitude
    
  • @return GARS

from(_:​_:​_:​)

public static func from(_ longitude: Double, _ latitude: Double, _ unit: grid_ios.Unit) -> GARS  
  • Convert the coordinate to GARS
  • @param longitude
  •        longitude
    
  • @param latitude
  •        latitude
    
  • @param unit
  •        unit
    
  • @return GARS

parse(_:​)

public static func parse(_ gars: String) -> GARS  
  • Parse a GARS string
  • @param gars
  •        GARS string
    
  • @return GARS

parse​ToCoordinate(_:​)

public static func parseToCoordinate(_ gars: String) -> CLLocationCoordinate2D  
  • Parse a GARS string into a location coordinate
  • @param gars
  •        GARS string
    
  • @return coordinate

coordinate(_:​)

public static func coordinate(_ point: GridPoint) -> String  
  • Encodes a point as a GARS coordinate with five minute precision
  • @param point
  •        point
    
  • @return GARS coordinate

coordinate(_:​_:​)

public static func coordinate(_ point: GridPoint, _ type: GridType?) -> String  
  • Encodes a point as a GARS coordinate with specified grid precision
  • @param point
  •        point
    
  • @param type
  •        grid type precision
    
  • @return GARS coordinate

coordinate(_:​)

public static func coordinate(_ coordinate: CLLocationCoordinate2D) -> String  
  • Encodes a coordinate as a GARS coordinate with five minute precision
  • @param coordinate
  •        coordinate
    
  • @return GARS coordinate

coordinate(_:​_:​)

public static func coordinate(_ coordinate: CLLocationCoordinate2D, _ type: GridType?) -> String  
  • Encodes a coordinate as a GARS coordinate with specified grid precision
  • @param coordinate
  •        coordinate
    
  • @param type
  •        grid type precision
    
  • @return GARS coordinate

coordinate(_:​_:​)

public static func coordinate(_ longitude: Double, _ latitude: Double) -> String  
  • Encodes a coordinate in degrees as a GARS coordinate with five minute precision
  • @param longitude
  •        longitude
    
  • @param latitude
  •        latitude
    
  • @return GARS coordinate

coordinate(_:​_:​_:​)

public static func coordinate(_ longitude: Double, _ latitude: Double, _ type: GridType?) -> String  
  • Encodes a coordinate in degrees as a GARS coordinate with specified grid precision
  • @param longitude
  •        longitude
    
  • @param latitude
  •        latitude
    
  • @param type
  •        grid type precision
    
  • @return GARS coordinate

coordinate(_:​_:​_:​)

public static func coordinate(_ longitude: Double, _ latitude: Double, _ unit: grid_ios.Unit) -> String  
  • Encodes a coordinate in the unit as a GARS coordinate with five minute precision
  • @param longitude
  •        longitude
    
  • @param latitude
  •        latitude
    
  • @param unit
  •        unit
    
  • @return GARS coordinate

coordinate(_:​_:​_:​_:​)

public static func coordinate(_ longitude: Double, _ latitude: Double, _ unit: grid_ios.Unit, _ type: GridType?) -> String  
  • Encodes a coordinate in the unit as a GARS coordinate with specified grid precision
  • @param longitude
  •        longitude
    
  • @param latitude
  •        latitude
    
  • @param unit
  •        unit
    
  • @param type
  •        grid type precision
    
  • @return GARS coordinate

precision(_:​)

public static func precision(_ gars: String) -> GridType  
  • Parse the GARS string for the precision
  • @param gars
  •        GARS string
    
  • @return grid type precision

Operators

==

public static func == (lhs: GARS, rhs: GARS) -> Bool