Skip to content

Commit 97b4a99

Browse files
petropavel13maxep
authored andcommittedJan 25, 2019
Add YandexMapKit support (#62)
1 parent 3a8f2aa commit 97b4a99

19 files changed

+916
-35
lines changed
 

‎ClusterKit.podspec

+20-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
Pod::Spec.new do |s|
33
s.name = "ClusterKit"
4-
s.version = "0.3.5"
5-
s.summary = "ClusterKit is a map clustering framework targeting MapKit, Google Maps and Mapbox."
4+
s.version = "0.4.0"
5+
s.summary = "ClusterKit is a map clustering framework targeting MapKit, Google Maps, Mapbox and YandexMapKit."
66

77
s.description = <<-DESC
88
ClusterKit is an efficient clustering framework with the following features:
9-
- Native supports of MapKit, GoogleMaps and Mapbox.
9+
- Native supports of MapKit, GoogleMaps, Mapbox and YandexMapKit.
1010
- Comes with 2 clustering algorithms, a Grid Based Algorithm and a Non Hierarchical Distance Based Algorithm. Other algorithms can easily be integrated.
1111
- Annotations are stored in a QuadTree for efficient region queries.
1212
- Cluster center can be switched to Centroid, Nearest Centroid, Bottom.
@@ -34,12 +34,24 @@ Pod::Spec.new do |s|
3434
ss.dependency 'ClusterKit/Core'
3535
ss.source_files = 'ClusterKit/MapKit'
3636
end
37+
38+
# Like GoogleMaps sdk (googlemaps/google-maps-ios-utils#23) YandexMapKit is statically built,
39+
# which mean we can't use them as subspec dependency yet. Better to keep both
40+
# GoogleMaps and YandexMapKit commented until both of them are dynamically built!
3741

38-
# s.subspec 'GoogleMaps' do |ss|
39-
# ss.dependency 'ClusterKit/Core'
40-
# ss.dependency 'GoogleMaps', '~> 2.7'
41-
# ss.source_files = 'ClusterKit/GoogleMaps'
42-
# end
42+
# s.subspec 'GoogleMaps' do |ss|
43+
# ss.platform = :ios, '8.0'
44+
# ss.dependency 'ClusterKit/Core'
45+
# ss.dependency 'GoogleMaps', '~> 2.7'
46+
# ss.source_files = 'ClusterKit/GoogleMaps'
47+
# end
48+
49+
# s.subspec 'YandexMapKit' do |ss|
50+
# ss.platform = :ios, '9.0'
51+
# ss.dependency 'ClusterKit/Core'
52+
# ss.dependency 'YandexMapKit', '~> 3.2'
53+
# ss.source_files = 'ClusterKit/YandexMapKit'
54+
# end
4355

4456
s.subspec 'Mapbox' do |ss|
4557
ss.platform = :ios, '9.0'

‎ClusterKit.xcodeproj/project.pbxproj

+12
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
/* End PBXContainerItemProxy section */
4444

4545
/* Begin PBXFileReference section */
46+
7884A92A21F1E1C000CCCA71 /* YMKMapView+ClusterKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "YMKMapView+ClusterKit.h"; sourceTree = "<group>"; };
47+
7884A92B21F1E1C000CCCA71 /* YMKMapView+ClusterKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "YMKMapView+ClusterKit.m"; sourceTree = "<group>"; };
4648
9C2C4A0C1F94BACE00B22745 /* MGLMapView+ClusterKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "MGLMapView+ClusterKit.h"; path = "ClusterKit/Mapbox/MGLMapView+ClusterKit.h"; sourceTree = SOURCE_ROOT; };
4749
9C2C4A0D1F94BACE00B22745 /* MGLMapView+ClusterKit.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "MGLMapView+ClusterKit.m"; path = "ClusterKit/Mapbox/MGLMapView+ClusterKit.m"; sourceTree = SOURCE_ROOT; };
4850
9C4C93E11E4250D500927A42 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = "<group>"; };
@@ -101,6 +103,15 @@
101103
/* End PBXFrameworksBuildPhase section */
102104

103105
/* Begin PBXGroup section */
106+
7884A92921F1E1C000CCCA71 /* YandexMapKit */ = {
107+
isa = PBXGroup;
108+
children = (
109+
7884A92A21F1E1C000CCCA71 /* YMKMapView+ClusterKit.h */,
110+
7884A92B21F1E1C000CCCA71 /* YMKMapView+ClusterKit.m */,
111+
);
112+
path = YandexMapKit;
113+
sourceTree = "<group>";
114+
};
104115
9C2C4A0B1F94BA7D00B22745 /* Mapbox */ = {
105116
isa = PBXGroup;
106117
children = (
@@ -117,6 +128,7 @@
117128
9C53CD161E03F51C000AD9B8 /* MapKit */,
118129
9C53CD131E03F51C000AD9B8 /* GoogleMaps */,
119130
9C2C4A0B1F94BA7D00B22745 /* Mapbox */,
131+
7884A92921F1E1C000CCCA71 /* YandexMapKit */,
120132
);
121133
path = ClusterKit;
122134
sourceTree = "<group>";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#import <YandexMapKit/YMKMapKit.h>
2+
#import <ClusterKit/ClusterKit.h>
3+
4+
NS_ASSUME_NONNULL_BEGIN
5+
6+
/**
7+
The YMKMapViewDataSource protocol is adopted by an object that mediates the YMKMap’™s data. The data source provides the placemarks that represent clusters on map.
8+
*/
9+
@protocol YMKMapViewDataSource <NSObject>
10+
11+
@optional
12+
/**
13+
Asks the data source for a marker that represent the given cluster.
14+
15+
@param mapView A map view object requesting the marker.
16+
@param cluster The cluster to represent.
17+
18+
@return An object inheriting from GMSMarker that the map view can use for the specified cluster.
19+
*/
20+
- (__kindof YMKPlacemarkMapObject *)mapView:(YMKMapView *)mapView placemarkForCluster:(CKCluster *)cluster;
21+
22+
@end
23+
24+
/**
25+
YMKPlacemarkMapObject category adopting the CKAnnotation protocol.
26+
*/
27+
@interface YMKPlacemarkMapObject (ClusterKit)
28+
29+
/**
30+
The cluster that the marker is related to.
31+
*/
32+
@property (nonatomic, weak, nullable) CKCluster *cluster;
33+
34+
@end
35+
36+
@interface YMKMapView (ClusterKit) <CKMap>
37+
38+
/**
39+
Data source instance that adopt the YMKMapViewDataSource.
40+
*/
41+
@property(nonatomic, weak) IBOutlet id<YMKMapViewDataSource> dataSource;
42+
43+
/**
44+
Returns the placemark representing the given cluster.
45+
46+
@param cluster The cluster for which to return the corresponding placemark.
47+
48+
@return The value associated with cluster, or nil if no value is associated with cluster.
49+
*/
50+
- (nullable __kindof YMKPlacemarkMapObject *)placemarkForCluster:(CKCluster *)cluster;
51+
52+
- (YMKCameraPosition *)cameraPositionThatFits:(CKCluster *)cluster;
53+
54+
- (YMKCameraPosition *)cameraPositionThatFits:(CKCluster *)cluster edgePadding:(UIEdgeInsets)insets;
55+
56+
@end
57+
58+
@interface YMKPoint (ClusterKit)
59+
60+
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
61+
62+
@end
63+
64+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)