A newer version of this page is available. Switch to the current version.

MapEditor.SimplifyItems(ShapeSimplifierBase, IEnumerable<MapItem>, Double) Method

Reduces the number of vertices that form the vector layer's items with the specified simplification algorithm and tolerance.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v19.1.dll

Declaration

public void SimplifyItems(
    ShapeSimplifierBase shapeSimplifier,
    IEnumerable<MapItem> items,
    double tolerance
)
Public Sub SimplifyItems(
    shapeSimplifier As ShapeSimplifierBase,
    items As IEnumerable(Of MapItem),
    tolerance As Double
)

Parameters

Name Type Description
shapeSimplifier ShapeSimplifierBase

The object that specifies the algorithm used to simplify items.

items IEnumerable<MapItem>

The items to be simplified.

tolerance Double

A percent of vertices that vector shapes contain after simplification. This value should be in the (0;100) range.

Remarks

The example below demonstrates how to use TrackBarControl to change the Tolerance parameter and utilize the SimplifyItems method to simplify items. This example uses the VisvalingamShapeSimplifier simplification algorithm.

private void Form_Load(object sender, EventArgs e) {
    trackBarControl.Properties.Maximum = 100;
    trackBarControl.Properties.Minimum = 0;
    trackBarControl.Value = 100;
    trackBarControl.EditValueChanged += trackBarControl_EditValueChanged;
}
private void trackBarControl_EditValueChanged(object sender, EventArgs e) {
    double tolerance = Convert.ToDouble(trackBarControl.EditValue);
    mapControl.MapEditor.SimplifyItems(new VisvalingamShapeSimplifier(), mapLayer.Data.Items, tolerance);
}
See Also