private void listBoxTools_SelectedIndexChanged(object sender, EventArgs e) { if (-1 != listBoxTools.SelectedIndex) { mapControl.ActivateTool(mapControl.GetToolByName(listBoxTools.Items[listBoxTools.SelectedIndex].ToString())); } }
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); }
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 = FallOffType.Linear; geometryEditorForm.Controls.Add(listBoxTools); geometryEditorForm.Controls.Add(mapControl); }
public override void OnMouseDoubleClick(object sender, MouseEventArgs e) { newLineTool.OnMouseDoubleClick(sender, e); MapControl.SelectTool.Clear(); MapControl.ActivateTool(MapControl.SelectTool); MapControl.Refresh(); }
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); }
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); }
public void Create() { InitializeControls(); AddBranchLayerAndTool(); AddCulvertLayerAndTool(); AddDiscretisationLayerAndTool(); mapControl.MoveTool.FallOffPolicy = FallOffPolicyRule.Linear; // TODO: does not sound logical to have a tool with a name of layer?? mapControl.ActivateTool(mapControl.GetToolByName(branchLayer.Name)); foreach (IMapTool tool in mapControl.Tools) { if (null != tool.Name) { listBoxTools.Items.Add(tool.Name); } } WindowsFormsTestHelper.ShowModal(geometryEditorForm); }
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); }
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); }
[Category(TestCategory.WorkInProgress)] // drag&drop problems 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); }
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); }
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); }
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); }
[Category(TestCategory.WorkInProgress)] // Drag & Drop registration problems 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 }; mapControl.FixedZoomOutTool.Execute(); // zoom out a bit mapControl.ActivateTool(mapControl.CoverageProfileTool); WindowsFormsTestHelper.ShowModal(mapControl); }
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); }
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); }
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); }