Ich muss einen Kreis (wie bei MKCircle) auf einem GMSMapView anzeigen. Dies ist bei Verwendung von MKMapView und MKCircle einfach, MKCircle kann jedoch nicht mit GMSMapView verwendet werden. Irgendwelche Ideen?So zeigen Sie einen Kreis in GMSMapView an
Update:
Dies sind die aktuellen (18.03.2013) Optionen:
1. Eine Bodenmarkierung einen Kreis Bild enthält.
2. Ein Kreis mit mehreren Segmenten (Polylinie).
Edit:
3. Google hat einen GMSCircle (23.04.2013)
GMSGroundOverlayOptions *overlayOptions = [GMSGroundOverlayOptions options];
overlayOptions.icon = [UIImage imageNamed:@"circle"];
overlayOptions.position = touchMapCoordinate;
overlayOptions.bearing = 0;
overlayOptions.zoomLevel = 14.3;
[mapView addGroundOverlayWithOptions:overlayOptions];
Für einen Kreis Bild 40x40 Pixel sieht es ok. (Radius beträgt ca. 100 m)
Kleine segmentierter Pfad Lösung:
GMSPolylineOptions *circle = [GMSPolylineOptions options];
CGPoint touchPoint = [mapView.projection pointForCoordinate:touchMapCoordinate];
GMSMutablePath *path = [GMSMutablePath path];
CGPoint circlePoint;
for (int i = 0; i < 360; i++)
{
circlePoint.x = touchPoint.x + radius * cos(i*M_PI/180);
circlePoint.y = touchPoint.y + radius * sin(i*M_PI/180);
CLLocationCoordinate2D aux = [mapView.projection coordinateForPoint:circlePoint];
[path addCoordinate:aux];
}
circle.path = path;
circle.width = 1;
[mapView addPolylineWithOptions:circle];
EDIT: 08.05.2013
GMSCircle Lösung:
CLLocationCoordinate2D circleCenter = CLLocationCoordinate2DMake(latitude, longitude);
GMSCircle *circ = [GMSCircle circleWithPosition:circleCenter
radius:1000];
circ.fillColor = [UIColor blueColor];
circ.strokeColor = [UIColor redColor];
circ.strokeWidth = 5;
circ.map = mapView;
Können Sie veröffentlichen, was Sie bisher versucht? – Noich
Ich habe keine Ahnung, wie man überhaupt anfängt. Ich habe darüber nachgedacht, mit GMSGroundOverlay und GMSGroundOverlayOptions ein Kreissymbol hinzuzufügen, aber das bedeutet, dass der Kreis immer einen bestimmten Radius hat. – Bogus
Es kann nicht funktionieren für iOS 8 –