首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

insertFeatureClass的三种形式

2012-12-23 
insertFeatureClass的三种方式private IFeatureClass insertFeature_one( IFeatureClass fclass, IFeature

insertFeatureClass的三种方式

 private IFeatureClass insertFeature_one( IFeatureClass fclass, IFeature feature){         try {        IFeatureBuffer pFeatBuf = fclass.createFeatureBuffer();        IFeature pFeat = (IFeature) pFeatBuf;         pFeat.setShapeByRef(feature.getShape());IFeatureCursor pFeatCur = fclass.IFeatureClass_insert(true);pFeatCur.insertFeature(pFeatBuf);pFeatCur.flush();} catch (AutomationException e) {e.printStackTrace();} catch (IOException e){e.printStackTrace();}return fclass;    }        private IFeatureClass insertFeature_second(IFeatureClass fclass, IFeature feature){        try {        IFeature pFeature = fclass.createFeature();        pFeature.setShapeByRef(feature.getShape());        pFeature.store();} catch (AutomationException e) {e.printStackTrace();} catch (IOException e){e.printStackTrace();}return fclass;    }        private IFeatureClass insertFeatures( IFeatureClass fclass, List<IFeature> features){        try {        IFeatureBuffer pFeatBuf = null;        IFeatureCursor pFeatCur = null;        for(int i=0; i<features.size(); i++){        pFeatBuf = fclass.createFeatureBuffer();        pFeatCur = fclass.IFeatureClass_insert(true);            IFeature pFeat = (IFeature) pFeatBuf;             pFeat.setShapeByRef(features.get(i).getShape());    pFeatCur.insertFeature(pFeatBuf);    if(i/100 == 0){    pFeatCur.flush();    }        }        pFeatCur.flush();} catch (AutomationException e) {e.printStackTrace();} catch (IOException e){e.printStackTrace();}return fclass;    }

热点排行