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; }
//[DemoTool("test")] //public void test() //{ // Gui.WebBrowser("test", GetFileUrl("Web/legend.html"), 300, 300); //} //private static string GetFileUrl(string relativeUrl) //{ // return string.Format("file://{0}/{1}", Environment.CurrentDirectory, relativeUrl); //} private void AddSpotInternal(string layerName, Func <Geometry.Vector, IFeature> featureSelector) { PickPointTool pp = new PickPointTool(); CursorTipTool ct = new CursorTipTool("指定点"); CombinedViewerTool cvt = new CombinedViewerTool(pp, ct); var mLayer = MapControl.Current.FindMapLayers(layerName).FirstOrDefault(); if (mLayer == null) { return; } pp.PointPicked += p => { mLayer.AddFeature(featureSelector(p)); MapControl.Current.AdjustMagFactor(); }; ViewerToolManager.ExclusiveTool = cvt; }