@@ -171,4 +171,65 @@ - (void)circles {
171171 // [END maps_ios_shapes_circles_customize]
172172}
173173
174+ - (void )spritePolyLine {
175+ // [START maps_ios_polyline_sprite]
176+ GMSMutablePath *path = [GMSMutablePath path ];
177+ [path addLatitude: -37.81319 longitude: 144.96298 ];
178+ [path addLatitude: -31.95285 longitude: 115.85734 ];
179+ polyline.strokeWidth = 20 ;
180+ GMSPolyline *polyline = [GMSPolyline polylineWithPath: path];
181+
182+ UIImage *image = [UIImage imageNamed: @" imageFromBundleOrAsset" ];
183+ GMSStrokeStyle *transparentStampStroke = [GMSStrokeStyle transparentStrokeWithStampStyle: [GMSSpriteStyle spriteStyleWithImage: image]];
184+
185+ GMSStyleSpan *span = [GMSStyleSpan spanWithStyle: transparentStampStroke];
186+ polyline.spans = @[span];
187+ polyline.map = _mapView;
188+ // [END maps_ios_polyline_sprite]
189+ }
190+
191+ - (void )texturePolyline {
192+ // [START maps_ios_polyline_texture]
193+ GMSMutablePath *path = [GMSMutablePath path ];
194+ [path addLatitude: -37.81319 longitude: 144.96298 ];
195+ [path addLatitude: -31.95285 longitude: 115.85734 ];
196+ GMSPolyline *polyline = [GMSPolyline polylineWithPath: path];
197+ polyline.strokeWidth = 20 ;
198+ GMSStrokeStyle *redWithStamp = [GMSStrokeStyle solidColor: [UIColor redColor ]];
199+
200+ UIImage *image = [UIImage imageNamed: @" imageFromBundleOrAsset" ]; // Image could be from anywhere
201+ redWithStamp.stampStyle = [GMSTextureStyle textureStyleWithImage: image];
202+
203+ GMSStyleSpan *span = [GMSStyleSpan spanWithStyle: redWithStamp];
204+ polyline.spans = @[span];
205+ polyline.map = _mapView;
206+ // [END maps_ios_polyline_texture]
207+ }
208+
209+ - (void )mapCapabilties {
210+ // [START maps_ios_map_capabilities]
211+ GMSMutablePath *path = [GMSMutablePath path ];
212+ [path addLatitude: -37.81319 longitude: 144.96298 ];
213+ [path addLatitude: -31.95285 longitude: 115.85734 ];
214+
215+ UIImage *_Nonnull image = [UIImage imageNamed: @" imageFromBundleOrAsset" ]; // Image could be from anywhere
216+
217+ NSArray <GMSStyleSpan *> * spans;
218+ if (_mapView.mapCapabilities & GMSMapCapabilityFlagsSpritePolylines) {
219+ GMSSpriteStyle *spriteStyle = [GMSSpriteStyle spriteStyleWithImage: image];
220+ GMSStrokeStyle *stroke = [GMSStrokeStyle transparentStrokeWithStampStyle: spriteStyle];
221+ spans = @[ [GMSStyleSpan spanWithStyle: stroke] ];
222+ } else {
223+ GMSStrokeStyle *stroke = [GMSStrokeStyle solidColor: UIColor.clearColor];
224+ stroke.stampStyle = [GMSTextureStyle textureStyleWithImage: image];
225+ spans = @[ [GMSStyleSpan spanWithStyle: stroke] ];
226+ }
227+
228+ GMSPolyline *polyline = [GMSPolyline polylineWithPath: path];
229+ polyline.strokeWidth = 20 ;
230+ polyline.spans = spans;
231+ polyline.map = _mapView;
232+ // [END maps_ios_map_capabilities]
233+ }
234+
174235@end
0 commit comments