ArcGIS for IOS 添加多个覆盖物,并设置点击覆盖物触发委托

    //创建点状符号
    AGSSimpleMarkerSymbol *myMarkerSymbol =     [AGSSimpleMarkerSymbol simpleMarkerSymbol];
    myMarkerSymbol.color = [UIColor blueColor];
    multiPoint = [[AGSMutableMultipoint alloc] initWithSpatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326 WKT:nil]];
    //创建点形状
    AGSPoint* point  = [AGSPoint pointWithX:112.29 y:34.94 spatialReference:nil];
    //    [ performSelector:@selector(setst:) withObject:point afterDelay:0.1];
    [multiPoint addPoint: point];
    [multiPoint addPoint: [AGSPoint pointWithX:114.29 y:34.94 spatialReference:nil]];
    [multiPoint addPoint: [AGSPoint pointWithX:116.29 y:34.94 spatialReference:nil]];
    

    //组装点要素
    myGraphic = [AGSGraphic graphicWithGeometry:multiPoint
                                              symbol:myMarkerSymbol          attributes:nil   infoTemplateDelegate:self];

    //将点要素添加到图形图层

  
  
[self.graphicsLayer addGraphic:myGraphic];
//以上代码就是添加多点到图层里面,添加委托
//AGSInfoTemplateDelegate  就可以在
//组装点要素方法的参数infoTemplateDelegate:self,具体触发方法如下
/** Title text to be displayed in the callout.
 @param graphic The graphic to display a title for.
 @param screen The coordinates at which the graphic callout will be displayed.
 @param mapPoint The coordinates at which the graphic callout will be displayed.
 @return The title text for the callout.
 @since 1.0
 */
- (NSString *)titleForGraphic:(AGSGraphic *)graphic screenPoint:(CGPoint)screen mapPoint:(AGSPoint *)mapPoint{
    return @"title";
}

/** Detail string to be displayed in the callout.
 @param graphic The graphic to display detail for.
 @param screen The coordinates at which the graphic callout will be displayed.
 @param mapPoint The coordinates at which the graphic callout will be displayed.
 @return The detail text for the callout.
 @since 1.0
 */
- (NSString *)detailForGraphic:(AGSGraphic *)graphic screenPoint:(CGPoint)screen mapPoint:(AGSPoint *)mapPoint{
    return @"Detail";
}

/** Image to be displayed in the callout to the left of the text. The image will be scaled to
 40x40 points.
 @param graphic The graphic to display the image for.
 @param screen The coordinates at which the graphic callout will be displayed.
 @param mapPoint The coordinates at which the graphic callout will be displayed.
 @return The image to be displayed in the callout.
 @since 1.8
 */
-(AGSImage*)imageForGraphic:(AGSGraphic *)graphic screenPoint:(CGPoint)screen mapPoint:(AGSPoint *)mapPoint{
    NSLog(@"+++%f",mapPoint.x);
    return nil;
}

/** The custom view to be displayed in the callout. If you implement this function then the title, detail
 and image methods will not get called, as only the custom view will be displayed in the callout. The callout will be expanded
 to the dimensions of the custom view.
 @param graphic The graphic to display the custom view for.
 @param screen The coordinates at which the graphic callout will be displayed.
 @param mapPoint The coordinates at which the graphic callout will be displayed.
 @return The custom view to be displayed in the callout.
 @since 1.8
 */
-(AGSView*)customViewForGraphic:(AGSGraphic *)graphic screenPoint:(CGPoint)screen mapPoint:(AGSPoint *)mapPoint{
    return nil;
}
//具体需要看着几个方法的英文翻译,需要点击弹出视图就实现customViewForGraphic方法,返回一个AGSView 就可以实现点击覆盖物弹出自定义视图了


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值