graphicsLayer 中增加多个graphic 后, 进行缩放定位。然后画一个表示范围的框
来源:互联网 发布:淘宝开店上货教程 编辑:程序博客网 时间:2024/06/04 01:16
主要思路就是在graphicsLayer 中加入多个grpahic 后,重新计算出 包含所有graphic 后的 Envelope。
然后以Envelope 范围画一个graphic 再增加到 graphicsLayer
DLog(@"查询到%d条记录",featureSet.features.count) AGSSimpleLineSymbol *fillSym = [AGSSimpleLineSymbol simpleLineSymbol]; fillSym.color = [UIColor whiteColor]; for(int i=0; i < featureSet.features.count; i++) { AGSGraphic *gra = [featureSet.features objectAtIndex:i]; gra.symbol = fillSym; [self.graphicsLayer addGraphic:gra]; } if ( self.query1Completed == self.query2Completed && self.query1Completed == TRUE) { //开始缩放到路段集合 if (self.graphicsLayer.graphics != NULL && self.graphicsLayer.graphics.count >=1) { //accumulate the min/max double xmin = ((AGSGraphic *)self.graphicsLayer.graphics[0]).geometry.envelope.xmin; double ymin = ((AGSGraphic *)self.graphicsLayer.graphics[0]).geometry.envelope.ymin; double xmax = ((AGSGraphic *)self.graphicsLayer.graphics[0]).geometry.envelope.xmax; double ymax = ((AGSGraphic *)self.graphicsLayer.graphics[0]).geometry.envelope.ymax; for (int i=0;i<self.graphicsLayer.graphics.count;i++) { if (((AGSGraphic *)self.graphicsLayer.graphics[i]).geometry.envelope.xmin < xmin) xmin = ((AGSGraphic *)self.graphicsLayer.graphics[i]).geometry.envelope.xmin; if (((AGSGraphic *)self.graphicsLayer.graphics[i]).geometry.envelope.xmax > xmax) xmax = ((AGSGraphic *)self.graphicsLayer.graphics[i]).geometry.envelope.xmax; if (((AGSGraphic *)self.graphicsLayer.graphics[i]).geometry.envelope.ymin < ymin) ymin = ((AGSGraphic *)self.graphicsLayer.graphics[i]).geometry.envelope.ymin; if (((AGSGraphic *)self.graphicsLayer.graphics[i]).geometry.envelope.ymax > ymax) ymax = ((AGSGraphic *)self.graphicsLayer.graphics[i]).geometry.envelope.ymax; } AGSMutableEnvelope *extent = [AGSMutableEnvelope envelopeWithXmin:xmin ymin:ymin xmax:xmax ymax:ymax spatialReference:self.mapView.spatialReference]; [extent expandByFactor:1.5]; // 画一个方框,就是在graphicsLayer中加入一个 画好方框的graphic AGSCompositeSymbol *symbol = [AGSCompositeSymbol compositeSymbol]; AGSSimpleLineSymbol *lineSymbol = [[AGSSimpleLineSymbol alloc] init]; lineSymbol.color = [UIColor colorWithRed:0.286 green:0.690 blue:0.838 alpha:0.200]; lineSymbol.width = 1; [symbol addSymbol:lineSymbol]; AGSSimpleFillSymbol *fillSymbol = [[AGSSimpleFillSymbol alloc] init]; fillSymbol.color = [UIColor colorWithRed:0.939 green:0.940 blue:0.422 alpha:0.200]; [symbol addSymbol:fillSymbol]; //graphicsLayer 中加入一个graphic。这个graphic 是 指定了 symbol 和 geometry<span style="color:#ff0000;"> [self.graphicsLayer addGraphic:[AGSGraphic graphicWithGeometry:extent symbol:symbol attributes:nil]];</span><span style="white-space:pre"></span> // 主线程刷新界面开始 if ([NSThread isMainThread]) { [self.mapView zoomToEnvelope:extent animated:YES]; } else { dispatch_sync(dispatch_get_main_queue(), ^{ //Update UI in UI thread here [self.mapView zoomToEnvelope:extent animated:YES]; }); } // 主线程刷新界面结束 }
0 0
- graphicsLayer 中增加多个graphic 后, 进行缩放定位。然后画一个表示范围的框
- 一个字节的表示范围
- 1个字节表示数的范围
- java 中int是32位,表示的大小范围是31个9?
- C语言中数据类型的表示范围
- C++ 中各种类型的表示范围
- 功能及需求:pictureBox里图像的缩放,要求不保存缩放后的图像,只对原图像进行查看式缩放,且图像缩小然后放大,处理图像失真的问题。
- 利用latex进行表格缩放和增加题目的方法
- 编写一个存储过程,根据学号、课程号 按成绩的20%进行加分,如果增加后的分数大于100,则取消加分。同时在存储过程中返回增加后的成绩。
- 高德定位后缩放级别的设置
- 数的表示范围的一个小问题
- 把一个整数中数位上的偶数相加,奇数加1后累加,然后输出
- char表示的范围
- 使用WSDL组合多个Web服务以增加应用程序的使用范围
- 使用WSDL组合多个Web服务以增加应用程序的使用范围
- 如何用js实现,在一个页面有个输入文档框,然后点击查询按扭后,调用IE的查询功能在当前页面进行查询
- 导出多个sheet的Excel以及在服务器上压缩文件然后再导出(在这里是压缩一个excel后导出)
- why c语言中int的表示范围是-32768~32767(假设int占用2个字节)
- SQL面试50题
- 黑马程序员——高新技术(概述)
- ice slice Forward Declarations
- 目标黑马,我的自学之路:第四章 面向对象(下)
- POJ 1106 Transmitters (几何覆盖问题)
- graphicsLayer 中增加多个graphic 后, 进行缩放定位。然后画一个表示范围的框
- Python算法笔试题目,破解Hash值,回溯法
- Android从相册中获取图片以及路径
- C语言的数组名和对数组名取地址
- poj2586
- 这是我的第一篇文章
- Cocos2d-x schedule用法
- 关于android中自定义contentprovider的使用
- 行转列之随着记录数增加,列数不固定,且不是多少条行边多少列