Reputation: 3862
I want to draw a GMSPolygon with an image in it or crop a GMSGroundOverlay's image.
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;
Now this is what I see:
and this is what I want to see:
I want to put the flag into GMSPolygon or get the same result by cropping GMSGroundOverlay's icon. I don't which is possible or how I can do it.
Upvotes: 1
Views: 874
Reputation: 31
crop the image first and then use.i suggest to use Gmsgroundoverlay as u will have a lot of controll over the image.like angle for alingment,rotation etc
Upvotes: 2