本文整理汇总了C#中MapControl.GetToolByType方法的典型用法代码示例。如果您正苦于以下问题:C# MapControl.GetToolByType方法的具体用法?C# MapControl.GetToolByType怎么用?C# MapControl.GetToolByType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapControl
的用法示例。
在下文中一共展示了MapControl.GetToolByType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanRemovePointFromLine
[Test] //not working in UI?
public void CanRemovePointFromLine()
{
var mapControl = new MapControl();
var vectorLayer = new VectorLayer();
var layerData = new FeatureCollection();
vectorLayer.DataSource = layerData;
layerData.FeatureType = typeof(CloneableFeature);
layerData.Add(new LineString(new[] { new Coordinate(0, 0), new Coordinate(50, 0), new Coordinate(100, 0) }));
mapControl.Map.Layers.Add(vectorLayer);
var firstFeature = (IFeature)layerData.Features[0];
mapControl.SelectTool.Select(firstFeature);
var curveTool = mapControl.GetToolByType<CurvePointTool>();
curveTool.IsActive = true;
curveTool.Mode = CurvePointTool.EditMode.Remove;
var args = new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0);
curveTool.OnMouseMove(new Coordinate(50, 0), new MouseEventArgs(MouseButtons.None, 1, 0, 0, 0));
curveTool.OnMouseDown(new Coordinate(50, 0), args); // delete tracker
Assert.AreEqual(2, firstFeature.Geometry.Coordinates.Length);
Assert.AreEqual(100.0, firstFeature.Geometry.Coordinates[1].X);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}