本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}