少尉

嗯。

 

arcgis api for ios

my name is barry

copy

Bookmark

http://blog.3snews.net/?barry

空间管理

您的位置: 3sNews博客 » my name is barry » 日志

发布新日志


  • ArcGIS application for iOS v1.8 发布
    2011-03-04 15:06:39
    http://www.giser.net/?p=266

    ArcGIS application for iOS v1.8 已经正式发布,可以去appStore上下载:
    http://itunes.com/apps/ArcGIS
    v1.8最大的变化是对国际化语言的支持,简体中文版本也在其中。这次发布总共有5种国际语言版本,分别是:
    法语
    德语
    西班牙语
    日语
    简体中文
    其中在AppStore的中国商店种下载到的将是简体中文版本,感兴趣的同学们可以去下载体验,免费的。

    http://www.giser.net/?p=266


    查看(100) 评论(0) 收藏 分享 圈子 管理 
  • ArcGIS API for iOS 中的几何对象
    2011-03-01 14:38:28
    http://www.giser.net/?p=262

    ArcGIS API for iOS 中的几何对象
    ArcGIS API for iOS包含5种轻量级的几何对象类,这些类用来在地图上显示几何对象的形状,同时可以传送给ArcGIS Server用来进行空间分析。虽然ArcGIS Desktop支持3D几何坐标(x,y,z),但ArcGIS API for iOS只支持2D几何坐标(x,y),并且对M值和ID值也暂不支持。
    1 ArcGIS API for iOS中的五种基本几何类型为:
    point
    Multipoint
    polyline
    polygon
    Envelope
    2 ArcGIS API for iOS 中的几何对象都具有空间参考属性,并可以 通过两种方式来定义:
    well-known ID (WKID)
    well-known text (WKT)
    3 可变与不可变对象
    Objective-C中的对象都有两种,即可变与不可变对象,可变对象可以用来编辑,不可变对象不能够编辑,因此ArcGIS API for iOS 中的几何对象也存在可变与不可变对象,对照表如下:
    Geometry type            Immutable object    Mutable object
    Point                AGSPoint        AGSMutablePoint
    Multipoint            AGSMultipoint        AGSMutableMultipoint
    Polyline            AGSPolyline        AGSMutablePolyline
    Polygon                AGSPolygon        AGSMutablePolygon
    Envelope            AGSEnvelope        AGSMutableEnvelope
    在ArcGIS Server发布的web服务中返回的几何对象绝大多数为不可变对象,但是可以通过使用mutableCopy 方法方便的将不可变对象转换成为可变对象,示例代码如下:
    AGSPoint* point = …;
    AGSMutablePoint* mutable = [point mutableCopy];
    [mutable updateWithX:20 y:20];
    4 点对象(Point)
    点对象的构造方法比较简单,只有x,y坐标和参考系信息,如下:
    AGSPoint* point = [AGSPoint pointWithX:10 y:10 spatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326 WKT:nil]];
    5 多点对象(Multipoint)
    多点是点对象的集合,同时具有空间参考信息,构造方法如下:
    AGSMutableMultipoint multiPoint = [[AGSMutableMultipoint alloc] initWithSpatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326 WKT:nil]];
    [multiPoint addPoint: [AGSPoint pointWithX:10 y:10 spatialReference:nil]];
    [multiPoint addPoint: [AGSPoint pointWithX:20 y:20 spatialReference:nil]];
    [multiPoint addPoint: [AGSPoint pointWithX:30 y:30 spatialReference:nil]];
    6 线(Polyline)
    线是由path组成,path是连续的线段,同时具有空间参考信息,构造方法如下:
    AGSMutablePolyline* poly = [[AGSMutablePolyline alloc] initWithSpatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326 WKT:nil]];
    [poly addPathToPolyline];
    [poly addPointToPath:[AGSPoint pointWithX:10 y:10 spatialReference:nil]];
    [poly addPointToPath:[AGSPoint pointWithX:30 y:10 spatialReference:nil]];
    [poly addPointToPath:[AGSPoint pointWithX:30 y:30 spatialReference:nil]];
    [poly addPathToPolyline];
    [poly addPointToPath:[AGSPoint pointWithX:20 y:10 spatialReference:nil]];
    [poly addPointToPath:[AGSPoint pointWithX:20 y:-10 spatialReference:nil]];
    7 多边形(polygon)
    多边形对象由环(ring)组成,ring是连续闭合的线段,同时具有空间参考信息,构造方法如下:
    AGSMutablePolygon* poly = [[AGSMutablePolygon alloc] initWithSpatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326 WKT:nil]];
    [poly addRingToPolygon];
    [poly addPointToRing:[AGSPoint pointWithX:10 y:10 spatialReference:nil]];
    [poly addPointToRing:[AGSPoint pointWithX:30 y:10 spatialReference:nil]];
    [poly addPointToRing:[AGSPoint pointWithX:30 y:30 spatialReference:nil]];
    [poly addPointToRing:[AGSPoint pointWithX:10 y:30 spatialReference:nil]];
    [poly addPointToRing:[AGSPoint pointWithX:10 y:10 spatialReference:nil]];
    [poly addRingToPolygon];
    [poly addPointToRing:[AGSPoint pointWithX:-10 y:-10 spatialReference:nil]];
    [poly addPointToRing:[AGSPoint pointWithX:-30 y:-10 spatialReference:nil]];
    [poly addPointToRing:[AGSPoint pointWithX:-30 y:-30 spatialReference:nil]];
    [poly addPointToRing:[AGSPoint pointWithX:-10 y:-30 spatialReference:nil]];
    [poly addPointToRing:[AGSPoint pointWithX:-10 y:-10 spatialReference:nil]];
    8 矩形对象
    矩形对象存储两对坐标,分别为(xmin,ymin)和(xmax,ymax),同时具有空间参考信息,存储范围信息,构造方法如下:
    AGSEnvelope env = [AGSEnvelope envelopeWithXmin:10 ymin:10 xmax:30 ymax:30 spatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326 WKT:nil]];
    9 几何对象与JSON
    ArcGIS API for iOS 中的几何对象提供了从JSON格式文本构造的方法initWithJSON,和将几何对象转换成JSON格式的方法encodeToJSON,使用方法如下:
    // from json to object
    NSString* jsonPoint = @”{ \”x\” : -118.4 , \”y\” : -45.2 , \”spatialReference\” : {\”wkid\” : 4326} }”;
    SBJsonParser *parser = [[SBJsonParser alloc] init];
    NSDictionary *json = [parser objectWithString:jsonPoint];
    AGSPoint* point = [[AGSPoint alloc] initWithJSON:json];
    // from object to json
    NSDictionary *json = [point encodeToJSON];
    SBJsonWriter *writer = [[SBJsonWriter alloc] init];
    NSString* jsonPoint = [writer stringWithObject:json];
    参考资料:http://help.arcgis.com/en/arcgismobile/10.0/apis/iPhone/concepts/index.html#/Geometry_Objects/00pw0000004r000000/


    http://www.giser.net/?p=262


    查看(43) 评论(0) 收藏 分享 圈子 管理 
  • ArcGIS API for iOS v1.8 beta 发布
    2011-02-28 20:04:16
    提供的新功能包括下面特性:
    • a Sketch layer to easily create and edit geometries 编辑图层
    • a magnifier for the map 放大镜
    • a high-performance, native, Geometry Engine to perform. sophisticated geometric operations locally on the device  原生的高性能几个引擎,用于在设备本地进行几何操作
    • support for web maps
    • a new Route Task to generate point-to-point routes and driving directions using Network Analyst services. 网络分析支持
    • support for map to wrap around the dateline
    • enhanced callout customization including the ability to display custom views in the callout
    • much more…
  • 详细内容请参考:

    http://blogs.esri.com/Dev/blogs/mobilecentral/archive/2011/02/25/ArcGIS-API-for-iOS-v1.8-Beta-is-live_2100_.aspx


    查看(16)
    评论(0) 收藏 分享 圈子 管理 
  • 大众信息分享系统 ipad应用演示视频
    2011-02-23 09:14:44
    http://www.giser.net/?p=254

    大众信息分享系统 ipad应用是为Esri 2010年用户大会开发的一个应用。该应用基于ArcGIS API for iOS开发,提供了基于地理位置的大众信息分享的功能,包图片,文字,链接等。同时还提供了关注度分析的功能,对热点事件进行分析。
    演示视频地址:
    http://tm.esrichina-bj.cn/tm/video/?p=262
    更多演示视频请关注ArcGIS群英萃网站.
    ArcGIS群英萃新浪微博地址:
    http://t.sina.com.cn/esritm


    查看(39) 评论(0) 收藏 分享 圈子 管理 
  • ShapeFile格式的白皮书
    2011-01-24 11:44:30
    原文地址:
    http://www.giser.net/?p=240
    ESRI Shapefile(shp)是Esri公司开发的空间数据开放格式。该文件格式已经成为了地理信息软件界的一个开放标准,成为一个非常重要的交换数据格式,基本上所有的GIS软件都支持Shapefile的读写。
    Shapefile属于一种矢量图形格式,它能够保存几何图形的位置及相关属性。该种文件格式是由多个文件组成的:
    * .shp – 用于保存元素的几何实体。
    * .shx – 用于保存几何实体索引。
    * .dbf – 数据库,用于保存关于元素的属性信息。
    除了以上三个文件格式之外,还可以有其它文件的支持,这样能够优化访问数据库的性能:
    * .sbn 和 .sbx – 保存实体的空间索引。
    * .fbn 和 .fbx – 保存只读实体的空间索引。
    * .ain 和 .aih – 保存列表中活动字段的属性索引。
    * .prj – 保存坐标系统信息。
    * .shp.xml – 保存shapefile的元数据。
    附件为ShapeFile格式的白皮书和扩展的shapeFile说明,在扩展的shapeFile中增加了multiPatch的说明。
    有个这两个白皮书,我们就可以对shp文件进行深入的了解,也可以根据白皮书来实现对shp的读写。
    ESRI_shapefile_technical_description
    extended shapefile format


    http://www.giser.net/?p=240


    查看(68) 评论(1) 收藏 分享 圈子 管理 
  • ArcGIS API for iOS开发教程六 使用GP服务
    2010-12-17 09:39:13
    文章地址:
    http://www.giser.net/?p=82




    在本章中我们将以危险品扩散分析举例,来介绍如何在ArcGIS API for iOS中调用GP服务。
    1、按照前几章介绍的步骤来创建一个基本的地图应用程序,命名为GPDemo。
    2、按照【ArcGIS API for iOS开发之旅】Graphic Layer中的步骤,定义一个GraphicsLayer并添加到地图视图中。
    3、打开GPDemoViewController.h文件,在声明中添加AGSMapViewDelegate和AGSGeoprocessorDelegate,代码如下所示:
    <code>
    @interface GPDemoViewController : UIViewController{
    AGSMapView *mapView;
    AGSGraphicsLayer *graphicsLayer;
    }

    </code>
    4、 打开GPDemoViewController.m文件,实现AGSMapViewDelegate的 -(void)mapview:(AGSMapView *)mapView didClickAtPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint graphics:(NSDictionary *)graphics方法。代码如下:
    <code>
    - (void)mapView:(AGSMapView *)mapViewdidClickAtPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint graphics:(NSDictionary *)graphics
    {
    [self.graphicsLaye rremoveAllGraphics];
    AGSPictureMarkerSymbol *pt = [AGSPictureMarkerSymbol pictureMarkerSymbolWithImageNamed:@"pushpin.png"];
    // this offset is to line the symbol up with the map was actually clicked
    pt.xoffset = 8;
    pt.yoffset = -18;
    // init pushpin with the AGSPictureMarkerSymbol we just created
    AGSGraphic *pushpin = [[AGSGraphicalloc] initWithGeometry:mappoint symbol:pt attributes:nil infoTemplate:nil];
    // add pushpin to graphics layer
    [self.graphicsLayer addGraphic:pushpin];
    // let the graphics layer know it needs to redraw
    [pushpin release];
    [self.graphicsLayer dataChanged];
    AGSGeoprocessor *agp = [[AGSGeoprocesso ralloc] initWithURL:[NSURL URLWithString:kGPLayerURL]];
    // set the delegate so we will be notified of delegate methods
    agp.delegate = self;
    // set the interval to check status to 10 seconds
    agp.interval = 10;
    agp.outputSpatialReference=self.mapView.spatialReference;
    NSMutableArray *features = [[NSMutableArray alloc] init];
    AGSGraphic *gra = [[AGSGraphicalloc] initWithGeometry:mappoint
    symbol:nil
    attributes:nil
    infoTemplate:nil];
    [features addObject:gra];
    // get the parameters from the UI to submit
    AGSFeatureSet *fs= [[[AGSFeatureSet alloc] init]initWithDisplayFieldName:nil
    features:features
    fieldAliases:nil
    spatialReference:nil
    geometryType:AGSGeometryPoint];
    NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
    @"Hydrogen sulfide",@"Material_Type",
    @"45",@"Wind_Bearing__direction_blowing_to__0_-_360_",
    @"Large",@"Large_or_Small_spill",
    @"Day",@"Day_or_Night_incident",
    fs, @"Incident_Point",
    nil];
    // submit the job
    [agps ubmitJobWithParameters:params];
    [agp release];
    }

    <code>
    在上面代码中粗体部分定义了一个AGSGeoprocessor对象和参数,并使用异步方式调用。
    5、实现AGSGeoprocessorDelegate中的方法,用来响应GP调用中以及调用结束后的方法,如下面代码:
    <code>
    - (void)geoprocessor:(AGSGeoprocessor *)geoprocessorwillCheckJobStatus:(NSString *)jobId {
    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
    }
    - (void)geoprocessor:(AGSGeoprocessor *)geoprocessordidCheckJobStatus:(NSString *)jobStatusforJob:(NSString *)jobId {
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
    }
    - (void)geoprocessor:(AGSGeoprocessor *)geoprocessorjobDidFail:(NSString *)jobId status:(NSString *)jobStatus messages:(NSArray *)messages {
    // update status
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示"
    message:@"分析失败!"
    delegate:nil
    cancelButtonTitle:@"确定"
    otherButtonTitles:nil];
    [alert show];
    [alert release];
    }
    - (void)geoprocessor:(AGSGeoprocessor *)geoprocessorjobDidSucceed:(NSString *)jobId status:(NSString *)jobStatus messages:(NSArray *)messages {
    NSLog(@"Job succeeded");
    // query the resulting html
    [geoprocessor queryResultData:jobId paramName:@"outerg_shp"];
    }
    - (void)geoprocessor:(AGSGeoprocessor *)geoprocessordidQueryWithResult:(AGSGeoprocessorParameterValue *)result forJob:(NSString *)jobId {
    inti = 0;
    intguideNum = 0;
    AGSFeatureSet * fs = result.value;
    for (i=0;i&lt;[fs.features count]; i++) {
    AGSGraphic *gra = [fs.features objectAtIndex:i];
    guideNum = [[gra.attributes objectForKey:@"ERGZone"] intValue];
    switch (guideNum) {
    case1:
    {
    AGSSimpleFillSymbol *sfsZone1 =[AGSSimpleFillSymbo lsimpleFillSymbol] ;
    sfsZone1.color=[UIColor colorWithRed:255 green:208 blue:255 alpha:0.5];
    sfsZone1.style. = AGSSimpleFillSymbolStyleSolid;
    gra.symbol = sfsZone1;
    }
    break;
    case2:
    {
    AGSSimpleFillSymbol *sfsZone2 =[AGSSimpleFillSymbol simpleFillSymbol] ;
    sfsZone2.style. = AGSSimpleFillSymbolStyleSolid;
    sfsZone2.color=[UIColor colorWithRed:255 green:0 blue:0 alpha:0.5];
    gra.symbol = sfsZone2;
    }
    break;
    case3:
    {
    AGSSimpleFillSymbol *sfsZone3 =[AGSSimpleFillSymbol simpleFillSymbol] ;
    sfsZone3.style. = AGSSimpleFillSymbolStyleSolid;
    sfsZone3.color=[UIColor colorWithRed:0 green:0 blue:0 alpha:0];
    gra.symbol = sfsZone3;
    }
    break;
    default:
    break;
    }
    [self.graphicsLayer addGraphic:gra];
    }
    [self.graphicsLayer dataChanged];
    }

    </code>
    在 上面代码中,- (void)geoprocessor:(AGSGeoprocessor *)geoprocessorjobDidSucceed:(NSString *)jobId status:(NSString *)jobStatus messages:(NSArray *)messages 函数在GP服务提交成功后响应,我们在该函数中去获取GP分析的结果,使用如下代码:
    [geoprocessorqueryResultData:jobIdparamName:@"outerg_shp"];
    当获取结果成功后,会调用
    - (void)geoprocessor:(AGSGeoprocessor *)geoprocessordidQueryWithResult:(AGSGeoprocessorParameterValue *)result forJob:(NSString *)jobId
    方法,在该方法中,我们将得到的结果符号化后添加到graphicsLayer中。
    6、通过上面几步操作,我们就完成了GP服务的使用,编译,运行,结果如下图:

    代码下载:
  • http://tm.esrichina-bj.cn/tm/tech/?p=705




  • 查看(46)
    评论(1) 收藏 分享 圈子 管理 
  • 成功使用ArcGIS API for iOS加载Google地图
    2010-12-16 16:02:32
    http://www.giser.net/?p=63

    终于能够使用ArcGIS API for iOS加载Google地图,同样的道理我们还可以加载百度地图,mapabc ,mapbar,天地图等等国内的地图,这对国内用户来说在使用国内地图方面又提供了更多选择,当然要在取得国内地图服务商的授权情况下才能使用。
    使用ArcGIS API for iOS加载Google地图的原理和flex API 以及silverlight API 加载Google的地图原理一样,主要是继承TileMapLayer,实现对不同数据源的访问,在ArcGIS API for ios中如何扩展TileMapLayer后面会有详细教程,这里就不多说了,先看两张图:



    http://www.giser.net/?p=63


    查看(155) 评论(1) 收藏 分享 圈子 管理 
  • ArcGIS API for Flex and ArcGIS Viewer for Flex 2.2 发布
    2010-12-15 12:35:35
    http://www.giser.net/?p=61

    主要改进如下:
    1 支持ArcGIS.com Web Maps
    2 新的图例组建和图例widget
    3 编辑的时候支持Undo/Redo
    4 Draw, Data Extract, Query, Search, Static Image, and Time Slider等6个widget用户体验增强。
    详细的更新请查看:
    http://help.arcgis.com/en/webapi/flex/help/index.html#whats_new.htm
    http://help.arcgis.com/en/webapps/flexviewer/help/index.html#whats_new.htm
    http://www.giser.net/?p=61


    查看(84)
    评论(0) 收藏 分享 圈子 管理 
  • 【ArcGIS API for iOS开发教程(五)数据查询
    2010-12-06 16:56:58
    http://www.giser.net/?p=23
  • 本文示例代码下载地址:http://tm.esrichina-bj.cn/tm/tech/?p=644
  • 原文地址:http://tm.esrichina-bj.cn/tm/tech/?p=644
  • 在大量数据及信息面前,如何获得符合自己所需的数据及信息是非常必要且重要的。同其他WebAPIs 一样,ArcGIS API for iOS中同样可以使用queryTask来进行数据查询,并且使用方式也一致。下面我们以一实例来进行详细介绍。
  •         1、按照前几章介绍的步骤来创建一个基本的地图应用程序,这里我们将其命名为QueryDemo。
  •         2、按照【ArcGIS API for iOS开发之旅】Graphic Layer中的步骤,定义一个GraphicsLayer并添加到地图视图中。
  •         3、打开QueryDemoViewController.h文件。在QueryDemoViewController类中定义 AGSQueryTask对象和AGSQuery对象,并声明为QueryDemoViewController类的属性。此外,在声明中添加 AGSQueryTaskDelegate。代码如下
    • @interface QueryDemoViewController: UIViewController <AGSQueryTaskDelegate>{ AGSMapView       *mapview; AGSQueryTask      *queryTask;AGSQuery                *query;AGSGraphicsLayer    *graphicsLayer;}@property(nonatomic, retain) IBOutlet AGSMapView   *mapView;@property(nonatomic, retain) IBOutlet AGSQueryTask     *queryTask;@property(nonatomic, retain) IBOutlet AGSQuery   *query;@property(nonatomic, retain) IBOutlet AGSGraphicsLayer   *graphicsLayer;

  • 复制代码
    4、打开QueryDemoViewController.m文件,完成queryTask和query的属性定义。代码如下
    • @implementation QueryDemoViewController@synthesize mapView;@synthesize queryTask;@synthesize query;@synthesize graphicsLayer;

  • 复制代码
    5、在viewDidLoad函数中,初始化queryTask和query,并执行查询操作。代码如下
    • -(void)viewDidLoad{     [super viewDidLoad];           self.mapView.mapViewDelegate = self;           AGSTitledMapServiceLayer *tiledLayer = [[AGSTiledMapServiceLayer alloc]initWithURL:[NSURL URLWithString:kTiledMapServiceURL]];           [self.mapView addMapLayer:tiledLayer withName"Tiled Layer"];           [tiledLayer release];           self.graphicsLayer = [AGSGraphicsLayer graphicsLayer];          [self.mapView addMapLayer: self.graphicsLayer withName"graphicsLayer"];          NSString *countiesLayerURL = kMapServiceLayerURL;          //set up query task against layer, specify the delegate         self.queryTask = [AGSQueryTask queryTaskWithURL:[NSURL URLWithString:countiesLayerURL];         self.queryTask.delegate = self;         //return all fields in query         self.query = [AGSQuery query];         self.query.outFields = [NSArray arrayWithObjects"*",nil];         self.query.returnGeometry = YES;         self.query.text = @"California";         [self.queryTask executeWithQuery:self.query];         }

  • 复制代码
    6、添加AGSQueryTaskDelegate中的查询响应函数。代码如下
  •           // 在Query成功后响应,将查询结果显示到graphicsLayer上
    • -(void)queryTask: (AGSQueryTask*) queryTask operationNSOperation*) opdidExecuteWithFeatureSetResultAGSFeatureSet*) featureSet{     //get feature, and load in to table         Int i = 0;         for(i=0; i<[featureSet.featurescount]; i++)            {                 AGSSimpleFillSymbol *fillSym = [AGSSimpleFillSymbol simpleFillSymbol];                 fillSym.style. = AGSSimpleFillSymbolStyleSolid;                 fillSym.color = [UIColororangeColor];                AGSGraphic *gra = [featureSet.features objectAtIndex:i];                gra.symbol = fillSym;               [self.graphicsLayer addGraphic:gra];          }              [self.graphicsLayer dataChanged];       }      //if there's an error with the query display it to the uesr 在Query失败后响应,弹出错误提示框            -(void)queryTask: (AGSQueryTask*)queryTask operationNSOperation*)opdidFailWithErrorNSError*)error{             [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;             UIAlertView *alertView = [UIAlertView alloc]initWithTitle"Error"                                         message:[error localizedDescription]                                         delegate:nil                                        cancelButtonTitle"OK"                                       otherButtonTitles:nil];             [alertView show];             [alertView release];         }

  • 复制代码
    7、编译、执行。结果如下图所示:

  • http://www.giser.net/?p=23

    查看(231)
    评论(2) 收藏 分享 圈子 管理 
  • 推荐一个网站:ArcGIS 群英萃
    2010-11-25 10:39:16
    搞GIS的必须收藏的网站,你懂的
    ArcGIS 群英萃
  • http://tm.esrichina-bj.cn/


  • 查看(139)
    评论(4) 收藏 分享 圈子 管理 
  • ArcGIS API for iOS开发教程四 使用GraphicsLayer
    2010-11-11 08:36:12
    原文地址:
  • http://tm.esrichina-bj.cn/tm/tech/?p=604
  • 在前面的章节中,我们已经知道,如何在Apple OS设备上显示地图,不论动态地图服务还是静态地图服务,同时认识了ArcGIS API for iOS中的地图组件——MapView。同其他ArcGIS APIs类似,ArcGIS API for iOS同样也具有自定义数据的Graphics Layer。下面便来介绍在【ArcGIS API for iOS开发之旅】Hello,Map的地图上自定义数据添加的实现。        1、首先按照【ArcGIS API for iOS开发之旅】Hello,Map的新建地图应用程序的步骤创建一个名为GraphicsDemo的程序,同时将地图显示的前期工作准备好。
           2、打开GraphicsDemoViewController.h文件,在GraphicsDemoViewController类中定 义AGSGraphicsLayer对象,并把这个定义声明为该类的属性。此外,在声明中添加对AGSMapViewDelegate的支持。代码如下 (绿色代码表示)
           @interface GraphicsDemoViewController : UIViewController <AGSMapViewDelegate> { 
           AGSMapView *_mapView;
           //定义AGSGraphicsLayer对象
           AGSGraphicsLayer *graphicsLayer;
           //定义isAddPoint,是否增加点
           BOOL isAddPoint;
           }
           @property (nonatomic, retain) IBOutlet AGSMapView *mapView;
           //使用IBOutlet定义graphicsLayer
           @property (nonatomic, retain) IBOutlet AGSGraphicsLayer *graphicsLayer;
           - (IBAction)swithAddPoint:(id)sender;
           @end
           3、打开GraphicsDemoViewController.m文件,进行graphicsLayer属性的声明。代码如下(绿色表示)
           @implementation GraphicsDemoViewController
           @synthesize mapView = _mapView;
           @synthesize graphicsLayer;
           4、在GraphicsDemoViewController.m文件中找到viewDidLoad函数,将graphicsLayer添加到mapView中,并且设置mapView的mapViewDelegate为self。如下代码所示
           - (void)viewDidLoad {
               [superviewDidLoad];
                         self.mapView.mapViewDelegate = self;
                         AGSTiledMapServiceLayer *tiledLayer = [[AGSTiledMapServiceLayer alloc]
                                                                                                 initWithURL:[NSURL  URLWithString:kTiledMapServiceURL ]];    
                         [self.mapView addMapLayer:tiledLayerwithName:@"Tiled Layer"];
                         [tiledLayer release];
                         self.graphicsLayer = [AGSGraphicsLayer graphicsLayer];
                         [self.mapView addMapLayer:self.graphicsLayer withName:@"graphicsLayer"];
                         isAddPoint = YES;     
        
           }
           5、在GraphicsDemoViewController.m文件中添加如下代码,实现点击地图时触发的事件,也即在地图上添加自定义数据时触发的事件
           - (void)mapView:(AGSMapView *)mapViewdidClickAtPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint graphics:(NSDictionary *)graphics{            
                         if (isAddPoint)
                         {
                              //定义一个图片符号 本例选用图钉图片          
                              AGSPictureMarkerSymbol *pt = [AGSPictureMarkerSymbol pictureMarkerSymbol WithImageNamed:@"pushpin.png"];                
                              // 定义图片在地图上的偏移量。默认是图片的左下角,需要进行偏移调整,将图片的中心放在地图上
                              pt.xoffset = 8;
                              pt.yoffset = -18;  
                              //定义一个弹出气泡的模板                
                              pointInfoTemplate *pointTemplate = [[pointInfoTemplate alloc] init];           
                             AGSGraphic *pushpin = [[AGSGraphic alloc] initWithGeometry:mappoint symbol:pt attributes:nil infoTemplate:pointTemplate];                  
                              // 将图钉添加到Graphics Layer中
                            [self.graphicsLayer addGraphic:pushpin];                 
                            [pushpin release];             
                            [pointTemplate release];
                             //刷新
                             [self.graphicsLayer dataChanged];
                         }
           }
           6、进行编译,运行。效果如图所示

    源代码下载地址:
  • http://tm.esrichina-bj.cn/tm/tech/?p=604

  • 查看(85)
    评论(0) 收藏 分享 圈子 管理 
  • 大众信息共享iPad客户端应用程序发布EventShare
    2010-11-02 09:45:49
    EventShare是一个基于地图的SNS应用,能够在地图上分享我们生活的点滴。
  • EventShare是基于ArcGIS API for iOS开发的演示程序,目前只能在已经越狱的iPad上安装(iOS3.2以上),暂不支持iPhone,iPod Touch上安装,该程序只用于ArcGIS API for iOS技术演示,请勿用于其他用途。
  • EventShare的主要功能包括:
  • 1 地图的切换功能,包括四种基础底图(emapzone,bingmaps,1:400万地图以及etm影像地图)
  • 2 生活点滴分享功能,支持四种类型的生活点滴信息的分享(文本,链接,图片,视频)
  • 3 提供了查询功能,可以方便的找到感兴趣的话题
  • 4 提供了在线的关注度分析功能
  • 5 提供了历史浏览功能,可以使用翻页的动作来浏览过去大家分享的话题。
  • 6 定位功能,可以快速定位到你所在的位置
  • 安装方法:
  • 1 下载附件中的eventShare.ipa
  • 2 使用itunes打开(双击ipa文件即可)
  • 3 同步到你的ipad中
  • 4 也可以使用91助手等第三方软件安装
  • 下载地址:
  • EventShare.ipa

  • 查看(79)
    评论(2) 收藏 分享 圈子 管理 
  • ArcGIS API for iOS开发教程三 使用MapView
    2010-11-01 13:41:02
       [ArcGIS API for iOS]Hello,Map里, 我们进行了如何添加并显示一个已做好地图切片的地图服务的操作,认识了ArcGIS API for iOS的地图组件——MapView。同ArcGIS其他地图API类似,地图组件是ArcGIS API for iOS的核心组件。对MapView来说,不仅可显示切片地图服务,还可加载ArcGIS Server发布的动态图层; 此外,OGC标准的WMS服务及矢量数据同样可以进行显示。         在[地理信息共享]专题中,我们了解,很多基础的应用只需在公共空间信息服务基础之上叠加业务数据。本文将主要介绍MapView中基础地图数据(切片地图服务)叠加业务数据动态地图服务的步骤。
            1、  同[ArcGIS API for iOS]Hello,Map中①②步骤一样,新建一个ArcGIS Mapping Application,在此,将该工程命名为FirstMap。
            2、  打开FirstMapViewController.h文件,定义切片地图服务及动态地图服务。同[ArcGIS API for iOS]Hello,Map中一致,只需在切片地图服务定义后面添加动态地图服务的定义即可。
    •  //定义动态地图服务URL地址  美国人口普查的数据服务
    • #define kDynamicMapServiceURL
    • @http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI Census USA/MapServer

  •         3、打开FirstMapViewController.m文件,在viewDidLoad函数中将动态服务添加到mapView中,在[ArcGIS API for iOS]Hello,Map添加切片服务代码后添加如下代码:
    •   //创建AGSDynamicMapServiceLayer dynamicLayer
    •  AGSDynamicMapServiceLayer *dynamicLayer = [[AGSDynamicMapServiceLayeralloc]  initWithURL:[NSURLURLWithString:kDynamicMapServiceURL]];
    • //将dynamicLayer加载至mapView中
    •  [self.mapView addMapLayer:dynamicLayerwithName:@”dynamic Layer”];

  •  
    4、此外,需要对引用计数进行释放。
     
    • [dynamicLayer release];


  •  
    5、进行编译,运行。效果如图所示



    代码下载:http://tm.esrichina-bj.cn/tm/tech/?p=575

    查看(110) 评论(1) 收藏 分享 圈子 管理 
  • ArcGIS 10 中文帮助正式上线
    2010-10-15 09:56:46
    中国用户期待已久的中文帮助已经正式上线,访问下面的地址即可体验
  • http://help.arcgis.com/zh-cn/arcgisdesktop/10.0/help/index.html
    查看(543)
    评论(4) 收藏 分享 圈子 管理 
  • Web墨卡托坐标与WGS84坐标互转
    2010-10-11 11:11:18
    原文地址:
  • http://bbs.esrichina-bj.cn/ESRI/thread-78245-1-1.html
  • 在WebGIS的开发中经常用到的地图投影为Web墨卡托和WGS84,故歌地图,bingmaps,百度地图,mapabc,mapbar,以及 ArcGIS online上的大部分地图为Web墨卡托地图,ArcGIS online上最开始发布的地图投影为WGS84。
  • 在开发过程中很多时候会遇到不同坐标系之间互转的问题,特别是底图使用Web墨卡托,定位(GPS,wifi等)信号坐标为WGS84坐标的时候,那么通 用解决方案就是写一个坐标参考系的转换库,类似于proj4,但一般情况下很少用到那么多的参考系之间的互转,并且在客户端实现或者调用proj4都是一 件很困难或者麻烦的事情,大多数情况下我们实现Web墨卡托坐标与WGS84坐标互转就可以了。
  • 下面是使用objective-c实现的Web墨卡托坐标与WGS84坐标互转程序,当然也可以使用其他语言来实现,使用起来比较简单和方便。
  • //经纬度转墨卡托
  • -(CGPoint )lonLat2Mercator:(CGPoint ) lonLat
  • {
  •     CGPoint  mercator;
  •     double x = lonLat.x *20037508.34/180;
  •     double y = log(tan((90+lonLat.y)*M_PI/360))/(M_PI/180);
  •     y = y *20037508.34/180;
  •     mercator.x = x;
  •     mercator.y = y;
  •     return mercator ;
  • }
  • //墨卡托转经纬度
  • -(CGPoint )Mercator2lonLat:(CGPoint ) mercator
  • {
  •     CGPoint lonLat;
  •     double x = mercator.x/20037508.34*180;
  •     double y = mercator.y/20037508.34*180;
  •     y= 180/M_PI*(2*atan(exp(y*M_PI/180))-M_PI/2);
  •     lonLat.x = x;
  •     lonLat.y = y;
  •     return lonLat;
  • }

  • 查看(435)
    评论(5) 收藏 分享 圈子 管理 
  • ArcGIS API for iOS 开发环境
    2010-09-17 09:37:24
    马达加斯加中的小企鹅,太可爱了!

  • 查看(99)
    评论(2) 收藏 分享 圈子 管理 
  • 2010华北区用户大会精彩演示预报,敬请期待!
    2010-09-13 13:13:37
    2010华北区用户大会精彩演示预报,敬请期待!
  • 时间:2010年9月14日14:30 - 17:00
          地点:北京  亚运村  北京国际会议中心   二层 1号会议厅    演讲主题:
  • GIS让人类认知世界
  • ArcGIS 10    新技术, 新体验 ,新价值
  •       —— Esri中国(北京) 有限公司 产品技术研究中心
  • 在这个讲座中我们将给大家带来14个精彩演示,敬请期待!
  • 精彩内容如下:
  • 1 Feature Layer & Feature Services ,客户端完美数据展示与编辑解决方案
  • 2 轻松玩转ArcGIS for iOS,iPad应用程序现场展示。
  • 3 全国公共地图服务制作经验谈,带您了解如何只做、发布一副精美地图。
  • 4 计算式服务,给您的应用插上地理服务的翅膀
  • 5 全新的3D新体验,在3D场景中漫游国际会议中心,并且不只是3D展示,还给给您带来精彩的3D分析演示
  • 6 全新的网络分析,web 3D网络分析(纯html5制作,不需要插件哦),另外还有结合历史数据的网络分析,随时随地为您提供更有可参考性的路径规划。
  • 时间:2010年9月14日14:30 - 17:00
          地点:北京  亚运村  北京国际会议中心   二层 1号会议厅    演讲主题:
  • GIS让人类认知世界
  • ArcGIS 10    新技术, 新体验 ,新价值
  •       —— Esri中国(北京) 有限公司 产品技术研究中心
  • 精彩不容错过!


  • 查看(82)
    评论(2) 收藏 分享 圈子 管理 
  • ArcGIS Explorer Online beta 上线
    2010-05-26 09:27:33
    随着www.arcgis.com的正式上线,ArcGIS Explorer Online beta也同时上线。
  • ArcGIS Explorer Online使用silverlight制作,要求silverlight4,地址为:
  • explorer.arcgis.com
  • 一个很酷的应用,推荐给大家

  • 查看(131)
    评论(2) 收藏 分享 圈子 管理 
  • ArcGIS10 GeoDatabase新特性之query layer
    2010-05-14 11:01:51
    一 什么是query layer
  •     query layer是一个通过SQL语句定义的layer(包含空间数据)或是单独表(不包含空间数据)。
  •     在arcmap中通过使用query layer可以很方便的把存储在DBMS中的数据集成进来,因为query layer通过sql语句去直接和DBMS打交道,而不必通过SDE。
  •     在arcmap中使用querylayer的时候,每当刷新地图或使用的时候都会通过SQL语句去重新读取数据,这就保证最新的数据会被加载进来,达到实时更新的效果(因为query里面只是存储的过滤条件,而没有存数据,当数据中数据被修改并满足过滤条件的时候,arcmap中即会显示该数据)。
  •     query layer目前支持所有ArcGIS支持的数据库,包括oracle,sql server,informix,db2,postgresql等。
  •     在arcmap中使用query layer可以快速方便的把空间数据和表格数据集成到GIS工程中,而不必关心这些数据存在哪以及时如何存储的。
  • 下面是使用query layer的一些小的知识:
  •    1 使用query layer可以代替DBMS中的视图 
  •    2 query layer和feature layer以及单独表(stand-alone table)有相同的行为和动作,因此可以用来显示数据,或者作为gp的输入以及使用API去访问。
  • 3query layer可以被保存成图层文件(.lyr) 或者创建成图层包(.lpk),方便与其他的应用程序,地图文档或者其他用户分享。
  • 二 开始使用query layer
  • 1 如果想使用query 来加载空间数据,需要做一下的一些基本工作:
  • 1)必须使用ArcGIS支持的DBMS版本,通过ESRI的support网站可以查询这些信息
  • 2)query layer 的定义必须包含一个唯一的非空的列或者组合列做为主键(Objectid),如果没有的话必须手动加一个。
  • 3)根据不同的DBMS,可能要配置一下DBMS使用的空间类型
  • 4)同样根据不同的DBMS,有可能需要在每个创建query layer连接的的客户端电脑配置一些内容。
  • 2 IBM DB2中需要做如下配置:
  • 1)DB2 必须安装Spatial Extender 组件,不然无法使用ST_Geometry 类型。
  • 2)在创建query layer连接的机器上必须安装DB2 Client并且配置需要连接的DB2数据库,下面的链接说明了如何安装Spatial Extender 组件和如何配置DB2 Client
  • http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?
  • 3 IBM Informix 数据库中需要做如下配置:
  • 1) 安装Spatial DataBlade组件,并且启用ST_Geometry类型
  • 2) 在使用query layer的客户端机器上必须安装Informix client SDK 或者IConnect来配置一个ODBC连接。
  • 4 MS sqlserver
  • 1)如果使用空间数据类型,则必须使用sqlserver2008及以上版本,如果只是非空间数据则sqlserver2005同样支持。
  • 2)在ArcGIS Desktop安装的时候会默认安装SQL Server Native Client 用来支持query layer,因此不必再单独安装SQL Server客户端。
  • 5 Oracle
  • 1)在oracle数据库中支持2种空间数据类型:ST_Geometry和SDO_Geometry.
  • 2) ST_Geometry是ArcSDE使用的数据类型,如果要使用该类型,必须安装ArcSDE for oracle并且在Geodatebase中使用。
  • 3)SDO_Geometry数据类型是oracle默认支持的空间数据类型,但如果想要能够访问这种数据类型需要安装oracle spatial组件。
  • 6 PostgreSQL 
  • 1)PostgreSQL同样支持2中空间数据类型:ST_Geometry和 PostGIS geometry.
  • 2) ST_Geometry是ArcSDE使用的数据类型,如果要使用该类型,必须安装ArcSDE for PostgreSQL并且
  • 3)PostGIS geometry 必须单独安装,装好之后必须使用PostGIS template database,因为该类型数据库使用PostGIS geometry 来存储空间数据。在Geodatebase中使用。
  • 三 使用query layer
  • 1) 打开arcmap ,选择File->Add Data > Add Query Layer,如图3-1。
  • 2)点击connections,进行数据库连接,如图3-2。
  • 3)点击new,设置数据库连接,如图3-3为例,我们使用oracle10g数据库,使用ST_Geometry为空间数据类型。
  • 4)点击ok,返回到创建query layer界面,如图3-4,选择SDE.BLOCKS表双击。输入名称QueryBlocks,并编辑Query栏中的sql语句,我们选择 OBJECTID_1 >11000的要素,sql语句为"select * from SDE.BLOCKS where OBJECTID_1 >11000"
  • 5)点击validate,验证通过后点击finish。如果需要设置unique identifier field ,勾上show Advanced Options ,进入下一步。
  • 6)经过上面的步骤,query layer就加载到Arcmap中了,如图3-5。这时候我们就可以像操作其他图层一样对query layer操作。
  • 7)我们打开query layer的属性,如图3-6,在source面板中可以点击change query来修改query layer的选择条件,如图3-7
  • 8)为了共享我们的query layer,可以把layer保存成lyr文件或者create layer package,如图3-8
  • 9) query layer是只读的,不能被编辑。

  • 查看(430)
    评论(0) 收藏 分享 圈子 管理 
  • ArcGIS API for Flex Tool机制扩展
    2010-03-02 15:01:04
    在ArcGIS API for Flex 1.0-1.3版本中,提供了两个内置的工具Navigation和Draw,每个工具都提供了active和deactive的方法,但这样会产生一个 问题,在地图上有可能同时存在两个工具同时处于active状态,这样将造成有两个工具同时都会响应鼠标消息,形成打架的情况。当然,可以通过两个工具的 同时控制避免这种情况出现,但当存在多个自己扩展tool的时候,控制将非常复杂,造成很多问题。因此,有必要彻底解决这个问题,保证当前有且只有一个 tool处于活动状态。
  • 在下面的内容中,将介绍一种在ArcGIS API for Flex中tool的扩展机制来解决这个问题。
  • 对于Map,基本思路如下:
  • 1 继承Map,并使新的map维护一个tool列表,并且接管map的鼠标响应消息。
  • 2 提供tool的注册函数,能够将工具注册到tool列表中
  • 3 能够设置当前工作的tool,即currentTool属性
    • package com.esriChina.tm.toolExtended
    • {
    •     import com.esri.ags.Map;
    •     
    •     import flash.events.MouseEvent;
    •     import flash.utils.Dictionary;
    •     public class NewMap extends Map
    •     {
    •         private var _tools:Dictionary;
    •         private var _curToolName:String;
    •         private var _curTool:Object;
    •         override public function NewMap()
    •         {
    •             super();
    •             _tools = new Dictionary();
    •             
    •         }
    •         private function EnablePan(enable:Boolean):void
    •         {
    •             this.mapNavigationEnabled = enable;
    •             this.doubleClickZoomEnabled =enable;
    •             this.clickRecenterEnabled = enable;
    •             this.panEnabled = enable;
    •             this.rubberbandZoomEnabled = enable;
    •             this.keyboardNavigationEnabled = enable;
    •             this.scrollWheelZoomEnabled = enable;
    •             this.zoomSliderVisible = enable;
    •         }
    •         private function addToolListener():void
    •         {
    •             if(_curTool == null)
    •                 return;
    •                    //     this.panArrowsVisible = false;
    •             EnablePan(false);
    •             this.addEventListener(MouseEvent.CLICK,OnMouseClick);
    •             this.addEventListener(MouseEvent.DOUBLE_CLICK,OnMouseDoubleClick);
    •             this.addEventListener(MouseEvent.MOUSE_DOWN,OnMouseDown);    
    •             this.addEventListener(MouseEvent.MOUSE_MOVE,OnMouseMove);
    •             this.addEventListener(MouseEvent.MOUSE_UP,OnMouseUp);
    •             this.addEventListener(MouseEvent.MOUSE_WHEEL,OnMouseWheel);
    •         }
    •         private function removeToolListener():void
    •         {
    •             EnablePan(true);
    •        //     this.panArrowsVisible = true;
    •             this.removeEventListener(MouseEvent.CLICK,OnMouseClick);
    •             this.removeEventListener(MouseEvent.DOUBLE_CLICK,OnMouseDoubleClick);
    •             this.removeEventListener(MouseEvent.MOUSE_DOWN,OnMouseDown);    
    •             this.removeEventListener(MouseEvent.MOUSE_MOVE,OnMouseMove);
    •             this.removeEventListener(MouseEvent.MOUSE_UP,OnMouseUp);
    •             this.removeEventListener(MouseEvent.MOUSE_WHEEL,OnMouseWheel);
    •         }
    •         private function getToolByName(toolName:String):ITool
    •         {
    •             return _tools[toolName] as ITool;
    •         }
    •         public function set currentTool(toolName:String):void
    •         {
    •             _curToolName = toolName;
    •             if(_curTool !=  null)
    •             {
    •                 _curTool.deactive();
    •                 _curTool = null;
    •             }
    •                         
    •             _curTool = _tools[toolName] as ITool;
    •             if(_curTool == null)
    •             {
    •                 removeToolListener();
    •                 _curToolName = null;
    •             }
    •             else
    •             {
    •                 addToolListener();
    •                 _curTool.active();
    •             }
    •         }
    •         public function get currentTool():String
    •         {
    •             return _curToolName;
    •         }
    •         //注册工具,将自定义工具注册到当前map视图中
    •         //返回-1 工具为空或不能转为ITool
    •         //   -2 工具名称为空
    •         //   -3 存在同名工具,不能注册
    •         //    1 注册成功
    •         private function registerTool(tool:Object,data:Object=null):int
    •         {
    •             var toolName:String;
    •             if(tool == null)
    •                 return -1;
    •             toolName = tool.getName();
    •             if(toolName == null || toolName == "")
    •                 return -2;
    •             if(_tools[toolName] == null)
    •             {
    •                 _tools[toolName] = tool;
    •                 tool.create(this as Map,data);
    •                 return 1;
    •             }
    •             else
    •             {
    •                 return -3;
    •             }
    •         }
    •         public function registerToolGroup(toolGroup:BaseToolGroup):void
    •         {
    •             var i:int = 0;
    •             var data:Object;
    •             if(toolGroup == null)
    •                 return;
    •             data =     toolGroup.getShareData();
    •             for(i=0;i<toolGroup.getToolCount();i++)
    •             {
    •                 registerTool(toolGroup.getTool(i),data);
    •             }
    •             
    •         }
    •         private function OnMouseClick(event:MouseEvent):void
    •         {
    •             if(_curTool!= null)
    •             {
    •                 _curTool.OnMouseClick(event);
    •             }
    •         }
    •         private function OnMouseDoubleClick(event:MouseEvent):void
    •         {
    •             if(_curTool!= null)
    •             {
    •                 _curTool.OnMouseDoubleClick(event);
    •             }
    •         }
    •         private function OnMouseDown(event:MouseEvent):void
    •         {
    •             if(_curTool!= null)
    •             {
    •                 _curTool.OnMouseDown(event);
    •             }
    •         }
    •         private function OnMouseMove(event:MouseEvent):void
    •         {
    •             if(_curTool!= null)
    •             {
    •                 _curTool.OnMouseMove(event);
    •             }
    •         }
    •         private function OnMouseUp(event:MouseEvent):void
    •         {
    •             if(_curTool!= null)
    •             {
    •                 _curTool.OnMouseUp(event);
    •             }
    •         }
    •         private function OnMouseWheel(event:MouseEvent):void
    •         {
    •             if(_curTool!= null)
    •             {
    •                 _curTool.OnMouseWheel(event);
    •             }
    •         }
    •         
    •     }
    • }

  • 复制代码
    对于tool,基本思路如下:
  • 1 要能够维护tool的生命周期,包括create,active,deactive等,封装成ICommand接口
  • 2 要能够响应鼠标和键盘消息,包括 OnMouseDown,OnMouseUp,OnMouseMove等,封装成ITool接口
  • 3 要能够将多个tool协同工作,形成toolbar,在本程序中我们称之为toolGroup,为此,封装IToolGroup接口,提供 getTool(index:int),getToolCount(),getName()方法,同时提供BaseToolGroup,实现 IToolGroup接口
  • 下面介绍一下如何创建自己的ToolGroup和tool。
  • 1 实现tool要继承ITool和ICommand接口,并继承EventDispatcher,如果工具不分发消息,也可不继承 EventDispatcher,并实现需要用到的方法,必须实现的方法为create和getName,create方法将Map对象交给 tool,getName得到工具的名称,该名称为全局唯一,不能重复,用来唯一标识一个工具,命名方式可以参考COM组件的命名方 式,toolGroupName.toolName.1例如"NavTool.ZoomIn.1"。
  • 2 可以将toolGroup内所有的工具名称定义到单独的类中,方便管理,例如下面代码:
    • package com.esriChina.tm.tools.NavTool
    • {
    •     public class NavToolDes
    •     {
    •         public static var NavTool_Pan:String = "NavTool.Pan.1";
    •         public static var NavTool_ZoomIn:String = "NavTool.ZoomIn.1";
    •         public static var NavTool_ZoomOut:String = "NavTool.ZoomOut.1";
    •         public function NavToolDes()
    •         {
    •         }
    •     }
    • }

  • 复制代码
    3 实现toolGroup,直接继承BaseToolGroup即可。在NavToolGroup的构造函数中,将在该ToolGroup中的tool创建并加入到toolArray中。
    • package com.esriChina.tm.tools.NavTool
    • {
    •     import com.esriChina.tm.toolExtended.BaseToolGroup;
    •     public class NavToolGroup extends BaseToolGroup
    •     {        
    •         public function NavToolGroup()
    •         {
    •             super();
    •             var panTool:PanTool = new  PanTool();
    •             var zoomInTool:ZoomInTool = new ZoomInTool();
    •             var zoomOutTool:ZoomOutTool = new ZoomOutTool();
    •             this.toolArray.push(panTool);
    •             this.toolArray.push(zoomInTool);
    •             this.toolArray.push(zoomOutTool);
    •         }
    •         override public function getName():String
    •         {
    •             return "NavTool";
    •         }
    •     }
    • }

  • 复制代码
    4 在map中注册toolGroup。创建toolGroup并使用map的registerToolGroup方法注册该toolGroup。
    •     var navToolGroup:NavToolGroup = new NavToolGroup();
    •     map.registerToolGroup(navToolGroup);

  • 复制代码
    5 使用tool。设置map的currentTool属性即可,例如
    • map.currentTool = NavToolDes.NavTool_ZoomIn;

  • 复制代码
    详细的实现和示例代码请下载下面的工程。
  • ToolExtended.zip (339.88 KB)
    查看(199) 评论(1) 收藏 分享 圈子 管理 

67

3/4

<

1

2

3

4

>


barry


用户菜单

我的栏目

标题搜索


我的存档

数据统计

  • 访问量: 41904
  • 日志数: 190
  • 建立时间: 2007-04-01
  • 更新时间: 2011-09-02

RSS订阅


清空Cookie - 联系我们 - 3sNews博客 - 交流论坛 - 空间列表 - 站点存档 - 升级自己的空间

Powered by X-Space 4.0.1 UC © 2001-2008 Comsenz Inc.
京ICP备05007579号

Open Toolbar

posted on 2011-10-12 14:32  moonvan  阅读(2963)  评论(0编辑  收藏  举报

导航