建立與設定圓形圖徵
建立與設定圓形圖徵
圓圖徵之建立與設定,包括:地圖上建立圓圖徵、設定圓之中心點及半徑、設定邊框寬度及填充之顏色等,並可動態修改圓之顏色及邊框寬度,建立及設定圓圖徵程式範例如下:
- (void)loadView
{
R = 50;
G = 50;
B = 50;
mapView_ = [[TGMapView alloc] initWithFrame:CGRectZero];
self.view = mapView_;
mapView_.viewer = [TGViewerPosition viewerWithLatitude:23.58 longitude:120.95 zoom:1];
TGCircleOptions *circleOps = [TGCircleOptions options];
circleOps.center = CLLocationCoordinate2DMake(23.97, 121.78);
//設定Circle的中心點
circleOps.radius = 20000; //設定Circle的半徑,單位為公尺
circleOps.strokeWidth = 5; //設定Circle的邊線寬度,單位為Pixel
circleOps.fillColor = [UIColor colorWithRed:R/100 green:G/100 blue:B/100 alpha:1 ];
//設定Circle的顏色
Circle = [mapView_ addCircleWithOptions:circleOps]; //將圓形圖徵加入地圖
}