[ios, osx] Feature querying; complex geometry classes
Added methods to MGLMapView that return the rendered features at a visible point or within a visible rectangle on the map, optionally restricted to a set of layers, plus voluminous documentation. Added several new geometry classes corresponding to distinct geometry types supported by geometry.hpp. Added parallel “feature” classes to represent these geometries along with tags (IDs) and attributes (properties) from the source. Grouped classes in the Foundation and SDK groups by theme. In iosapp, dropped pins’ callout views now display the name of the topmost named feature at that point. In osxapp, a long press on the map highlights the features under the cursor. Dropping a pin via the menu or context menu item shows the usual dropped pin, but the pin’s title is now the name of a feature under the cursor, if available, rather than “Dropped Pin”. Fixes the iOS/OS X side of #352.
This commit is contained in:
committed by
Minh Nguyễn
parent
c9520713ca
commit
c6683ee1d3
21
platform/darwin/src/MGLShapeCollection.m
Normal file
21
platform/darwin/src/MGLShapeCollection.m
Normal file
@@ -0,0 +1,21 @@
|
||||
#import "MGLShapeCollection.h"
|
||||
|
||||
@implementation MGLShapeCollection
|
||||
|
||||
+ (instancetype)shapeCollectionWithShapes:(NS_ARRAY_OF(MGLShape <MGLAnnotation> *) *)shapes {
|
||||
return [[self alloc] initWithShapes:shapes];
|
||||
}
|
||||
|
||||
- (instancetype)initWithShapes:(NS_ARRAY_OF(MGLShape <MGLAnnotation> *) *)shapes {
|
||||
if (self = [super init]) {
|
||||
NSAssert(shapes.count, @"Cannot create an empty shape collection");
|
||||
_shapes = shapes.copy;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CLLocationCoordinate2D)coordinate {
|
||||
return _shapes.firstObject.coordinate;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user