public static Geometry.Vector?point(string tip) { PickPointTool pp = new PickPointTool(); ViewerToolManager.AddTool(pp); CursorTipTool ct = new CursorTipTool(tip); ViewerToolManager.AddTool(ct); MapControl.Current.Cursor = System.Windows.Input.Cursors.Cross; while (true) { Dreambuild.Gis.Desktop.App.DoEvents(); if (pp.Picked) { break; } } ViewerToolManager.RemoveTool(ct); //MainWindow.Current.InitializeTool(); ViewerToolManager.RemoveTool(pp); MapControl.Current.Cursor = System.Windows.Input.Cursors.Arrow; return(pp.Point); }
//[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; }