private void btnDrawLine_Click(object sender, EventArgs e) { HookHelper mHook = HookHelper.Instance(); ICommand pCmd = new DrawLineTool(); pCmd.OnCreate(mHook); mHook.MapControl.CurrentTool = pCmd as ITool; }
private void AddPolyInternal(string layerName, Func <List <Geometry.Vector>, IFeature> featureSelector) { DrawLineTool dlt = new DrawLineTool(); CursorTipTool ctt = new CursorTipTool("指定点"); CombinedViewerTool cvt = new CombinedViewerTool(dlt, ctt); var mLayer = MapControl.Current.FindMapLayers(layerName).FirstOrDefault(); if (mLayer == null) { return; } dlt.Completed += pts => { mLayer.AddFeature(featureSelector(pts)); }; ViewerToolManager.ExclusiveTool = cvt; }