当前位置: 首页>>代码示例>>C#>>正文


C# MapControl.ActivateTool方法代码示例

本文整理汇总了C#中MapControl.ActivateTool方法的典型用法代码示例。如果您正苦于以下问题:C# MapControl.ActivateTool方法的具体用法?C# MapControl.ActivateTool怎么用?C# MapControl.ActivateTool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MapControl的用法示例。


在下文中一共展示了MapControl.ActivateTool方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeActiveSelectionShouldResetMultiSelectionMode

        public void DeActiveSelectionShouldResetMultiSelectionMode()
        {
            MapControl mapControl = new MapControl();

            SelectTool selectTool = mapControl.SelectTool;
            selectTool.MultiSelectionMode = MultiSelectionMode.Lasso;

            mapControl.ActivateTool(selectTool);
            Assert.AreEqual(MultiSelectionMode.Lasso, selectTool.MultiSelectionMode);

            mapControl.ActivateTool(mapControl.MoveTool);
            Assert.AreEqual(MultiSelectionMode.Rectangle, selectTool.MultiSelectionMode);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:13,代码来源:SelectToolTest.cs

示例2: MapToolMessageBoxDisabledTest

 public void MapToolMessageBoxDisabledTest()
 {
     var demoMapTool = new MapToolMessageBox();
     var mapControl = new MapControl() { Map = new Map(new Size(100, 100)) };
     mapControl.Tools.Add(demoMapTool);
     mapControl.ActivateTool(demoMapTool);
     demoMapTool.Disable();
     WindowsFormsTestHelper.ShowModal(mapControl);
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:9,代码来源:MapToolExample.cs

示例3: MapTestHelper

        public MapTestHelper()
        {
            MapControl = new MapControl();
            MapControl.Dock = DockStyle.Fill;
            // disable dragdrop because it breaks the test runtime
            MapControl.AllowDrop = false;
            
            
            Controls.Add(MapControl);

            coordinateLabel = new Label();
            coordinateLabel.Width = 500;
            coordinateLabel.Location = new Point(5, 5);

            MapControl.Controls.Add(coordinateLabel);
            MapControl.Resize += delegate { MapControl.Refresh(); };
            MapControl.ActivateTool(MapControl.PanZoomTool);

            MapControl.ActivateTool(MapControl.SelectTool);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:20,代码来源:MapTestHelper.cs

示例4: PanZoomUsingMouseWheelTest

        public void PanZoomUsingMouseWheelTest()
        {
            var map = new Map();

            var layer = new OpenStreetMapLayer();
            map.Layers.Add(layer);

            var mapControl = new MapControl { Map = map, AllowDrop = false };

            var tool = new PanZoomUsingMouseWheelTool();
            mapControl.ActivateTool(tool);
           
            WindowsFormsTestHelper.ShowModal(mapControl);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:14,代码来源:MapControlTest.cs

示例5: ShowMapWithQueryToolActive

        public void ShowMapWithQueryToolActive()
        {
            var mapControl = new MapControl();
            var map = new Map(new Size(1, 1));
            const string path = @"..\..\..\..\..\test-data\DeltaShell\DeltaShell.Plugins.SharpMapGis.Tests\RasterData\bodem.bil";

            var layer = new GdalRegularGridRasterLayer(path);

            map.Layers.Add(layer);
            mapControl.Map = map;

            var tool = mapControl.GetToolByType(typeof (QueryTool));
            mapControl.ActivateTool(tool);
            WindowsFormsTestHelper.ShowModal(mapControl);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:15,代码来源:QueryToolTest.cs

示例6: ShowMapWithQueryToolActive

        public void ShowMapWithQueryToolActive()
        {
            var mapControl = new MapControl{ AllowDrop = false };
            var map = new Map(new Size(1, 1));
            //const string path = @"..\..\..\..\..\test-data\DeltaShell\DeltaShell.Plugins.SharpMapGis.Tests\RasterData\bodem.bil";
            const string path = @"..\..\..\..\..\test-data\DeltaShell\DeltaShell.Plugins.SharpMapGis.Tests\RasterData\test.asc";

            var layer = new GdalRegularGridRasterLayer(path);
            layer.Coverage.Components[0].NoDataValues.Add(100);

            map.Layers.Add(layer);
            mapControl.Map = map;

            var tool = mapControl.GetToolByType(typeof (QueryTool));
            mapControl.ActivateTool(tool);
            WindowsFormsTestHelper.ShowModal(mapControl);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:17,代码来源:QueryToolTest.cs

示例7: GetCoverageValues

        public void GetCoverageValues()
        {
            var rasterDataFolderPath = TestHelper.GetTestDataPath(TestDataPath.DeltaShell.DeltaShellDeltaShellPluginsSharpMapGisTestsRasterData);
            var gridFilePath = Path.Combine(rasterDataFolderPath, "test.asc");

            var mapControl = new MapControl();
            var map = new Map();
            var layer = new GdalRegularGridRasterLayer(gridFilePath);

            map.Layers.Add(layer);
            mapControl.Map = map;

            var tool = mapControl.GetToolByType(typeof(QueryTool));
            mapControl.ActivateTool(tool);

            var noDataCellText = TypeUtils.CallPrivateMethod<string>(tool, "GetCoverageValues", new object[] {new Coordinate(25, 275)});
            Assert.AreEqual("image layer1 : No data\n", noDataCellText);

            var validDataCellText = TypeUtils.CallPrivateMethod<string>(tool, "GetCoverageValues", new object[] { new Coordinate(125, 125) });
            Assert.AreEqual("image layer1 : 50\n", validDataCellText);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:21,代码来源:QueryToolTest.cs

示例8: InitializeControls

        private void InitializeControls()
        {
            geometryEditorForm = new Form();
            // Create map and map control
            Map map = new Map();

            mapControl = new MapControl {Map = map};
            mapControl.Resize += delegate { mapControl.Refresh(); };
            mapControl.ActivateTool(mapControl.PanZoomTool);
            mapControl.Dock = DockStyle.Fill;
            // disable dragdrop because it breaks the test runtime
            mapControl.AllowDrop = false;

            // Create listbox to show all registered tools
            listBoxTools = new ListBox {Dock = DockStyle.Left};
            listBoxTools.SelectedIndexChanged += listBoxTools_SelectedIndexChanged;

            map.ZoomToExtents();

            mapControl.MoveTool.FallOffPolicy = FallOffPolicyRule.Linear;

            geometryEditorForm.Controls.Add(listBoxTools);
            geometryEditorForm.Controls.Add(mapControl);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:24,代码来源:NewLineToolTest.cs

示例9: QueryValuesUsingProfileTool

        public void QueryValuesUsingProfileTool()
        {
            var points = new[,]
                             {
                                 {new Point(0.0, 1.0), new Point(0.0, 0.0)}, 
                                 {new Point(0.5, 1.5), new Point(1.0, 0.0)}, 
                                 {new Point(1.0, 2.0), new Point(2.0, 2.0)}
                             };

            var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>());

            var values = new[,]
                             {
                                 {1.0, 2.0},
                                 {3.0, 4.0},
                                 {5.0, 6.0}
                             };

            coverage.SetValues(values);

            var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true, ShowVertices = true };

            var map = new Map { Layers = { coverageLayer } };

            var mapControl = new MapControl { Map = map, AllowDrop = false };

            mapControl.FixedZoomOutTool.Execute(); // zoom out a bit

            mapControl.ActivateTool(mapControl.CoverageProfileTool);

            WindowsFormsTestHelper.ShowModal(mapControl);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:32,代码来源:DiscreteGridPointCoverageLayerTest.cs


注:本文中的MapControl.ActivateTool方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。