How to delete a feature class from a GDB using ArcObjects for Java?

المشرف العام

Administrator
طاقم الإدارة
I've seen this solution which may works in ArcObjects for VB/.Net:

How to overwrite a shapefile or feature class using arcobjects

When I try to convert it into Java, I get a ClassCastException on the IDataset cast.

Here is my code:

IWorkspace workspace = ...IWorkspace2 workspace2 = (IWorkspace2)workspace;if(workspace2.isNameExists(esriDatasetType.esriDTFeatureClass, featureClassName)) { IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace; // ClassCastException here IDataset featureClassDataset = (IDataset)featureWorkspace.openFeatureClass(featureClassName); if(featureClassDataset.canDelete()) { featureClassDataset.delete(); } else { // alert: the feature class exists but couldn't be deleted }}IFeatureClass featureClass = featureDataset.createFeatureClass(...);Does anyone know how we can't use the IDataset interface for a feature class as in VB?

How to delete a feature class in Java else?



أكثر...
 
أعلى