@lugg/maps 1.0.0-beta.2 → 1.0.0-beta.20
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.
- package/README.md +3 -0
- package/android/src/main/java/com/luggmaps/LuggCalloutView.kt +9 -2
- package/android/src/main/java/com/luggmaps/LuggCalloutViewManager.kt +4 -3
- package/android/src/main/java/com/luggmaps/LuggCircleView.kt +85 -0
- package/android/src/main/java/com/luggmaps/LuggCircleViewManager.kt +79 -0
- package/android/src/main/java/com/luggmaps/LuggGroundOverlayView.kt +81 -0
- package/android/src/main/java/com/luggmaps/LuggGroundOverlayViewManager.kt +82 -0
- package/android/src/main/java/com/luggmaps/LuggMapView.kt +90 -0
- package/android/src/main/java/com/luggmaps/LuggMapViewManager.kt +45 -0
- package/android/src/main/java/com/luggmaps/LuggMapWrapperView.kt +27 -2
- package/android/src/main/java/com/luggmaps/LuggMarkerView.kt +30 -2
- package/android/src/main/java/com/luggmaps/LuggMarkerViewManager.kt +13 -0
- package/android/src/main/java/com/luggmaps/LuggPackage.kt +4 -1
- package/android/src/main/java/com/luggmaps/LuggPolylineView.kt +3 -23
- package/android/src/main/java/com/luggmaps/LuggTileOverlayView.kt +92 -0
- package/android/src/main/java/com/luggmaps/LuggTileOverlayViewManager.kt +80 -0
- package/android/src/main/java/com/luggmaps/core/GoogleMapProvider.kt +676 -36
- package/android/src/main/java/com/luggmaps/core/MapProviderDelegate.kt +15 -0
- package/android/src/main/java/com/luggmaps/core/PolylineAnimator.kt +65 -11
- package/android/src/main/java/com/luggmaps/events/CirclePressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/events/GroundOverlayPressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/events/TileOverlayPressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/extensions/ViewExtensions.kt +11 -0
- package/ios/LuggCalloutView.h +1 -1
- package/ios/LuggCalloutView.mm +21 -11
- package/ios/LuggCircleView.h +31 -0
- package/ios/LuggCircleView.mm +133 -0
- package/ios/LuggGroundOverlayView.h +30 -0
- package/ios/LuggGroundOverlayView.mm +125 -0
- package/ios/LuggMapView.mm +254 -4
- package/ios/LuggMapWrapperView.h +5 -0
- package/ios/LuggMapWrapperView.mm +18 -0
- package/ios/LuggMarkerView.h +3 -0
- package/ios/LuggMarkerView.mm +25 -0
- package/ios/LuggTileOverlayView.h +31 -0
- package/ios/LuggTileOverlayView.mm +130 -0
- package/ios/core/AppleMapProvider.h +8 -0
- package/ios/core/AppleMapProvider.mm +663 -29
- package/ios/core/AppleStaticMapProvider.h +14 -0
- package/ios/core/AppleStaticMapProvider.mm +159 -0
- package/ios/core/GMSPolylineAnimator.m +46 -18
- package/ios/core/GoogleMapProvider.h +10 -0
- package/ios/core/GoogleMapProvider.mm +430 -51
- package/ios/core/GoogleStaticMapProvider.h +21 -0
- package/ios/core/GoogleStaticMapProvider.mm +213 -0
- package/ios/core/MKPolylineAnimator.m +67 -43
- package/ios/core/MapProviderDelegate.h +27 -1
- package/ios/core/StaticMapProviderBase.h +75 -0
- package/ios/core/StaticMapProviderBase.mm +845 -0
- package/ios/events/CameraIdleEvent.h +4 -2
- package/ios/events/CameraMoveEvent.h +4 -2
- package/ios/events/CirclePressEvent.h +22 -0
- package/ios/events/GroundOverlayPressEvent.h +22 -0
- package/ios/events/LongPressEvent.h +4 -2
- package/ios/events/MarkerDragEvent.h +12 -6
- package/ios/events/MarkerPressEvent.h +4 -2
- package/ios/events/PolygonPressEvent.h +4 -2
- package/ios/events/PressEvent.h +4 -2
- package/ios/events/ReadyEvent.h +4 -2
- package/ios/events/TileOverlayPressEvent.h +22 -0
- package/ios/extensions/MKMapView+Zoom.h +20 -0
- package/ios/extensions/MKMapView+Zoom.m +28 -18
- package/ios/extensions/UIView+Snapshot.h +16 -0
- package/ios/extensions/UIView+Snapshot.m +27 -0
- package/lib/module/MapProvider.web.js +4 -1
- package/lib/module/MapProvider.web.js.map +1 -1
- package/lib/module/MapView.js +19 -1
- package/lib/module/MapView.js.map +1 -1
- package/lib/module/MapView.web.js +30 -22
- package/lib/module/MapView.web.js.map +1 -1
- package/lib/module/components/Circle.js +46 -0
- package/lib/module/components/Circle.js.map +1 -0
- package/lib/module/components/Circle.types.js +4 -0
- package/lib/module/components/Circle.types.js.map +1 -0
- package/lib/module/components/Circle.web.js +79 -0
- package/lib/module/components/Circle.web.js.map +1 -0
- package/lib/module/components/GeoJson.js +3 -3
- package/lib/module/components/GeoJson.js.map +1 -1
- package/lib/module/components/GroundOverlay.js +45 -0
- package/lib/module/components/GroundOverlay.js.map +1 -0
- package/lib/module/components/GroundOverlay.types.js +4 -0
- package/lib/module/components/GroundOverlay.types.js.map +1 -0
- package/lib/module/components/GroundOverlay.web.js +77 -0
- package/lib/module/components/GroundOverlay.web.js.map +1 -0
- package/lib/module/components/Marker.js +22 -4
- package/lib/module/components/Marker.js.map +1 -1
- package/lib/module/components/Marker.web.js +23 -10
- package/lib/module/components/Marker.web.js.map +1 -1
- package/lib/module/components/Polygon.web.js +3 -3
- package/lib/module/components/Polygon.web.js.map +1 -1
- package/lib/module/components/Polyline.web.js +6 -12
- package/lib/module/components/Polyline.web.js.map +1 -1
- package/lib/module/components/TileOverlay.js +44 -0
- package/lib/module/components/TileOverlay.js.map +1 -0
- package/lib/module/components/TileOverlay.types.js +4 -0
- package/lib/module/components/TileOverlay.types.js.map +1 -0
- package/lib/module/components/TileOverlay.web.js +69 -0
- package/lib/module/components/TileOverlay.web.js.map +1 -0
- package/lib/module/components/index.js +3 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/index.web.js +3 -0
- package/lib/module/components/index.web.js.map +1 -1
- package/lib/module/fabric/LuggCalloutViewNativeComponent.ts +1 -1
- package/lib/module/fabric/LuggCircleViewNativeComponent.ts +25 -0
- package/lib/module/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
- package/lib/module/fabric/LuggMapViewNativeComponent.ts +16 -5
- package/lib/module/fabric/LuggMarkerViewNativeComponent.ts +14 -2
- package/lib/module/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +3 -0
- package/lib/module/index.web.js.map +1 -1
- package/lib/typescript/src/MapProvider.web.d.ts +3 -2
- package/lib/typescript/src/MapProvider.web.d.ts.map +1 -1
- package/lib/typescript/src/MapView.d.ts +1 -1
- package/lib/typescript/src/MapView.d.ts.map +1 -1
- package/lib/typescript/src/MapView.types.d.ts +60 -1
- package/lib/typescript/src/MapView.types.d.ts.map +1 -1
- package/lib/typescript/src/MapView.web.d.ts +1 -1
- package/lib/typescript/src/MapView.web.d.ts.map +1 -1
- package/lib/typescript/src/components/Circle.d.ts +10 -0
- package/lib/typescript/src/components/Circle.d.ts.map +1 -0
- package/lib/typescript/src/components/Circle.types.d.ts +33 -0
- package/lib/typescript/src/components/Circle.types.d.ts.map +1 -0
- package/lib/typescript/src/components/Circle.web.d.ts +3 -0
- package/lib/typescript/src/components/Circle.web.d.ts.map +1 -0
- package/lib/typescript/src/components/GeoJson.d.ts +2 -1
- package/lib/typescript/src/components/GeoJson.d.ts.map +1 -1
- package/lib/typescript/src/components/GroundOverlay.d.ts +10 -0
- package/lib/typescript/src/components/GroundOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/GroundOverlay.types.d.ts +35 -0
- package/lib/typescript/src/components/GroundOverlay.types.d.ts.map +1 -0
- package/lib/typescript/src/components/GroundOverlay.web.d.ts +3 -0
- package/lib/typescript/src/components/GroundOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/components/Marker.d.ts +6 -3
- package/lib/typescript/src/components/Marker.d.ts.map +1 -1
- package/lib/typescript/src/components/Marker.types.d.ts +18 -6
- package/lib/typescript/src/components/Marker.types.d.ts.map +1 -1
- package/lib/typescript/src/components/Marker.web.d.ts +3 -2
- package/lib/typescript/src/components/Marker.web.d.ts.map +1 -1
- package/lib/typescript/src/components/Polygon.web.d.ts +1 -1
- package/lib/typescript/src/components/Polygon.web.d.ts.map +1 -1
- package/lib/typescript/src/components/Polyline.web.d.ts +1 -1
- package/lib/typescript/src/components/Polyline.web.d.ts.map +1 -1
- package/lib/typescript/src/components/TileOverlay.d.ts +10 -0
- package/lib/typescript/src/components/TileOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/TileOverlay.types.d.ts +36 -0
- package/lib/typescript/src/components/TileOverlay.types.d.ts.map +1 -0
- package/lib/typescript/src/components/TileOverlay.web.d.ts +3 -0
- package/lib/typescript/src/components/TileOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +7 -1
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/components/index.web.d.ts +6 -0
- package/lib/typescript/src/components/index.web.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggCalloutViewNativeComponent.d.ts +1 -1
- package/lib/typescript/src/fabric/LuggCircleViewNativeComponent.d.ts +18 -0
- package/lib/typescript/src/fabric/LuggCircleViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/LuggGroundOverlayViewNativeComponent.d.ts +21 -0
- package/lib/typescript/src/fabric/LuggGroundOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts +13 -5
- package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts +8 -1
- package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts +21 -0
- package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +7 -1
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +0 -4
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +17 -11
- package/src/MapProvider.web.tsx +5 -3
- package/src/MapView.tsx +19 -1
- package/src/MapView.types.ts +142 -1
- package/src/MapView.web.tsx +379 -340
- package/src/components/Circle.tsx +52 -0
- package/src/components/Circle.types.ts +33 -0
- package/src/components/Circle.web.tsx +95 -0
- package/src/components/GeoJson.tsx +3 -3
- package/src/components/GroundOverlay.tsx +47 -0
- package/src/components/GroundOverlay.types.ts +36 -0
- package/src/components/GroundOverlay.web.tsx +81 -0
- package/src/components/Marker.tsx +32 -6
- package/src/components/Marker.types.ts +19 -6
- package/src/components/Marker.web.tsx +196 -150
- package/src/components/Polygon.web.tsx +93 -89
- package/src/components/Polyline.web.tsx +235 -235
- package/src/components/TileOverlay.tsx +44 -0
- package/src/components/TileOverlay.types.ts +37 -0
- package/src/components/TileOverlay.web.tsx +97 -0
- package/src/components/index.ts +10 -0
- package/src/components/index.web.ts +9 -0
- package/src/fabric/LuggCalloutViewNativeComponent.ts +1 -1
- package/src/fabric/LuggCircleViewNativeComponent.ts +25 -0
- package/src/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
- package/src/fabric/LuggMapViewNativeComponent.ts +16 -5
- package/src/fabric/LuggMarkerViewNativeComponent.ts +14 -2
- package/src/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
- package/src/index.ts +12 -1
- package/src/index.web.ts +15 -0
- package/src/types.ts +0 -5
- package/plugin/build/withMapsAndroid.d.ts +0 -5
- package/plugin/build/withMapsAndroid.js +0 -15
- package/plugin/build/withMapsIOS.d.ts +0 -5
- package/plugin/build/withMapsIOS.js +0 -27
|
@@ -1,16 +1,59 @@
|
|
|
1
1
|
#import "GoogleMapProvider.h"
|
|
2
|
+
|
|
3
|
+
using facebook::react::LuggMapViewInsetAdjustment;
|
|
4
|
+
using facebook::react::LuggMapViewMapType;
|
|
5
|
+
using facebook::react::LuggMapViewPoiFilterMode;
|
|
6
|
+
using facebook::react::LuggMapViewTheme;
|
|
7
|
+
|
|
2
8
|
#import "../LuggCalloutView.h"
|
|
9
|
+
#import "../LuggCircleView.h"
|
|
10
|
+
#import "../LuggGroundOverlayView.h"
|
|
3
11
|
#import "../LuggMarkerView.h"
|
|
4
12
|
#import "../LuggPolygonView.h"
|
|
5
13
|
#import "../LuggPolylineView.h"
|
|
14
|
+
#import "../LuggTileOverlayView.h"
|
|
6
15
|
#import "GMSPolylineAnimator.h"
|
|
7
16
|
#import "PolylineAnimatorBase.h"
|
|
8
17
|
|
|
9
18
|
static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
10
19
|
|
|
20
|
+
GMSMapID *LuggGMSMapIDFromString(NSString *_Nullable mapId) {
|
|
21
|
+
if (mapId.length == 0 || [mapId isEqualToString:kDemoMapId]) {
|
|
22
|
+
return [GMSMapID demoMapID];
|
|
23
|
+
}
|
|
24
|
+
return [GMSMapID mapIDWithIdentifier:mapId];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
GMSMapViewType
|
|
28
|
+
LuggGMSMapTypeFromMapType(facebook::react::LuggMapViewMapType mapType) {
|
|
29
|
+
switch (mapType) {
|
|
30
|
+
case LuggMapViewMapType::Satellite:
|
|
31
|
+
return kGMSTypeSatellite;
|
|
32
|
+
case LuggMapViewMapType::Terrain:
|
|
33
|
+
return kGMSTypeTerrain;
|
|
34
|
+
case LuggMapViewMapType::Hybrid:
|
|
35
|
+
return kGMSTypeHybrid;
|
|
36
|
+
default:
|
|
37
|
+
return kGMSTypeNormal;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
UIUserInterfaceStyle
|
|
42
|
+
LuggInterfaceStyleFromTheme(facebook::react::LuggMapViewTheme theme) {
|
|
43
|
+
switch (theme) {
|
|
44
|
+
case LuggMapViewTheme::Dark:
|
|
45
|
+
return UIUserInterfaceStyleDark;
|
|
46
|
+
case LuggMapViewTheme::Light:
|
|
47
|
+
return UIUserInterfaceStyleLight;
|
|
48
|
+
default:
|
|
49
|
+
return UIUserInterfaceStyleUnspecified;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
11
53
|
@interface GoogleMapProvider () <
|
|
12
54
|
LuggMarkerViewDelegate, LuggCalloutViewDelegate, LuggPolylineViewDelegate,
|
|
13
|
-
LuggPolygonViewDelegate
|
|
55
|
+
LuggPolygonViewDelegate, LuggCircleViewDelegate,
|
|
56
|
+
LuggGroundOverlayViewDelegate, LuggTileOverlayViewDelegate>
|
|
14
57
|
@end
|
|
15
58
|
|
|
16
59
|
@implementation GoogleMapProvider {
|
|
@@ -18,14 +61,20 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
18
61
|
GMSMapView *_mapView;
|
|
19
62
|
BOOL _isMapReady;
|
|
20
63
|
BOOL _isDragging;
|
|
21
|
-
|
|
64
|
+
LuggMapViewTheme _theme;
|
|
22
65
|
UIEdgeInsets _edgeInsets;
|
|
23
66
|
NSMutableArray<LuggMarkerView *> *_pendingMarkerViews;
|
|
24
67
|
NSMutableArray<LuggPolylineView *> *_pendingPolylineViews;
|
|
25
68
|
NSMutableArray<LuggPolygonView *> *_pendingPolygonViews;
|
|
69
|
+
NSMutableArray<LuggCircleView *> *_pendingCircleViews;
|
|
70
|
+
NSMutableArray<LuggGroundOverlayView *> *_pendingGroundOverlayViews;
|
|
71
|
+
NSMutableArray<LuggTileOverlayView *> *_pendingTileOverlayViews;
|
|
26
72
|
NSMapTable<LuggPolylineView *, GMSPolylineAnimator *> *_polylineAnimators;
|
|
27
73
|
NSMapTable<GMSPolygon *, LuggPolygonView *> *_polygonToViewMap;
|
|
74
|
+
NSMapTable<GMSCircle *, LuggCircleView *> *_circleToViewMap;
|
|
28
75
|
NSMapTable<GMSMarker *, LuggMarkerView *> *_markerToViewMap;
|
|
76
|
+
NSMapTable<GMSGroundOverlay *, LuggGroundOverlayView *>
|
|
77
|
+
*_groundOverlayToViewMap;
|
|
29
78
|
LuggMarkerView *_activeNonBubbledMarker;
|
|
30
79
|
|
|
31
80
|
// Edge insets animation
|
|
@@ -37,6 +86,7 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
37
86
|
}
|
|
38
87
|
|
|
39
88
|
@synthesize delegate = _delegate;
|
|
89
|
+
@synthesize staticMode = _staticMode;
|
|
40
90
|
|
|
41
91
|
- (instancetype)init {
|
|
42
92
|
if (self = [super init]) {
|
|
@@ -45,9 +95,14 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
45
95
|
_pendingMarkerViews = [NSMutableArray array];
|
|
46
96
|
_pendingPolylineViews = [NSMutableArray array];
|
|
47
97
|
_pendingPolygonViews = [NSMutableArray array];
|
|
98
|
+
_pendingCircleViews = [NSMutableArray array];
|
|
99
|
+
_pendingGroundOverlayViews = [NSMutableArray array];
|
|
100
|
+
_pendingTileOverlayViews = [NSMutableArray array];
|
|
48
101
|
_polylineAnimators = [NSMapTable weakToStrongObjectsMapTable];
|
|
49
102
|
_polygonToViewMap = [NSMapTable strongToWeakObjectsMapTable];
|
|
103
|
+
_circleToViewMap = [NSMapTable strongToWeakObjectsMapTable];
|
|
50
104
|
_markerToViewMap = [NSMapTable strongToWeakObjectsMapTable];
|
|
105
|
+
_groundOverlayToViewMap = [NSMapTable strongToWeakObjectsMapTable];
|
|
51
106
|
}
|
|
52
107
|
return self;
|
|
53
108
|
}
|
|
@@ -68,13 +123,6 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
68
123
|
if (_mapView)
|
|
69
124
|
return;
|
|
70
125
|
|
|
71
|
-
GMSMapID *gmsMapId;
|
|
72
|
-
if ([_mapId isEqualToString:kDemoMapId] || _mapId.length == 0) {
|
|
73
|
-
gmsMapId = [GMSMapID demoMapID];
|
|
74
|
-
} else {
|
|
75
|
-
gmsMapId = [GMSMapID mapIDWithIdentifier:_mapId];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
126
|
GMSCameraPosition *camera =
|
|
79
127
|
[GMSCameraPosition cameraWithLatitude:coordinate.latitude
|
|
80
128
|
longitude:coordinate.longitude
|
|
@@ -83,7 +131,7 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
83
131
|
GMSMapViewOptions *options = [[GMSMapViewOptions alloc] init];
|
|
84
132
|
options.frame = wrapperView.bounds;
|
|
85
133
|
options.camera = camera;
|
|
86
|
-
options.mapID =
|
|
134
|
+
options.mapID = LuggGMSMapIDFromString(_mapId);
|
|
87
135
|
|
|
88
136
|
_mapView = [[GMSMapView alloc] initWithOptions:options];
|
|
89
137
|
_mapView.autoresizingMask =
|
|
@@ -101,6 +149,9 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
101
149
|
[self processPendingMarkers];
|
|
102
150
|
[self processPendingPolylines];
|
|
103
151
|
[self processPendingPolygons];
|
|
152
|
+
[self processPendingCircles];
|
|
153
|
+
[self processPendingGroundOverlays];
|
|
154
|
+
[self processPendingTileOverlays];
|
|
104
155
|
|
|
105
156
|
[_delegate mapProviderDidReady];
|
|
106
157
|
}
|
|
@@ -110,13 +161,26 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
110
161
|
[_pendingMarkerViews removeAllObjects];
|
|
111
162
|
[_pendingPolylineViews removeAllObjects];
|
|
112
163
|
[_pendingPolygonViews removeAllObjects];
|
|
164
|
+
[_pendingCircleViews removeAllObjects];
|
|
165
|
+
[_pendingGroundOverlayViews removeAllObjects];
|
|
166
|
+
[_pendingTileOverlayViews removeAllObjects];
|
|
113
167
|
[_polylineAnimators removeAllObjects];
|
|
114
168
|
[_polygonToViewMap removeAllObjects];
|
|
169
|
+
[_circleToViewMap removeAllObjects];
|
|
115
170
|
[_markerToViewMap removeAllObjects];
|
|
116
|
-
[
|
|
171
|
+
[_groundOverlayToViewMap removeAllObjects];
|
|
172
|
+
[self destroyMapView];
|
|
173
|
+
_isMapReady = NO;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
- (void)destroyMapView {
|
|
177
|
+
if (!_mapView)
|
|
178
|
+
return;
|
|
179
|
+
|
|
180
|
+
_mapView.delegate = nil;
|
|
117
181
|
[_mapView removeFromSuperview];
|
|
182
|
+
[_mapView clear];
|
|
118
183
|
_mapView = nil;
|
|
119
|
-
_isMapReady = NO;
|
|
120
184
|
}
|
|
121
185
|
|
|
122
186
|
#pragma mark - Props
|
|
@@ -137,30 +201,41 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
137
201
|
_mapView.settings.tiltGestures = enabled;
|
|
138
202
|
}
|
|
139
203
|
|
|
204
|
+
- (void)setCompassEnabled:(BOOL)enabled {
|
|
205
|
+
_mapView.settings.compassButton = enabled;
|
|
206
|
+
}
|
|
207
|
+
|
|
140
208
|
- (void)setUserLocationEnabled:(BOOL)enabled {
|
|
141
209
|
_mapView.myLocationEnabled = enabled;
|
|
142
210
|
}
|
|
143
211
|
|
|
144
|
-
- (void)
|
|
212
|
+
- (void)setInsetAdjustment:(LuggMapViewInsetAdjustment)insetAdjustment {
|
|
213
|
+
_mapView.paddingAdjustmentBehavior =
|
|
214
|
+
(insetAdjustment == LuggMapViewInsetAdjustment::Automatic)
|
|
215
|
+
? kGMSMapViewPaddingAdjustmentBehaviorAlways
|
|
216
|
+
: kGMSMapViewPaddingAdjustmentBehaviorNever;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
- (void)setPoiEnabled:(BOOL)enabled {
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
- (void)setPoiFilterMode:(LuggMapViewPoiFilterMode)mode {
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
- (void)setPoiFilterCategories:(NSArray<NSString *> *)categories {
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
- (void)setMapType:(LuggMapViewMapType)mapType {
|
|
229
|
+
_mapView.mapType = LuggGMSMapTypeFromMapType(mapType);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
- (void)setTheme:(LuggMapViewTheme)theme {
|
|
145
233
|
_theme = theme;
|
|
146
234
|
[self applyTheme];
|
|
147
235
|
}
|
|
148
236
|
|
|
149
237
|
- (void)applyTheme {
|
|
150
|
-
|
|
151
|
-
return;
|
|
152
|
-
|
|
153
|
-
switch (_theme) {
|
|
154
|
-
case 1: // Dark
|
|
155
|
-
_mapView.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
|
|
156
|
-
break;
|
|
157
|
-
case 0: // Light
|
|
158
|
-
_mapView.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
|
|
159
|
-
break;
|
|
160
|
-
default: // System
|
|
161
|
-
_mapView.overrideUserInterfaceStyle = UIUserInterfaceStyleUnspecified;
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
238
|
+
_mapView.overrideUserInterfaceStyle = LuggInterfaceStyleFromTheme(_theme);
|
|
164
239
|
}
|
|
165
240
|
|
|
166
241
|
- (void)setMinZoom:(double)minZoom {
|
|
@@ -291,15 +366,26 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
291
366
|
}
|
|
292
367
|
|
|
293
368
|
- (void)mapView:(GMSMapView *)mapView didTapOverlay:(GMSOverlay *)overlay {
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
369
|
+
if ([overlay isKindOfClass:[GMSPolygon class]]) {
|
|
370
|
+
GMSPolygon *polygon = (GMSPolygon *)overlay;
|
|
371
|
+
LuggPolygonView *polygonView = [_polygonToViewMap objectForKey:polygon];
|
|
372
|
+
if (polygonView && polygonView.tappable) {
|
|
373
|
+
[polygonView emitPressEvent];
|
|
374
|
+
}
|
|
375
|
+
} else if ([overlay isKindOfClass:[GMSCircle class]]) {
|
|
376
|
+
GMSCircle *circle = (GMSCircle *)overlay;
|
|
377
|
+
LuggCircleView *circleView = [_circleToViewMap objectForKey:circle];
|
|
378
|
+
if (circleView && circleView.tappable) {
|
|
379
|
+
[circleView emitPressEvent];
|
|
380
|
+
}
|
|
381
|
+
} else if ([overlay isKindOfClass:[GMSGroundOverlay class]]) {
|
|
382
|
+
GMSGroundOverlay *groundOverlay = (GMSGroundOverlay *)overlay;
|
|
383
|
+
LuggGroundOverlayView *groundOverlayView =
|
|
384
|
+
[_groundOverlayToViewMap objectForKey:groundOverlay];
|
|
385
|
+
if (groundOverlayView && groundOverlayView.tappable) {
|
|
386
|
+
[groundOverlayView emitPressEvent];
|
|
387
|
+
}
|
|
388
|
+
}
|
|
303
389
|
}
|
|
304
390
|
|
|
305
391
|
- (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker {
|
|
@@ -312,15 +398,21 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
312
398
|
|
|
313
399
|
LuggCalloutView *calloutView = markerView.calloutView;
|
|
314
400
|
if (calloutView && calloutView.hasCustomContent) {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
401
|
+
if (markerView.centerOnPress) {
|
|
402
|
+
[mapView animateToLocation:marker.position];
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
mapView.selectedMarker = marker;
|
|
406
|
+
|
|
407
|
+
if (!calloutView.bubbled) {
|
|
408
|
+
[self showNonBubbledCallout:markerView];
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return YES;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
if (!markerView.centerOnPress) {
|
|
415
|
+
mapView.selectedMarker = marker;
|
|
324
416
|
return YES;
|
|
325
417
|
}
|
|
326
418
|
}
|
|
@@ -439,13 +531,43 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
439
531
|
if (contentSize.width <= 0 || contentSize.height <= 0)
|
|
440
532
|
return;
|
|
441
533
|
|
|
442
|
-
CGPoint
|
|
534
|
+
CGPoint offset = calloutView.offset;
|
|
443
535
|
CGPoint point = [_mapView.projection
|
|
444
536
|
pointForCoordinate:_activeNonBubbledMarker.coordinate];
|
|
445
537
|
|
|
538
|
+
UIView *iconView = _activeNonBubbledMarker.iconView;
|
|
539
|
+
CGFloat markerHeight =
|
|
540
|
+
iconView.bounds.size.height * _activeNonBubbledMarker.scale;
|
|
541
|
+
|
|
446
542
|
contentView.center =
|
|
447
|
-
CGPointMake(point.x +
|
|
448
|
-
point.y
|
|
543
|
+
CGPointMake(point.x + offset.x,
|
|
544
|
+
point.y - markerHeight * _activeNonBubbledMarker.anchor.y -
|
|
545
|
+
contentSize.height / 2.0 + offset.y);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
- (void)showCalloutForMarkerView:(LuggMarkerView *)markerView {
|
|
549
|
+
LuggCalloutView *calloutView = markerView.calloutView;
|
|
550
|
+
if (calloutView && calloutView.hasCustomContent) {
|
|
551
|
+
[self dismissNonBubbledCallout];
|
|
552
|
+
GMSMarker *marker = (GMSMarker *)markerView.marker;
|
|
553
|
+
if (calloutView.bubbled) {
|
|
554
|
+
_mapView.selectedMarker = marker;
|
|
555
|
+
} else {
|
|
556
|
+
[self showNonBubbledCallout:markerView];
|
|
557
|
+
}
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
if (markerView.title.length > 0) {
|
|
562
|
+
_mapView.selectedMarker = (GMSMarker *)markerView.marker;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
- (void)hideCalloutForMarkerView:(LuggMarkerView *)markerView {
|
|
567
|
+
[self dismissNonBubbledCallout];
|
|
568
|
+
if (_mapView.selectedMarker == markerView.marker) {
|
|
569
|
+
_mapView.selectedMarker = nil;
|
|
570
|
+
}
|
|
449
571
|
}
|
|
450
572
|
|
|
451
573
|
#pragma mark - MarkerViewDelegate
|
|
@@ -470,6 +592,24 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
470
592
|
[self syncPolygonView:polygonView];
|
|
471
593
|
}
|
|
472
594
|
|
|
595
|
+
#pragma mark - CircleViewDelegate
|
|
596
|
+
|
|
597
|
+
- (void)circleViewDidUpdate:(LuggCircleView *)circleView {
|
|
598
|
+
[self syncCircleView:circleView];
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
#pragma mark - GroundOverlayViewDelegate
|
|
602
|
+
|
|
603
|
+
- (void)groundOverlayViewDidUpdate:(LuggGroundOverlayView *)groundOverlayView {
|
|
604
|
+
[self syncGroundOverlayView:groundOverlayView];
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
#pragma mark - TileOverlayViewDelegate
|
|
608
|
+
|
|
609
|
+
- (void)tileOverlayViewDidUpdate:(LuggTileOverlayView *)tileOverlayView {
|
|
610
|
+
[self syncTileOverlayView:tileOverlayView];
|
|
611
|
+
}
|
|
612
|
+
|
|
473
613
|
#pragma mark - Marker Management
|
|
474
614
|
|
|
475
615
|
- (void)addMarkerView:(LuggMarkerView *)markerView {
|
|
@@ -734,6 +874,243 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
734
874
|
[_polygonToViewMap setObject:polygonView forKey:polygon];
|
|
735
875
|
}
|
|
736
876
|
|
|
877
|
+
#pragma mark - Circle Management
|
|
878
|
+
|
|
879
|
+
- (void)addCircleView:(LuggCircleView *)circleView {
|
|
880
|
+
circleView.delegate = self;
|
|
881
|
+
[self syncCircleView:circleView];
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
- (void)removeCircleView:(LuggCircleView *)circleView {
|
|
885
|
+
GMSCircle *circle = (GMSCircle *)circleView.circle;
|
|
886
|
+
if (circle) {
|
|
887
|
+
[_circleToViewMap removeObjectForKey:circle];
|
|
888
|
+
circle.map = nil;
|
|
889
|
+
circleView.circle = nil;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
- (void)syncCircleView:(LuggCircleView *)circleView {
|
|
894
|
+
if (!_mapView) {
|
|
895
|
+
if (![_pendingCircleViews containsObject:circleView]) {
|
|
896
|
+
[_pendingCircleViews addObject:circleView];
|
|
897
|
+
}
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
if (!circleView.circle) {
|
|
902
|
+
[self addCircleViewToMap:circleView];
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
GMSCircle *circle = (GMSCircle *)circleView.circle;
|
|
907
|
+
circle.position = circleView.center;
|
|
908
|
+
circle.radius = circleView.radius;
|
|
909
|
+
circle.fillColor = circleView.fillColor;
|
|
910
|
+
circle.strokeColor = circleView.strokeColor;
|
|
911
|
+
circle.strokeWidth = circleView.strokeWidth;
|
|
912
|
+
circle.zIndex = (int)circleView.zIndex;
|
|
913
|
+
circle.tappable = circleView.tappable;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
- (void)processPendingCircles {
|
|
917
|
+
if (!_mapView)
|
|
918
|
+
return;
|
|
919
|
+
|
|
920
|
+
for (LuggCircleView *circleView in _pendingCircleViews) {
|
|
921
|
+
[self addCircleViewToMap:circleView];
|
|
922
|
+
}
|
|
923
|
+
[_pendingCircleViews removeAllObjects];
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
- (void)addCircleViewToMap:(LuggCircleView *)circleView {
|
|
927
|
+
if (!_mapView)
|
|
928
|
+
return;
|
|
929
|
+
|
|
930
|
+
GMSCircle *circle = [GMSCircle circleWithPosition:circleView.center
|
|
931
|
+
radius:circleView.radius];
|
|
932
|
+
circle.fillColor = circleView.fillColor;
|
|
933
|
+
circle.strokeColor = circleView.strokeColor;
|
|
934
|
+
circle.strokeWidth = circleView.strokeWidth;
|
|
935
|
+
circle.zIndex = (int)circleView.zIndex;
|
|
936
|
+
circle.tappable = circleView.tappable;
|
|
937
|
+
circle.map = _mapView;
|
|
938
|
+
circleView.circle = circle;
|
|
939
|
+
[_circleToViewMap setObject:circleView forKey:circle];
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
#pragma mark - Ground Overlay Management
|
|
943
|
+
|
|
944
|
+
- (void)addGroundOverlayView:(LuggGroundOverlayView *)groundOverlayView {
|
|
945
|
+
groundOverlayView.delegate = self;
|
|
946
|
+
[self syncGroundOverlayView:groundOverlayView];
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
- (void)removeGroundOverlayView:(LuggGroundOverlayView *)groundOverlayView {
|
|
950
|
+
groundOverlayView.delegate = nil;
|
|
951
|
+
GMSGroundOverlay *overlay = (GMSGroundOverlay *)groundOverlayView.overlay;
|
|
952
|
+
if (overlay) {
|
|
953
|
+
[_groundOverlayToViewMap removeObjectForKey:overlay];
|
|
954
|
+
overlay.map = nil;
|
|
955
|
+
groundOverlayView.overlay = nil;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
- (void)syncGroundOverlayView:(LuggGroundOverlayView *)groundOverlayView {
|
|
960
|
+
if (!_mapView) {
|
|
961
|
+
if (![_pendingGroundOverlayViews containsObject:groundOverlayView]) {
|
|
962
|
+
[_pendingGroundOverlayViews addObject:groundOverlayView];
|
|
963
|
+
}
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
NSString *imageUri = groundOverlayView.imageUri;
|
|
968
|
+
if (imageUri.length == 0)
|
|
969
|
+
return;
|
|
970
|
+
|
|
971
|
+
// Remove old overlay
|
|
972
|
+
GMSGroundOverlay *oldOverlay = (GMSGroundOverlay *)groundOverlayView.overlay;
|
|
973
|
+
if (oldOverlay) {
|
|
974
|
+
[_groundOverlayToViewMap removeObjectForKey:oldOverlay];
|
|
975
|
+
oldOverlay.map = nil;
|
|
976
|
+
groundOverlayView.overlay = nil;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// Load image and create overlay
|
|
980
|
+
NSURL *url = [NSURL URLWithString:imageUri];
|
|
981
|
+
if (!url)
|
|
982
|
+
return;
|
|
983
|
+
|
|
984
|
+
__weak __typeof(self) weakSelf = self;
|
|
985
|
+
__weak LuggGroundOverlayView *weakOverlayView = groundOverlayView;
|
|
986
|
+
dispatch_async(
|
|
987
|
+
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
988
|
+
NSData *data = [NSData dataWithContentsOfURL:url];
|
|
989
|
+
UIImage *image = data ? [UIImage imageWithData:data] : nil;
|
|
990
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
991
|
+
[weakSelf addGroundOverlayToMap:weakOverlayView image:image];
|
|
992
|
+
});
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
- (void)addGroundOverlayToMap:(LuggGroundOverlayView *)groundOverlayView
|
|
997
|
+
image:(UIImage *)image {
|
|
998
|
+
if (!_mapView || !groundOverlayView || !image)
|
|
999
|
+
return;
|
|
1000
|
+
|
|
1001
|
+
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc]
|
|
1002
|
+
initWithCoordinate:groundOverlayView.southwest
|
|
1003
|
+
coordinate:groundOverlayView.northeast];
|
|
1004
|
+
|
|
1005
|
+
GMSGroundOverlay *overlay = [GMSGroundOverlay groundOverlayWithBounds:bounds
|
|
1006
|
+
icon:image];
|
|
1007
|
+
overlay.opacity = groundOverlayView.opacity;
|
|
1008
|
+
overlay.bearing = groundOverlayView.bearing;
|
|
1009
|
+
overlay.zIndex = (int)groundOverlayView.zIndex;
|
|
1010
|
+
overlay.tappable = groundOverlayView.tappable;
|
|
1011
|
+
overlay.map = _mapView;
|
|
1012
|
+
|
|
1013
|
+
groundOverlayView.overlay = overlay;
|
|
1014
|
+
[_groundOverlayToViewMap setObject:groundOverlayView forKey:overlay];
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
- (void)processPendingGroundOverlays {
|
|
1018
|
+
if (!_mapView)
|
|
1019
|
+
return;
|
|
1020
|
+
|
|
1021
|
+
for (LuggGroundOverlayView *view in _pendingGroundOverlayViews) {
|
|
1022
|
+
[self syncGroundOverlayView:view];
|
|
1023
|
+
}
|
|
1024
|
+
[_pendingGroundOverlayViews removeAllObjects];
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
#pragma mark - Tile Overlay Management
|
|
1028
|
+
|
|
1029
|
+
- (void)addTileOverlayView:(LuggTileOverlayView *)tileOverlayView {
|
|
1030
|
+
tileOverlayView.delegate = self;
|
|
1031
|
+
[self syncTileOverlayView:tileOverlayView];
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
- (void)removeTileOverlayView:(LuggTileOverlayView *)tileOverlayView {
|
|
1035
|
+
tileOverlayView.delegate = nil;
|
|
1036
|
+
GMSTileLayer *tileLayer = (GMSTileLayer *)tileOverlayView.overlay;
|
|
1037
|
+
if (tileLayer) {
|
|
1038
|
+
tileLayer.map = nil;
|
|
1039
|
+
tileOverlayView.overlay = nil;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
- (void)syncTileOverlayView:(LuggTileOverlayView *)tileOverlayView {
|
|
1044
|
+
if (!_mapView) {
|
|
1045
|
+
if (![_pendingTileOverlayViews containsObject:tileOverlayView]) {
|
|
1046
|
+
[_pendingTileOverlayViews addObject:tileOverlayView];
|
|
1047
|
+
}
|
|
1048
|
+
return;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
NSString *urlTemplate = tileOverlayView.urlTemplate;
|
|
1052
|
+
if (urlTemplate.length == 0)
|
|
1053
|
+
return;
|
|
1054
|
+
|
|
1055
|
+
// Remove old tile layer
|
|
1056
|
+
GMSTileLayer *oldLayer = (GMSTileLayer *)tileOverlayView.overlay;
|
|
1057
|
+
if (oldLayer) {
|
|
1058
|
+
oldLayer.map = nil;
|
|
1059
|
+
tileOverlayView.overlay = nil;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
BOOL hasBounds = tileOverlayView.hasBounds;
|
|
1063
|
+
CLLocationCoordinate2D sw = tileOverlayView.southwest;
|
|
1064
|
+
CLLocationCoordinate2D ne = tileOverlayView.northeast;
|
|
1065
|
+
|
|
1066
|
+
GMSTileURLConstructor constructor = ^NSURL *(NSUInteger x, NSUInteger y,
|
|
1067
|
+
NSUInteger zoom) {
|
|
1068
|
+
if (hasBounds) {
|
|
1069
|
+
double n = pow(2.0, zoom);
|
|
1070
|
+
double tileSW_lat =
|
|
1071
|
+
180.0 / M_PI * atan(sinh(M_PI * (1 - 2.0 * (y + 1) / n)));
|
|
1072
|
+
double tileNE_lat = 180.0 / M_PI * atan(sinh(M_PI * (1 - 2.0 * y / n)));
|
|
1073
|
+
double tileSW_lng = x / n * 360.0 - 180.0;
|
|
1074
|
+
double tileNE_lng = (x + 1) / n * 360.0 - 180.0;
|
|
1075
|
+
|
|
1076
|
+
if (tileNE_lat < sw.latitude || tileSW_lat > ne.latitude ||
|
|
1077
|
+
tileNE_lng < sw.longitude || tileSW_lng > ne.longitude) {
|
|
1078
|
+
return nil;
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
NSString *urlString =
|
|
1083
|
+
[urlTemplate stringByReplacingOccurrencesOfString:@"{x}"
|
|
1084
|
+
withString:[@(x) stringValue]];
|
|
1085
|
+
urlString =
|
|
1086
|
+
[urlString stringByReplacingOccurrencesOfString:@"{y}"
|
|
1087
|
+
withString:[@(y) stringValue]];
|
|
1088
|
+
urlString =
|
|
1089
|
+
[urlString stringByReplacingOccurrencesOfString:@"{z}"
|
|
1090
|
+
withString:[@(zoom) stringValue]];
|
|
1091
|
+
return [NSURL URLWithString:urlString];
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
GMSURLTileLayer *tileLayer =
|
|
1095
|
+
[GMSURLTileLayer tileLayerWithURLConstructor:constructor];
|
|
1096
|
+
tileLayer.tileSize = tileOverlayView.tileSize;
|
|
1097
|
+
tileLayer.opacity = tileOverlayView.opacity;
|
|
1098
|
+
tileLayer.zIndex = (int)tileOverlayView.zIndex;
|
|
1099
|
+
tileLayer.map = _mapView;
|
|
1100
|
+
|
|
1101
|
+
tileOverlayView.overlay = tileLayer;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
- (void)processPendingTileOverlays {
|
|
1105
|
+
if (!_mapView)
|
|
1106
|
+
return;
|
|
1107
|
+
|
|
1108
|
+
for (LuggTileOverlayView *view in _pendingTileOverlayViews) {
|
|
1109
|
+
[self syncTileOverlayView:view];
|
|
1110
|
+
}
|
|
1111
|
+
[_pendingTileOverlayViews removeAllObjects];
|
|
1112
|
+
}
|
|
1113
|
+
|
|
737
1114
|
#pragma mark - Lifecycle
|
|
738
1115
|
|
|
739
1116
|
- (void)pauseAnimations {
|
|
@@ -758,9 +1135,11 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
758
1135
|
return;
|
|
759
1136
|
|
|
760
1137
|
float targetZoom = zoom > 0 ? (float)zoom : _mapView.camera.zoom;
|
|
761
|
-
GMSCameraPosition *camera = [GMSCameraPosition
|
|
762
|
-
|
|
763
|
-
|
|
1138
|
+
GMSCameraPosition *camera = [GMSCameraPosition
|
|
1139
|
+
cameraWithTarget:CLLocationCoordinate2DMake(latitude, longitude)
|
|
1140
|
+
zoom:targetZoom
|
|
1141
|
+
bearing:_mapView.camera.bearing
|
|
1142
|
+
viewingAngle:_mapView.camera.viewingAngle];
|
|
764
1143
|
if (duration < 0) {
|
|
765
1144
|
[_mapView animateToCameraPosition:camera];
|
|
766
1145
|
} else if (duration > 0) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#import "StaticMapProviderBase.h"
|
|
2
|
+
#import <GoogleMaps/GoogleMaps.h>
|
|
3
|
+
|
|
4
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Static Google map. The Google Maps SDK has no async snapshotter, so the
|
|
8
|
+
* base map briefly warms up on a live, tiles-only GMSMapView inserted below
|
|
9
|
+
* the overlays, then is swapped with a rendered image and the map view is
|
|
10
|
+
* pooled for reuse. Markers and shapes are overlay views (shared with
|
|
11
|
+
* Apple static maps) that reveal with the base map, so the warmup map
|
|
12
|
+
* never renders its own markers. Warmup cost scales with how many static
|
|
13
|
+
* maps mount at once - bound that with list props (windowSize etc.).
|
|
14
|
+
*/
|
|
15
|
+
@interface GoogleStaticMapProvider : StaticMapProviderBase <GMSMapViewDelegate>
|
|
16
|
+
|
|
17
|
+
@property(nonatomic, copy, nullable) NSString *mapId;
|
|
18
|
+
|
|
19
|
+
@end
|
|
20
|
+
|
|
21
|
+
NS_ASSUME_NONNULL_END
|