我想在其中绘制带有图像的GMSPolygon或裁剪GMSGroundOverlay的图像。
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:48.774052
longitude:-110.375980
zoom:0];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
GMSMutablePath *shapePath = [[GMSMutablePath alloc] init];
[shapePath addLatitude:48.774052 longitude:-110.375980];
[shapePath addLatitude:40.676195 longitude:-123.911136];
[shapePath addLatitude:33.682907 longitude:-101.762699];
/*** **/
GMSCoordinateBounds *overlayBounds = [[GMSCoordinateBounds alloc] initWithPath:shapePath];
UIImage *icon = [UIImage imageNamed:@"usaimages.jpg"];
GMSGroundOverlay *overlay =
[GMSGroundOverlay groundOverlayWithBounds:overlayBounds icon:icon];
overlay.bearing = 0;
overlay.map = mapView_;
/*** **/
GMSPolygon *shape = [GMSPolygon polygonWithPath:shapePath];
shape.strokeWidth= 2;
shape.title=@"xx";
shape.fillColor= [UIColor redColor];
//shape.strokeColor= [UIColor brownColor];
shape.map=mapView_;
self.view = mapView_;
mapView_.delegate=self;
现在这就是我所看到的:
这就是我想看到的:
我想将标志放入GMSPolygon或通过裁剪GMSGroundOverlay的图标获得相同的结果。我不可能或我怎么做。
答案 0 :(得分:2)
首先裁剪图像,然后使用。我建议使用Gmsgroundoverlay,因为你将对图像有很多控制。像角度,旋转等等