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
比如:
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
1 个回复
朱新颖
赞同来自: 陈晨
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);
要回复问题请先登录或注册