#pragma mark -添加
- (void)addStopAnnotation
{
CGFloat space = 0.01;
if (self.stopPointMarray.count >= 2 && self.planMArray.count > 2) {
if (fabs([[[self.stopPointMarray firstObject] firstObject] doubleValue] - [[[self.planMArray firstObject] firstObject] doubleValue]) < space &&
fabs([[self.stopPointMarray firstObject][1] doubleValue] - [[self.planMArray firstObject][1] doubleValue]) < space) {
[self.stopPointMarray removeObjectAtIndex:0];
}
if (fabs([[[self.stopPointMarray lastObject] firstObject] doubleValue] - [[[self.planMArray lastObject] firstObject] doubleValue]) < space &&
fabs([[self.stopPointMarray lastObject][1] doubleValue] - [[self.planMArray lastObject][1] doubleValue]) < space) {
[self.stopPointMarray removeObjectAtIndex:self.stopPointMarray.count - 1];
}
}
for (NSInteger i = 0; i < self.stopPointMarray.count; i++) {
NSArray *array = self.stopPointMarray[i];
SFPointAnnotation *arrivelPoint = [[SFPointAnnotation alloc] init];
arrivelPoint.coordinate = CLLocationCoordinate2DMake([array[1] doubleValue], [array[0] doubleValue]);
arrivelPoint.annotationType = StopPointType;
[self.mapView addAnnotation:arrivelPoint];
//1120
//构造圆
MACircle *circle = [MACircle circleWithCenterCoordinate:CLLocationCoordinate2DMake([array[1] doubleValue], [array[0] doubleValue]) radius:250]; //[array[0] floatValue]
//在地图上添加圆
[_mapView addOverlay: circle];
}
}
#pragma mark - MAMapViewDelegate
- (MAOverlayRenderer *)mapView:(MAMapView *)mapView rendererForOverlay:(id <MAOverlay>)overlay
{
if([overlay isKindOfClass:[MAPolyline class]]){
NSInteger index = [self.lines indexOfObject:overlay];
if(index == 0) {
MAPolylineRenderer *polylineRenderer = [[MAPolylineRenderer alloc] initWithPolyline:(MAPolyline *)overlay];
polylineRenderer.lineWidth = 10.f;
// 利用图片或者这个做一些区别
NSBundle *bundle = [NSBundle bundleWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"AMap.bundle/images"]];
UIImage *image = [UIImage imageNamed:@"traffic_texture_gray" inBundle:bundle compatibleWithTraitCollection:nil];
polylineRenderer.strokeImage = image;
return polylineRenderer;
}else{
MAPolylineRenderer *polylineRenderer = [[MAPolylineRenderer alloc] initWithPolyline:(MAPolyline *)overlay];
polylineRenderer.lineWidth = 10.f;
// 利用图片或者这个做一些区别
NSBundle *bundle = [NSBundle bundleWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"AMap.bundle/images"]];
UIImage *image = [UIImage imageNamed:@"traffic_texture_blue" inBundle:bundle compatibleWithTraitCollection:nil];
polylineRenderer.strokeImage = image;
return polylineRenderer;
}
}
//1120
if ([overlay isKindOfClass:[MACircle class]])
{
MACircleRenderer *circleRenderer = [[MACircleRenderer alloc] initWithCircle:(MACircle *)overlay];
circleRenderer.lineWidth = 2.f;
circleRenderer.strokeColor = [UIColor colorWithRed:70.0/255.0 green:131.0/255.0 blue:245.0/255.0 alpha:0.8];
circleRenderer.fillColor = [UIColor colorWithRed:70.0/255.0 green:131.0/255.0 blue:245.0/255.0 alpha:0.2];
return circleRenderer;
}
return nil;
}
地图-半径
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 近期做时空数据可视化作业时,老师要求阅读论文或者实现项目,在谷歌学术上找到类似一篇文章实现了一个分布式的时空数...
- 听完今晚永澄老师给终身版的加餐,我的感受是: 1.第一次对金钱有了全新的认知。 从小受家庭环境影响,是个财商很低的...