ProMotion-mapbox 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ProMotion/map/map_screen_annotation.rb +32 -10
- data/lib/ProMotion/map/map_screen_module.rb +26 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 363c3abe1d5611fd12f9d6dfab3bcc661b4742bc
|
4
|
+
data.tar.gz: 010e35765a425db7ad9ac6ce929a36c639a2d9d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cabba145deb2d8d12d55b946bcb5b003411e361b6e86e7dca609f6a2a3448c79815202cab1bf79d30f4643d92763109d76105a23cf19a0f132a261ff1ae4630d
|
7
|
+
data.tar.gz: 28df81f73618e7d0d90f3d62b4009ebdddd743daaa9509d7e66a12c800fc08a81e3263c2e76c39d9836d43b5886e9f857a46713fcdecbc1a6915e00356b8719b
|
@@ -6,7 +6,6 @@ module ProMotion
|
|
6
6
|
@params = params
|
7
7
|
@map_view = map_view
|
8
8
|
set_defaults
|
9
|
-
|
10
9
|
if @params[:coordinate]
|
11
10
|
@params[:latitude] = @params[:coordinate].latitude
|
12
11
|
@params[:longitude] = @params[:coordinate].longitude
|
@@ -19,17 +18,30 @@ module ProMotion
|
|
19
18
|
PM.logger.error("You are required to specify :latitude and :longitude or :coordinate for annotations.")
|
20
19
|
nil
|
21
20
|
end
|
21
|
+
self.userInfo = @params
|
22
22
|
end
|
23
23
|
|
24
24
|
def set_defaults
|
25
|
-
@params
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
25
|
+
if @params.class == Hash
|
26
|
+
@params = {
|
27
|
+
title: "Title",
|
28
|
+
pin_color: :red,
|
29
|
+
identifier: "Annotation-#{@params[:pin_color]}-#{@params[:image]}",
|
30
|
+
show_callout: true,
|
31
|
+
animates_drop: false,
|
32
|
+
maki_icon: nil,
|
33
|
+
}.merge(@params)
|
34
|
+
elsif @params.class == RMQuadTreeNode # Clustered pins
|
35
|
+
@params = {
|
36
|
+
title: @params.annotations.count,
|
37
|
+
coordinate: @params.clusterAnnotation.coordinate,
|
38
|
+
pin_color: :purple,
|
39
|
+
identifier: "Annotation-cluster",
|
40
|
+
show_callout: true,
|
41
|
+
animates_drop: false,
|
42
|
+
maki_icon: nil,
|
43
|
+
}
|
44
|
+
end
|
33
45
|
end
|
34
46
|
|
35
47
|
def title
|
@@ -60,7 +72,17 @@ module ProMotion
|
|
60
72
|
@coordinate = new_coordinate
|
61
73
|
end
|
62
74
|
end
|
63
|
-
|
75
|
+
|
76
|
+
def self.new_with_rmannotation(rmannotation,map_view)
|
77
|
+
annotation = self.new(rmannotation.userInfo, map_view)
|
78
|
+
%w(coordinate title subtitle userInfo annotationType annotationIcon
|
79
|
+
position layer clusteringEnabled
|
80
|
+
isClusterAnnotation isUserLocationAnnotation).each do |meth|
|
81
|
+
annotation.send("#{meth}=", rmannotation.send(meth))
|
82
|
+
end
|
83
|
+
annotation
|
84
|
+
end
|
85
|
+
|
64
86
|
def method_missing(meth, *args)
|
65
87
|
if @params[meth.to_sym]
|
66
88
|
@params[meth.to_sym]
|
@@ -12,7 +12,6 @@ module ProMotion
|
|
12
12
|
self.view = nil
|
13
13
|
self.view = RMMapView.alloc.initWithFrame(self.view.bounds, andTilesource:@tileSource)
|
14
14
|
self.view.delegate = self
|
15
|
-
|
16
15
|
check_annotation_data
|
17
16
|
@promotion_annotation_data = []
|
18
17
|
set_up_tap_to_add
|
@@ -31,11 +30,12 @@ module ProMotion
|
|
31
30
|
def view_will_appear(animated)
|
32
31
|
super
|
33
32
|
update_annotation_data
|
33
|
+
set_up_start_center
|
34
34
|
end
|
35
35
|
|
36
36
|
def view_did_appear(animated)
|
37
37
|
super
|
38
|
-
|
38
|
+
set_up_start_region
|
39
39
|
end
|
40
40
|
|
41
41
|
def check_annotation_data
|
@@ -185,9 +185,21 @@ module ProMotion
|
|
185
185
|
set_region(region, animated:false)
|
186
186
|
end
|
187
187
|
|
188
|
-
def
|
188
|
+
def set_up_start_region
|
189
|
+
if self.class.respond_to?(:get_start_position) && self.class.get_start_position
|
190
|
+
start_params = self.class.get_start_position_params
|
191
|
+
self.set_start_position start_params unless start_params[:radius].nil?
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
def set_up_start_center
|
189
196
|
if self.class.respond_to?(:get_start_position) && self.class.get_start_position
|
190
|
-
|
197
|
+
start_params = self.class.get_start_position_params
|
198
|
+
start_params[:zoom] ||= 5
|
199
|
+
self.view.setZoom(start_params[:zoom], atCoordinate:
|
200
|
+
CLLocationCoordinate2D.new(start_params[:latitude], start_params[:longitude]),
|
201
|
+
animated: false
|
202
|
+
)
|
191
203
|
end
|
192
204
|
end
|
193
205
|
|
@@ -337,8 +349,15 @@ module ProMotion
|
|
337
349
|
end
|
338
350
|
end
|
339
351
|
|
352
|
+
def empty_cache
|
353
|
+
map.removeAllCachedImages
|
354
|
+
end
|
355
|
+
|
340
356
|
########## Mapbox methods #################
|
341
357
|
def mapView(map_view, layerForAnnotation: annotation)
|
358
|
+
if annotation.is_a?(RMAnnotation)
|
359
|
+
annotation = MapScreenAnnotation.new_with_rmannotation(annotation,self.view)
|
360
|
+
end
|
342
361
|
annotation_view(map_view, annotation)
|
343
362
|
end
|
344
363
|
|
@@ -367,6 +386,9 @@ module ProMotion
|
|
367
386
|
end
|
368
387
|
end
|
369
388
|
|
389
|
+
def tapOnCalloutAccessoryControl(control, forAnnotation: annotation, onMap: map)
|
390
|
+
control.sendActionsForControlEvents(UIControlEventTouchUpInside)
|
391
|
+
end
|
370
392
|
########## Cocoa touch Ruby counterparts #################
|
371
393
|
|
372
394
|
def deceleration_mode
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ProMotion-mapbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diogo Andre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ProMotion
|