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

Oliver's Blog
18 April 2018

Our WinForms 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.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.