@@ -72,12 +72,12 @@ - (void)testPolyline {
72
72
CLLocationCoordinate2DMake (101.0 , 0.0 ),
73
73
};
74
74
75
- NSUInteger lnc = sizeof (lineCoordinates) / sizeof (CLLocationCoordinate2D);
76
- MGLPolyline *line = [MGLPolyline polylineWithCoordinates: lineCoordinates count: lnc ];
75
+ NSUInteger lineCoordinatesCount = sizeof (lineCoordinates) / sizeof (CLLocationCoordinate2D);
76
+ MGLPolyline *line = [MGLPolyline polylineWithCoordinates: lineCoordinates count: lineCoordinatesCount ];
77
77
CLLocationCoordinate2D lineCenter = CLLocationCoordinate2DMake (100.0 , 0.0 );
78
78
79
- XCTAssert ([line coordinate ].latitude == lineCenter.latitude &&
80
- [line coordinate ].longitude == lineCenter.longitude );
79
+ XCTAssertEqual ([line coordinate ].latitude , lineCenter.latitude );
80
+ XCTAssertEqual ( [line coordinate ].longitude , lineCenter.longitude );
81
81
82
82
}
83
83
@@ -110,12 +110,12 @@ - (void)testPolygon {
110
110
CLLocationCoordinate2DMake (100.0 , 1.0 ),
111
111
};
112
112
113
- NSUInteger snc = sizeof (squareCoordinates) / sizeof (CLLocationCoordinate2D);
114
- MGLPolygon *squarePolygon = [MGLPolygon polygonWithCoordinates: squareCoordinates count: snc ];
113
+ NSUInteger squareCoordinatesCount = sizeof (squareCoordinates) / sizeof (CLLocationCoordinate2D);
114
+ MGLPolygon *squarePolygon = [MGLPolygon polygonWithCoordinates: squareCoordinates count: squareCoordinatesCount ];
115
115
CLLocationCoordinate2D squareCenter = CLLocationCoordinate2DMake (100.5 , 0.5 );
116
116
117
- XCTAssert ([squarePolygon coordinate ].latitude == squareCenter.latitude &&
118
- [squarePolygon coordinate ].longitude == squareCenter.longitude );
117
+ XCTAssertEqual ([squarePolygon coordinate ].latitude , squareCenter.latitude );
118
+ XCTAssertEqual ( [squarePolygon coordinate ].longitude , squareCenter.longitude );
119
119
120
120
}
121
121
@@ -200,6 +200,11 @@ - (void)testPointCollection {
200
200
NSUInteger numberOfCoordinates = sizeof (coordinates) / sizeof (CLLocationCoordinate2D);
201
201
202
202
MGLPointCollection *pointCollection = [MGLPointCollection pointCollectionWithCoordinates: coordinates count: numberOfCoordinates];
203
+ CLLocationCoordinate2D pointsCenter = CLLocationCoordinate2DMake (0 , 1 );
204
+
205
+ XCTAssertEqual ([pointCollection coordinate ].latitude , pointsCenter.latitude );
206
+ XCTAssertEqual ([pointCollection coordinate ].longitude , pointsCenter.longitude );
207
+
203
208
NSString *filePath = [self temporaryFilePathForClass: [MGLPointCollection class ]];
204
209
[NSKeyedArchiver archiveRootObject: pointCollection toFile: filePath];
205
210
@@ -249,6 +254,30 @@ - (void)testMultiPolyline {
249
254
CLLocationCoordinate2DMake (20 , 21 ),
250
255
CLLocationCoordinate2DMake (30 , 31 ),
251
256
};
257
+
258
+ CLLocationCoordinate2D line1[] = {
259
+ CLLocationCoordinate2DMake (100 , 40 ),
260
+ CLLocationCoordinate2DMake (105 , 45 ),
261
+ CLLocationCoordinate2DMake (110 , 55 )
262
+ };
263
+
264
+ CLLocationCoordinate2D line2[] = {
265
+ CLLocationCoordinate2DMake (105 , 40 ),
266
+ CLLocationCoordinate2DMake (110 , 45 ),
267
+ CLLocationCoordinate2DMake (115 , 55 )
268
+ };
269
+
270
+ NSUInteger road1CoordinatesCount = sizeof (line1) / sizeof (CLLocationCoordinate2D);
271
+ NSUInteger road2CoordinatesCount = sizeof (line2) / sizeof (CLLocationCoordinate2D);
272
+
273
+ MGLPolyline *road1Polyline = [MGLPolyline polylineWithCoordinates: line1 count: road1CoordinatesCount];
274
+ MGLPolyline *road2Polyline = [MGLPolyline polylineWithCoordinates: line1 count: road2CoordinatesCount];
275
+
276
+ MGLMultiPolyline *roads = [MGLMultiPolyline multiPolylineWithPolylines: @[road1Polyline, road2Polyline]];
277
+ CLLocationCoordinate2D roadCenter = CLLocationCoordinate2DMake (100 , 40 );
278
+
279
+ XCTAssertEqual ([roads coordinate ].latitude , roadCenter.latitude );
280
+ XCTAssertEqual ([roads coordinate ].longitude , roadCenter.longitude );
252
281
253
282
NSUInteger numberOfCoordinates = sizeof (coordinates) / sizeof (CLLocationCoordinate2D);
254
283
@@ -280,7 +309,7 @@ - (void)testMultiPolygon {
280
309
CLLocationCoordinate2DMake (30 , 31 ),
281
310
};
282
311
283
- CLLocationCoordinate2D outterSquare [] = {
312
+ CLLocationCoordinate2D outerSquare [] = {
284
313
CLLocationCoordinate2DMake (100.0 , 0.0 ),
285
314
CLLocationCoordinate2DMake (101.0 , 0.0 ),
286
315
CLLocationCoordinate2DMake (101.0 , 1.0 ),
@@ -294,16 +323,16 @@ - (void)testMultiPolygon {
294
323
CLLocationCoordinate2DMake (100.35 , 0.65 ),
295
324
};
296
325
297
- NSUInteger noc = sizeof (outterSquare ) / sizeof (CLLocationCoordinate2D);
298
- NSUInteger nic = sizeof (innerSquare) / sizeof (CLLocationCoordinate2D);
326
+ NSUInteger outerCoordinatesCount = sizeof (outerSquare ) / sizeof (CLLocationCoordinate2D);
327
+ NSUInteger innerCoordinatesCount = sizeof (innerSquare) / sizeof (CLLocationCoordinate2D);
299
328
300
- MGLPolygon *outterPolygonSquare = [MGLPolygon polygonWithCoordinates: outterSquare count: noc ];
301
- MGLPolygon *innerPolygonSquare = [MGLPolygon polygonWithCoordinates: innerSquare count: nic ];
302
- MGLMultiPolygon *squares = [MGLMultiPolygon multiPolygonWithPolygons: @[outterPolygonSquare , innerPolygonSquare]];
329
+ MGLPolygon *innerPolygonSquare = [MGLPolygon polygonWithCoordinates: innerSquare count: innerCoordinatesCount ];
330
+ MGLPolygon *outerPolygonSquare = [MGLPolygon polygonWithCoordinates: outerSquare count: outerCoordinatesCount interiorPolygons: @[innerPolygonSquare] ];
331
+ MGLMultiPolygon *squares = [MGLMultiPolygon multiPolygonWithPolygons: @[outerPolygonSquare , innerPolygonSquare]];
303
332
CLLocationCoordinate2D squareCenter = CLLocationCoordinate2DMake (100.5 , 0.5 );
304
333
305
- XCTAssert ([squares coordinate ].latitude == squareCenter.latitude &&
306
- [squares coordinate ].longitude == squareCenter.longitude );
334
+ XCTAssertEqual ([squares coordinate ].latitude , squareCenter.latitude );
335
+ XCTAssertEqual ( [squares coordinate ].longitude , squareCenter.longitude );
307
336
308
337
NSUInteger numberOfCoordinates = sizeof (coordinates) / sizeof (CLLocationCoordinate2D);
309
338
0 commit comments