如何向FeatureLayer添加字段?

时间:2015-02-23 04:24:27

标签: java arcgis esri arcobjects

我正在尝试向FeatureLayer添加一个字段,这是我用来执行此操作的代码:

IMxDocument mxd = (IMxDocument) app.getDocument();
FeatureLayer flayer = ((FeatureLayer)mxd.getSelectedLayer());
IField newField = null;
newField = new Field();
IFieldEdit newFieldEdit = (IFieldEdit) newField;
newFieldEdit.setAliasName("Id2");
newFieldEdit.setName("Id2");
newFieldEdit.setType(esriFieldType.esriFieldTypeString);
newFieldEdit.setLength(100);
flayer.addField(newFieldEdit);

然而它提出了一个异常,根据文档我应该得到一个ISchemaLock但我不知道如何从FeatureLayer获取一个schemalock,有没有人有任何想法?

0 个答案:

没有答案