Removed the MGLStyleLayer protocol, because almost none of its members was actually implemented in every class that adopted the protocol. Removed the unused mapView backpointer property with no replacement. Renamed MGLBaseStyleLayer to MGLStyleLayer. Created the intermediate abstract classes MGLForegroundStyleLayer and MGLVectorStyleLayer to cover subsets of style layer classes with like functionality. Moved each MGLBaseStyleLayer initializer and the corresponding properties down to an abstract subclass such that the initializer makes sense for all concrete subclasses. Moved more initializers and the predicate property up to MGLVectorStyleLayer to eliminate duplication among the concrete subclasses. Marked these initializers as designated initializers. Removed “source” or “layer” before identifier wherever the type of identifier is apparent. Removed extra MGLGeoJSONSource initializer variants in favor of nullable parameters. Added copious documentation comments for source and style layer classes, including several previously undocumented methods and properties. In particular, some preconditions and postconditions have been documented. Added pragma marks to break up the jazzy documentation pages into sections. Reformatted exceptions for consistency.
60 lines
2.2 KiB
Plaintext
60 lines
2.2 KiB
Plaintext
<%
|
|
const type = locals.type;
|
|
const layoutProperties = locals.layoutProperties;
|
|
const paintProperties = locals.paintProperties;
|
|
-%>
|
|
// This file is generated.
|
|
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
|
|
|
|
#import "MGLStyleLayerTests.h"
|
|
|
|
@interface MGL<%- camelize(type) %>LayerTests : MGLStyleLayerTests
|
|
@end
|
|
|
|
@implementation MGL<%- camelize(type) %>LayerTests
|
|
|
|
- (void)test<%- camelize(type) %>Layer {
|
|
<% if (type === 'background') { -%>
|
|
MGL<%- camelize(type) %>StyleLayer *layer = [[MGL<%- camelize(type) %>StyleLayer alloc] initWithIdentifier:@"layerID"];
|
|
<% } else { -%>
|
|
NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"];
|
|
NSURL *url = [NSURL fileURLWithPath:filePath];
|
|
MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"sourceID" URL:url options:nil];
|
|
[self.mapView.style addSource:source];
|
|
MGL<%- camelize(type) %>StyleLayer *layer = [[MGL<%- camelize(type) %>StyleLayer alloc] initWithIdentifier:@"layerID" source:source];
|
|
<% } -%>
|
|
[self.mapView.style addLayer:layer];
|
|
|
|
<% for (const property of layoutProperties) { -%>
|
|
<%- testImplementation(property, type) %>
|
|
<% } -%>
|
|
<% for (const property of paintProperties) { -%>
|
|
<%- testImplementation(property, type) %>
|
|
<% } -%>
|
|
|
|
MGL<%- camelize(type) %>StyleLayer *gLayer = (MGL<%- camelize(type) %>StyleLayer *)[self.mapView.style layerWithIdentifier:@"layerID"];
|
|
XCTAssertTrue([gLayer isKindOfClass:[MGL<%- camelize(type) %>StyleLayer class]]);
|
|
<% for (const property of layoutProperties) { -%>
|
|
<%- testGetterImplementation(property, type) %>
|
|
<% } -%>
|
|
<% for (const property of paintProperties) { -%>
|
|
<%- testGetterImplementation(property, type) %>
|
|
<% } -%>
|
|
|
|
<% for (const property of layoutProperties) { -%>
|
|
<%- testImplementation(property, type, true) %>
|
|
<% } -%>
|
|
<% for (const property of paintProperties) { -%>
|
|
<%- testImplementation(property, type, true) %>
|
|
<% } -%>
|
|
|
|
<% for (const property of layoutProperties) { -%>
|
|
<%- testGetterImplementation(property, type, true) %>
|
|
<% } -%>
|
|
<% for (const property of paintProperties) { -%>
|
|
<%- testGetterImplementation(property, type, true) %>
|
|
<% } -%>
|
|
}
|
|
|
|
@end
|