The following example shows how to use VisvalingamShapeSimplifier to simplify vector layer items.
C# |
private void SimpleButton_Click(object sender, RoutedEventArgs e) {
VisvalingamShapeSimplifier simplifier = new VisvalingamShapeSimplifier();
simplifier.Simplify(adapter.DisplayItems, 50);
}
|
VB |
Private Sub SimpleButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim simplifier As VisvalingamShapeSimplifier = New VisvalingamShapeSimplifier()
simplifier.Simplify(adapter.DisplayItems, 50)
End Sub
|
XAML |
<dxm:MapControl x:Name="mapControl" Grid.Column="0">
<dxm:VectorLayer>
<dxm:SvgFileDataAdapter x:Name="adapter" FileUri="Data/countries.svg" />
</dxm:VectorLayer>
</dxm:MapControl>
<dx:SimpleButton Content="Simplify" Grid.Column="1" Height="50"
VerticalAlignment="Top" Click="SimpleButton_Click"/>
|
The Map control also provides the built-in DouglasPeuckerShapeSimplifier (see DouglasPeuckerShapeSimplifier) you can use instead of VisvalingamShapeSimplifier. The Douglas-Peucker algorithm provides greater smoothness of the resulting polyline while the Visvalingam algorithm demonstrates better performance when you process a polyline with a large number of vertices.
System.Object
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Freezable
MapDependencyObject
ShapeSimplifierBase
VisvalingamShapeSimplifier