Zoom to box by dragging mouse to rectangle

Topics: SharpMap Project, SharpMap v0.9 / v1.x, SharpMap v2.0, WinForms Controls
Aug 26, 2014 at 6:29 AM

I have a requirement, i need to implement zoom to rectangle(box) where user drags the mouse to rectangle and i need to zoom to that area using bounding box of particular rectangle.Please suggest any solution.
Aug 26, 2014 at 7:30 AM
You have a Layer that provides a bunch of rectangles on the map and when a rectangle is clicked then you want to zoom to that rectangle?

Have a look at the custom tool tutorial.

Your tool would need a reference
  • to the layer with the rectangles,
  • the mapbox control.
It needs to subscribe to e.g. the MouseUp event and query the layer for the rectangle that was clicked. If a rectangle was found, call
Aug 26, 2014 at 11:30 AM

I dont have any rectangle layers, just when user drags the map which mousedown it needs to create a semitransparent rectangle and needs to zoom into that portion as similar in ArcGIS.

Aug 26, 2014 at 12:08 PM
mapBox.ActiveTool = MapBox.Tools.ZoomWindow;
Aug 26, 2014 at 12:23 PM
Edited Aug 26, 2014 at 12:24 PM

Oops , that was awesome, sorry i didn't noticed it