您的位置:首页 > 移动开发 > Objective-C

ArcObject Java API 开发概述

2010-06-02 16:49 363 查看
[b]1.跨平台[/b]

保持平台的兼容性,数据和路径的名称要以小写字母表示,路径要使用相对路径。

[b]2.Interfaces[/b]

ArcObject中接口的命名统一以I开头,接口的代理类命名在接口名称后加上proxy,如下命名:

interface IArea: IUnknown public interface IArea{}

public class IAreaProxy implements IArea{}

ArcGIS API 提供了两种访问对象的方式:

/* Point实现了IPoint这个接口,采用向上转型的方式生成对象 */

IPoint iPoint = new com.esri.arcgis.geometry.Point();

/* 直接实例化 */

Point cPoint = new Point();

注意:不能通过缺省的代理类来访问对象,如下面方式:

IPointProxy proxyPoint = new IPointProxy();//错

[b]3.Classes[/b]

ArcObject提供了三种类:abstract classes, classes, and coclasses,abstract classes不可实例化,coclasses也称Comclasses,可以直接实例化,classes不可以直接实例化。

classes 类可以作为coclasses属性被创建,如下示例代码:

IWorkspaceFactory wf = new ShapefileWorkspaceFactory();

IFeatureWorkspace fw = new IFeatureWorkspaceProxy(wf.openFromFile("\path\to\data", 0)    );

/* Create a feature class from FeatureWorkspace. */

   IFeatureClass fc = fw.openFeatureClass("featureclass name");

[b][b]4.Methods that take out parameters[/b][/b]

关于转型的问题,ArcGIS API不允许向子类数组中传递超类类型,即使该数组已经被转换为超类类型。

下面是正确的出传递方法:
IGeometry[] geoArray = {
new Polyline()
};
tin.interpolateShape(breakline, geoArray, null);
/* Cast the first array element as a Polyline. This is
* the equivalent of calling QueryInterface on IGeometry.
*/
IPolyline firstPolyLine = new IPolylineProxy(geoArray[0]);



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: