Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        //[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;
        }
Ejemplo n.º 4
0
        public static Extents extents(string tip)
        {
            PickExtentsTool pe = new PickExtentsTool();

            ViewerToolManager.AddTool(pe);
            CursorTipTool ct = new CursorTipTool(tip);

            ViewerToolManager.AddTool(ct);
            MapControl.Current.Cursor = System.Windows.Input.Cursors.Cross;

            while (true)
            {
                Dreambuild.Gis.Desktop.App.DoEvents();
                if (pe.Picked)
                {
                    break;
                }
            }

            ViewerToolManager.RemoveTool(ct);
            ViewerToolManager.RemoveTool(pe);
            MapControl.Current.Cursor = System.Windows.Input.Cursors.Arrow;
            return(pe.Extents);
        }