正常來講,只要在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測試