java开发arcgis,几何网络分析怎么实现

如题,有现成的例子吗?网络上查的都是c#的,转成java后报错
比如:
c#是这样写的: 
INetwork pNetwork = _pGeometricNetwork.Network;
INetElements pNetElements = pNetwork as INetElements; 
改成java:
INetElements netElements = (INetElements) geometricNetwork.getNetwork();
然后就报错:
java.lang.ClassCastException: com.esri.arcgis.geodatabase.INetworkProxy cannot be cast to com.esri.arcgis.geodatabase.INetElements
已邀请:

朱新颖

赞同来自: 陈晨

Java中有时需要代理类进行转换,详细请参考http://resources.arcgis.com/en ... 0000/

Java中部分接口转换需要使用代理类,例如:
IWorkspaceFactory wf = new ShapefileWorkspaceFactory();
IFeatureWorkspace fw = new IFeatureWorkspaceProxy(wf.openFromFile("\path\to\data", 0))

// This will not work and throws a java.lang.ClassCastException.
FeatureClass fc = (FeatureClass)fw.openFeatureClass("featureclass name");

// This is the correct way.
IFeatureClass fc = fw.openFeatureClass("featureclass name");
FeatureClass featureClass = new FeatureClass(fc);

// Or,

// This is the correct way using the old proxy style of casting. 
IFeatureClass fc = fw.openFeatureClass("featureclass name");
IGeoDataset gds = new IGeoDatasetProxy(fc);
 

要回复问题请先登录注册