I want Edit Shape

Jan 20, 2015 at 8:01 AM
Edited Jan 20, 2015 at 8:06 AM
I want to move and click the mouse to line the polygon.
(I want to change the shape by dragging the line in shape.)
But I do not know that law.

Please help me.

my source code.

sf.InteractiveEditing = true;
AxMap1.CursorMode = tkCursorMode.cmEditShape;
AxMap1.ChooseLayer += axMap1_ChooseLayer;

private void axMap1_ChooseLayer(object sender, AxMapWinGIS._DMapEvents_ChooseLayerEvent e)
    {
        if (AxMap1.CursorMode == tkCursorMode.cmEditShape)
        {
            e.layerHandle = layerHandle;

        }
    }

https://mapwingis.codeplex.com/wikipage?title=NotesVersion493
I refer to this link. but I do not understand. TT

I was using Google Translator.
Please understand. ^_____^
Developer
Jan 21, 2015 at 7:24 AM
Edited Jan 21, 2015 at 7:30 AM
Hi woorhtks,

to start edit shapefile this code is enough:
private void button1_Click(object sender, EventArgs e)
{
    axMap1.CursorMode = tkCursorMode.cmEditShape;
    var sf = new Shapefile();
    if (sf.Open(@"d:\data\sf\buildings.shp", null))
    {
        sf.InteractiveEditing = true;
        axMap1.AddLayer(sf, true);
    }
    else
    {
        MessageBox.Show("Failed to open shapefile");
    }
}
ChooseLayer event is not needed for cmEditShape (the document hinted that by mistake). All you need is just click on a shape and start dragging its vertices. It's possible to move individual vertices of shape but not a line segments (i.e. 2 vertices at once). It's also possible to move a shape as a whole with cmEditShape cursor (simply drag it by clicking anywhere outside the vertices). You can check what operations are supported by editor in the demo app. By default it's installed as C:\dev\mapwingis\mapwindowlite\mapwidowlite.exe. Some description of it is here: here.

Regards,
Sergei
Jan 22, 2015 at 1:21 AM
Edited Jan 25, 2015 at 10:35 PM
HI sleschinski,

Thanks answers.

but, I still do not. TT

mouse cursor changes.

Click on this no.

Drag is also no.

"Edit layer" press "vertex edit" enabled in "mapwidowlite.exe"

In the code I have.

thanks ^^
Jan 25, 2015 at 10:35 PM
sleschinski wrote:
Hi woorhtks,

to start edit shapefile this code is enough:
private void button1_Click(object sender, EventArgs e)
{
    axMap1.CursorMode = tkCursorMode.cmEditShape;
    var sf = new Shapefile();
    if (sf.Open(@"d:\data\sf\buildings.shp", null))
    {
        sf.InteractiveEditing = true;
        axMap1.AddLayer(sf, true);
    }
    else
    {
        MessageBox.Show("Failed to open shapefile");
    }
}
ChooseLayer event is not needed for cmEditShape (the document hinted that by mistake). All you need is just click on a shape and start dragging its vertices. It's possible to move individual vertices of shape but not a line segments (i.e. 2 vertices at once). It's also possible to move a shape as a whole with cmEditShape cursor (simply drag it by clicking anywhere outside the vertices). You can check what operations are supported by editor in the demo app. By default it's installed as C:\dev\mapwingis\mapwindowlite\mapwidowlite.exe. Some description of it is here: here.

Regards,
Sergei
HI sleschinski,

Thanks answers.

but, I still do not. TT

mouse cursor changes.

Click on this no.

Drag is also no.

"Edit layer" press "vertex edit" enabled in "mapwidowlite.exe"

In the code I have.

thanks ^^
Developer
Jan 27, 2015 at 7:20 AM
Sorry woorhtks, I have nothing to add. I had tested the code I provided in the previous post - it was working. MapWindow Lite is using the same code and it's working too. And it's very difficult for me to understand what you write.
Jan 28, 2015 at 2:24 AM
hi woorhtks,

you can use Shape.ClosestPoints or Shapefile.GetClosestVertex

for polygon and line you must first identify the vertex for you to move it and re-shape the polygon or bend a line.