mgrs-ios 1.1.6 Documentation

Class Bounds

public class Bounds: SFGeometryEnvelope  
  • Grid Bounds
Bounds Bounds SFGeometryEnvelope SFGeometryEnvelope Bounds->SFGeometryEnvelope

Conforms To

SFGeometryEnvelope

Initializers

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

public convenience init(_ minLongitude: Double, _ minLatitude: Double, _ maxLongitude: Double, _ maxLatitude: Double)  
  • Initialize
  • @param minLongitude
  •        min longitude
    
  • @param minLatitude
  •        min latitude
    
  • @param maxLongitude
  •        max longitude
    
  • @param maxLatitude
  •        max latitude
    

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

public init(_ minLongitude: Double, _ minLatitude: Double, _ maxLongitude: Double, _ maxLatitude: Double, _ unit: Unit)  
  • Initialize
  • @param minLongitude
  •        min longitude
    
  • @param minLatitude
  •        min latitude
    
  • @param maxLongitude
  •        max longitude
    
  • @param maxLatitude
  •        max latitude
    
  • @param unit
  •        unit
    

init(_:​_:​)

public convenience init(_ southwest: GridPoint, _ northeast: GridPoint)  
  • Initialize
  • @param southwest
  •        southwest corner
    
  • @param northeast
  •        northeast corner
    

init(_:​)

public convenience init(_ bounds: Bounds)  
  • Initialize
  • @param point
  •        point to copy
    

init(_:​_:​)

public init(_ envelope: SFGeometryEnvelope, _ unit: Unit)  
  • Initialize
  • @param envelope
  •        geometry envelope
    
  • @param unit
  •        unit
    

init?(coder:​)

public required init?(coder: NSCoder)  

Properties

unit

public var unit: Unit
  • Unit

min​Longitude

public var minLongitude: Double  
  • The min longitude

min​Latitude

public var minLatitude: Double  
  • The min latitude

max​Longitude

public var maxLongitude: Double  
  • The max longitude

max​Latitude

public var maxLatitude: Double  
  • The max latitude

west

public var west: Double  
  • The western longitude
  • @return western longitude

south

public var south: Double  
  • The southern longitude
  • @return southern longitude

east

public var east: Double  
  • The eastern longitude
  • @return eastern longitude

north

public var north: Double  
  • The northern longitude
  • @return northern longitude

width

public var width: Double  
  • The width

height

public var height: Double  
  • The height

southwest

public var southwest: GridPoint  
  • The southwest coordinate
  • @return southwest coordinate

northwest

public var northwest: GridPoint  
  • The northwest coordinate
  • @return northwest coordinate

southeast

public var southeast: GridPoint  
  • The southeast coordinate
  • @return southeast coordinate

northeast

public var northeast: GridPoint  
  • The northeast coordinate
  • @return northeast coordinate

hash

public override var hash: Int  

Methods

degrees(_:​_:​_:​_:​)

public static func degrees(_ minLongitude: Double, _ minLatitude: Double, _ maxLongitude: Double, _ maxLatitude: Double) -> Bounds  
  • Create bounds in degrees
  • @param minLongitude
  •        min longitude
    
  • @param minLatitude
  •        min latitude
    
  • @param maxLongitude
  •        max longitude
    
  • @param maxLatitude
  •        max latitude
    
  • @return bounds

meters(_:​_:​_:​_:​)

public static func meters(_ minLongitude: Double, _ minLatitude: Double, _ maxLongitude: Double, _ maxLatitude: Double) -> Bounds  
  • Create bounds in meters
  • @param minLongitude
  •        min longitude
    
  • @param minLatitude
  •        min latitude
    
  • @param maxLongitude
  •        max longitude
    
  • @param maxLatitude
  •        max latitude
    
  • @return bounds

is​Unit(_:​)

public func isUnit(_ unit: Unit) -> Bool  
  • Is in the provided unit type
  • @param unit
  •        unit
    
  • @return true if in the unit

is​Degrees()

public func isDegrees() -> Bool  
  • Are bounds in degrees
  • @return true if degrees

is​Meters()

public func isMeters() -> Bool  
  • Are bounds in meters
  • @return true if meters

to​Unit(_:​)

public func toUnit(_ unit: Unit) -> Bounds  
  • Convert to the unit
  • @param unit
  •        unit
    
  • @return bounds in units, same bounds if equal units

to​Degrees()

public func toDegrees() -> Bounds  
  • Convert to degrees
  • @return bounds in degrees, same bounds if already in degrees

to​Meters()

public func toMeters() -> Bounds  
  • Convert to meters
  • @return bounds in meters, same bounds if already in meters

centroid​Longitude()

public func centroidLongitude() -> Double  
  • Get the centroid longitude
  • @return centroid longitude

centroid​Latitude()

public func centroidLatitude() -> Double  
  • Get the centroid latitude
  • @return centroid latitude

centroid()

public override func centroid() -> GridPoint  

overlap(_:​)

public func overlap(_ bounds: Bounds) -> Bounds?  
  • Create a new bounds as the overlapping between this bounds and the
  • provided
  • @param bounds
  •        bounds
    
  • @return overlap bounds

union(_:​)

public func union(_ bounds: Bounds) -> Bounds?  
  • Create a new bounds as the union between this bounds and the provided
  • @param bounds
  •        bounds
    
  • @return union bounds

west​Line()

public func westLine() -> Line  
  • Get the western line
  • @return west line

south​Line()

public func southLine() -> Line  
  • Get the southern line
  • @return south line

east​Line()

public func eastLine() -> Line  
  • Get the eastern line
  • @return east line

north​Line()

public func northLine() -> Line  
  • Get the northern line
  • @return north line

to​Precision(_:​)

public func toPrecision(_ precision: Double) -> Bounds  
  • Convert the bounds to be precision accurate minimally containing the
  • bounds. Each bound is equal to or larger by the precision degree amount.
  • @param precision
  •        precision in degrees
    
  • @return precision bounds

pixel​Range(_:​)

public func pixelRange(_ tile: GridTile) -> PixelRange  
  • Get the pixel range where the bounds fit into the tile
  • @param tile
  •        tile
    
  • @return pixel range

pixel​Range(_:​_:​_:​)

public func pixelRange(_ width: Int, _ height: Int, _ bounds: Bounds) -> PixelRange  
  • Get the pixel range where the bounds fit into the provided bounds
  • @param width
  •        width
    
  • @param height
  •        height
    
  • @param bounds
  •        bounds
    
  • @return pixel range

lines()

public func lines() -> [Line]  
  • Get the four line bounds in meters
  • @return lines

mutable​Copy(with:​)

public override func mutableCopy(with zone: NSZone? = nil) -> Any  

encode(with:​)

public override func encode(with coder: NSCoder)  

is​Equal(_:​)

public func isEqual(_ bounds: Bounds?) -> Bool  

is​Equal(_:​)

public override func isEqual(_ object: Any?) -> Bool