正常来讲,只要在arcmap中能实现的,用二次开发都能实现。基于这个原则,若是你打算实现某个功能,能够先在arcmap上先试试能不能行得通,固然有些须要算法支持的处理过程只能先写代码在测试了。因为工做须要自动矢量化,在arcmap中能够实现,具体操做你们能够去网上找一下。html
1 public void Vectorize(ref IRasterLayer rasterLayer, ref IFeatureLayer polyLayer, string strWorkspacePath) 2 { 3 IVectorization pVectorization = ArcMap.Application.FindExtensionByName("ESRI ArcScan Tools") as IVectorization; 4 IVectorizationLayers vLayers = pVectorization as IVectorizationLayers; 5 6 vLayers.CurrentLayer = rasterLayer; 7 INotifyGeometryFound notifyGeom = new FoundGeom(polyLayer); 8 try 9 { 10 IWorkspaceFactory pWF = new ShapefileWorkspaceFactory(); 11 IWorkspace pWS = pWF.OpenFromFile(strWorkspacePath, 0); 12 UID uid = new UIDClass(); 13 uid.Value = "esriEidtor.Editor"; 14 IEditor edit = ArcMap.Application.FindExtensionByCLSID(uid) as IEditor; 15 edit.StartEditing(pWS); 16 IMxDocument mxDoc = ArcMap.Application.Document as IMxDocument; 17 pVectorization.Vectorize(false, mxDoc.ActiveView.Extent, notifyGeom, null, null); 18 edit.StopEditing(true); 19 } 20 catch (Exception ex) 21 { 22 MessageBox.Show(ex.Message); 23 } 24 }
1 public class FoundGeom : INotifyGeometryFound 2 { 3 IFeatureLayer m_pPolyLayer; 4 public FoundGeom(IFeatureLayer featureLayer) 5 { 6 m_pPolyLayer = featureLayer; 7 } 8 void INotifyGeometryFound.AddGeometry(IGeometry shape, double LineWidth) 9 { 10 if (shape is IPolygon) 11 { 12 IFeature pfeature = m_pPolyLayer.FeatureClass.CreateFeature(); 13 pfeature.Shape = shape; 14 pfeature.Store(); 15 } 16 17 } 18 }
须要添加ArcScan拓展,在矢量化的过程当中须要设置前景色、背景色以及矢量化中心线仍是轮廓,具体设置方法能够参考官方帮助文档Developer Help for .Net查找ArcScan Namespace Contents算法
转载:http://www.cnblogs.com/tttttye-cnblogs/articles/8966259.html测试