move point?

Topics: Algorithms
Mar 8, 2012 at 1:52 AM

Hi All!

I am using Sharpmap v0.9. i want

When users click on the point then that point is selected, and the relevant lines also are moved when the point is moved. Help me.

Mar 8, 2012 at 2:30 AM
Edited Mar 8, 2012 at 2:33 AM

Getting events mousedown, mousemove and mouseup

mousedown: Select nearest point of edited layer. Change bitmap or pen or cursor for hightlight

mousemove: repen edited geometry to point of mousemove

mouseup: update geometry to new point.

Mar 13, 2012 at 9:36 AM

ok, i'll try, Thanks.

Mar 14, 2012 at 8:07 PM

There is some exemple of code i can see to do move point of map in this way


Apr 3, 2012 at 5:48 PM

Hi All,

I preferred moving points and related lines wtih geometryprovider having 2 temp layer...

By intersecting in a temp layer of line points, each intersected point can easily be dragged/moved with new coordinate...

After all, you can update to other temp layer with transformation its own geometry type...

By the way;

Thanks a lot to everyone who participated in this project...With editing features Sharpmap became a wonderful solution for me...

Apr 4, 2012 at 1:42 AM

Hi all,

I developed a tool for edit geometries by sharpmap core. But i used a old version of sharpmap 0.9. There are a lot of changing in core of source code and i have not had time in order to write a axample to the trunk. May be i will code it in next time.

You can view 0.9.5-DeltaShell version in branches. There seem  develope for edit tools


Oct 9, 2013 at 10:57 PM
Edited Oct 9, 2013 at 11:01 PM
I'm trying to achieve this with v1.0 the issue I'm encountering is that the background goes white when I start dragging and only re-appears when I drop.

MouseMove events are firing in between but I'm not sure what "mousemove: repen edited geometry to point of mousemove " actually means.

Initial test code as follows. I've got a simple layer with a feature data row with a single point and a teardrop symbol drawn at the point. The mouse events are placeholder test events at present to understand the concepts.
private void mapBox1_MouseDown(Coordinate worldPos, MouseEventArgs imagePos)
            //select point if reasonably near mouse and flag drag started
            // update mouse pointer to show teardrop
            Cursor.Current = new Cursor(Path.Combine(Application.StartupPath, @"Resources\Icons\teardrop_blue.cur"));
            dragging = true;


        private void mapBox1_MouseMove(Coordinate worldPos, MouseEventArgs imagePos)
            // only do anything if dragging active
            // suggests 
            // "repen edited geometry to point of mousemove" not sure what that means
            if (dragging)
                Console.WriteLine("MouseMove - Dragging");

        private void mapBox1_MouseUp(Coordinate worldPos, MouseEventArgs imagePos)
            // if dragging then update geometry to new mouse position
            // revert mouse point to default
            if (dragging)
                Console.WriteLine("Arrived :" + worldPos.X + ", " + worldPos.Y);
                Cursor.Current = Cursors.Default;
                dragging = false;
Oct 10, 2013 at 8:59 AM
MouseMove events are firing in between but I'm not sure what "mousemove: repen edited geometry to point of mousemove " actually means.
I suppose it means redraw the geometry based on updated location.
There are Geometry drawing tools implemented in mapbox for Point/Line/Polygon. Subscribe to the GeometryDefined event and you should be all set.

Hth FObermaier