(AGSLayer*)layer atPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint 这个方法怎么不走?

- (BOOL)mapView:(AGSMapView *)mapView shouldHitTestLayer:(AGSLayer*)layer atPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint;
这个方法怎么不走?遵循了AGSMapViewLayerDelegate协议也设置了代理 self.mapView.layerDelegate = self;但是无论怎样点击就是不走代理方法
,请问这个方法什么时候才走?
已邀请:

goldenlimit - Major in MIS and minor in GIS, graduated from University of Alabama. GIS is not a simply tool but a way of exploring the unknow

赞同来自: 朱政

你好[zhang6332]

主要问题是你用这个method跟什么layer去做互动,如果是featureLayer是可以work的,因为在SDK 文档里面写明了find which features in the specified layer intersect the tapped location,注明的是某一个layer下面的某个feature。 如果你用的是imageLayer或者dynamicLayer,这个method不会trigger因为既不是某个layer(dynamicLayer是多个layer)也不是feature (imageLayer是raster data而不是vector data),如果是这种情况 你需要用使用touchDelegate下的didClickAtPoint method
 
请参考我的sample github:
https://github.com/goldenlimit ... tiveC 
希望对你有帮助。
 

zhang6332 - 90 IT

赞同来自:

您好,如果是imagelayer就只能使用touchDelegate下的- (void)mapView:(AGSMapView *)mapView didClickAtPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint features:(NSDictionary *)features 方法,然后判断当前点击位置是不是在imagelayer的范围内了吗?而且还要遵守agslayerdelegate,设置imagerlayer。delegate = self,才可以获得imagelayer的范围是吗?如果有多个imagelayer就必须循环遍历去判断了吗?
还有一个问题就是为神魔安卓的dynamicLayer可以加载自己发的imageServer影像服务,而我的AGSDynamicMapServiceLaye加载不出来,只能用AGSImageServiceLayer去加载自己发的imageServer影像服务啊?自己发的mapServer服务只能通过AGSTiledMapServiceLayer加载?像这些加了MapService的层跟不加有神魔区别啊?比如AGSTiledMapServiceLayer和AGSTiledLayer有神魔不同的了?分别用在什么场合的啊?希望能够帮我解答,谢谢!

要回复问题请先登录注册