All docs
V20.1
20.2 (EAP/Beta)
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Simplify Map Vector Items

  • 2 minutes to read

The Map Control provides Map Editor API and Simplifiers to simplify detailed vector items, reduce memory consumption, and enhance a map's responsiveness. To simplify an item, the Map Control decreases the number of item vertices. The resulting shape's resolution depends on the tolerance parameter that defines the percentage of vertices that should remain after simplification.

Use one of the following approaches for item simplification:

Use Map Editor API

This approach allows you to use the Undo/Redo command to cancel/restore item simplification actions. These commands are available only when MapEditor.AllowSaveActions is enabled.

Call the MapEditor.SimplifyItems method to simplify a collection of items with the tolerance value you specified. This method uses the VisvalingamShapeSimplifier algorithm internally.

The following example shows how to simplify items and use TrackBarEdit to change the tolerance:

using System;
using System.Windows;
namespace SvgDataAdapterSample {
    public partial class MainWindow : Window {        
        public MainWindow() {
            InitializeComponent();            
        }
        private void OnTrackbarEditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e) {
            double tolerance = Convert.ToDouble(toleranceTrackbar.EditValue);
            mapControl.MapEditor.SimplifyItems(adapter.DisplayItems, tolerance);
        }
    }
}

Use Simplifiers

You can use the ShapeSimplifierBase.Simplify method to simplify items before they are displayed on a layer.

private void OnShapesLoaded(object sender, ShapesLoadedEventArgs e) {
    VisvalingamShapeSimplifier simplifier = new VisvalingamShapeSimplifier();
    simplifier.Simplify(items: e.Shapes, tolerance: 20);
}
See Also