Class: MapKit::DataTypes::CoordinateRegion
- Inherits:
-
Object
- Object
- MapKit::DataTypes::CoordinateRegion
- Includes:
- CoreLocation::DataTypes
- Defined in:
- lib/map-kit-wrapper/map_kit_data_types.rb
Overview
Wrapper for MKCoordinateRegion
Instance Attribute Summary collapse
-
#center ⇒ Object
Returns the value of attribute center.
-
#span ⇒ Object
Returns the value of attribute span.
Instance Method Summary collapse
-
#initialize(*args) ⇒ CoordinateRegion
constructor
CoordinateRegion.new(CoordinateRegion) CoordinateRegion.new(MKCoordinateRegion) CoordinateRegion.new([56, 10.6], [3.1, 3.1]) CoordinateRegion.new(=> {:latitude => 56, :longitude => 10.6, :span => => 3.1, :longitude_delta => 3.1} CoordinateRegion.new(LocationCoordinate, CoordinateSpan) CoordinateRegion.new(CLLocationCoordinate2D, MKCoordinateSpan).
- #sdk ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ CoordinateRegion
CoordinateRegion.new(CoordinateRegion) CoordinateRegion.new(MKCoordinateRegion) CoordinateRegion.new([56, 10.6], [3.1, 3.1]) CoordinateRegion.new(=> {:latitude => 56, :longitude => 10.6, :span => => 3.1, :longitude_delta => 3.1} CoordinateRegion.new(LocationCoordinate, CoordinateSpan) CoordinateRegion.new(CLLocationCoordinate2D, MKCoordinateSpan)
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 73 def initialize(*args) self.center, self.span = case args.size when 1 arg = args[0] case arg when Hash [arg[:center], arg[:span]] else [arg.center, arg.span] end when 2 [args[0], args[1]] end end |
Instance Attribute Details
#center ⇒ Object
Returns the value of attribute center.
65 66 67 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 65 def center @center end |
#span ⇒ Object
Returns the value of attribute span.
65 66 67 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 65 def span @span end |
Instance Method Details
#sdk ⇒ Object
89 90 91 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 89 def sdk MKCoordinateRegionMake(@center.sdk, @span.sdk) end |
#to_h ⇒ Object
101 102 103 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 101 def to_h {:center => @center.to_h, :span => @span.to_h} end |
#to_s ⇒ Object
105 106 107 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 105 def to_s to_h.to_s end |