WinForms Map Control - Runtime Editor for Vector Items (v18.1)

Oliver's Blog
18 April 2018

Our Map Control can display several standard types of vector items: lines, ellipses, polygons, pushpins, callouts and others. We have had feedback from users of the control that indicated a need for more interactive capabilities, and so we decided to take our feature set to the next level in our upcoming v18.1 release by providing built-in support for vector item editing at runtime.

Runtime editing UI

We developed a special toolbar panel to provide quick access to most common editor functions:

Map Editor Toolbar Panel

The toolbar supports these operations:

  • Undo/Redo
  • Select/Transform/Edit
  • Add new elements (Pushpin, Path, Polyline, Dot, Ellipse, Rectangle, Line)

An end user can switch to Edit mode, draw new elements and edit or delete vertices. Here is an illustration showing some editing steps:

Editing Operations

Modified vector layer data can be persisted to a file using one of the supported formats (Shapefile, SVG and KML). This enables scenarios where end users load custom shapefiles in a mapping application and modify the shapefile data in place, without requiring a third-party tool.

Programmatic feature set

If you would like to provide your own toolbar or similar custom UI, you can take advantage of new MapControl API members to trigger the functionality from code:

private void OnDefaultModeChecked(object sender, ItemClickEventArgs e) {
  mapControl1.MapEditor.ResetEditMode();
}

private void OnTransformModeChecked(object sender, ItemClickEventArgs e) {
  mapControl1.MapEditor.SetTransformMode();
}

private void OnEditModeChecked(object sender, ItemClickEventArgs e) {
  mapControl1.MapEditor.SetEditMode();
}

private void OnCreatePathClicked(object sender, ItemClickEventArgs e) {
  mapControl1.MapEditor.SetCreateMode(CreatableMapItemKind.Path);
}

Allowing runtime editing

To activate the new feature in MapControl, use the MapControl.MapEditor.ShowEditorPanel property. Each layer can be excluded individually by setting the property VectorItemsLayer.AllowEditItems to false.

Finally, it is important to mention that the editing feature is compatible with Geographical and Cartesian coordinate systems, as well as the newly introduced Circular Scrolling functionality.

15 comment(s)
Heiko Mueller
Heiko Mueller

GREAT! Will it possilble to check if a point (geo coordinates) are inside or outside this handpainted shape?

18 April, 2018
Oliver Sturm (DevExpress)
Oliver Sturm (DevExpress)

Heiko - yes, that is possible using the built-in hit testing features.

18 April, 2018
Marcel [NL]
Marcel [NL]

Is this a WinForms-only feature? Would be great to see this feature in DevExtreme!

18 April, 2018
Dave VanderWekke (Automated Wireless Environments)
Dave VanderWekke (Automated Wireless Environments)

We built an app using the xtraMap and had to implement polygon, rectangle and ellipse drawing for GeoFencing.  We have many customers asking for freeform drawing (or lassoing).  Is freeform drawing included?  They want to be able to quickly draw a shape and not have to plot points creating a polygon.

19 April, 2018
Oliver Sturm (DevExpress)
Oliver Sturm (DevExpress)

Marcel - I'm getting some feedback from the DevExtreme team on this, but I'm afraid I'm not aware of current plans in that direction. I'll post another response when I hear more.

Dave - the editor doesn't currently support free drawing, but we will keep that idea in mind. Thank you for the suggestion!

20 April, 2018
Oliver Sturm (DevExpress)
Oliver Sturm (DevExpress)

Marcel - I've heard back from the team now, and they confirm that they don't currently have plans to implement these features in DevExtreme. Of course we will keep your suggestion in mind for the future!

20 April, 2018
Holger Braunschweig
Holger Braunschweig

Great feature :-)

Will it be implemented in wpf too?

25 April, 2018
Oliver Sturm (DevExpress)
Oliver Sturm (DevExpress)

Holger - I'm afraid the WPF team doesn't have current plans to implement this feature.

25 April, 2018
Wade Fleming
Wade Fleming

Great stuff

26 April, 2018
Tim dos Santos
Tim dos Santos

Looks great! Can this *please* be ported also to the Diagram Control? I'd really like to add free shapes with rich user edit capabilities to my diagrams.

17 May, 2018
Iván P.
Iván P.

Great enhancement! However, this runtime editor is only available on the Map Control? I mean, I am thinking this could be a separated control to use it on panels or images. Perhaps it could be available on the PictureEdit control...

3 August, 2018
Rudy Scott
Rudy Scott

Awesome--worth my renewal for this feature alone.  Would love to see it in DevExtreme

8 August, 2018
Björn de Myn
Björn de Myn

Why is MapBubble not suported? MapDot does not resize when change zoom. Is there any way to display the distance of a line (last line in polyline for example / diameter of MapEllipse / Volume of a MapRectangle ...)

15 December, 2018
Roman K (DevExpress)
Roman K (DevExpress)

Hello Björn,

We agree that the "ruler" option is useful, so we will take it into account when discussing future MapControl improvements. As for the Map Bubble element, it also has a fixed size. It seems that the Map Ellipse item is more suitable in your scenario. Feel free to contact our Support Team if you need any assistance with customizing the MapControl layout based on your requirements.

17 December, 2018
waresofter
waresofter

please support text item like cad.i want to add some custom text to remark map.

30 March, 2019

Please login or register to post comments.