Imports System.IO
Imports System.Collections.Generic
Imports C1.Silverlight.Maps
Namespace VectorLayer
    Public Delegate Sub ProcessShapeItem(vector As C1VectorItemBase, attributes As C1ShapeAttributes, lt As Location)

    Module ShapeFileHelper
        <System.Runtime.CompilerServices.Extension()> _
        Public Sub LoadShape(vl As C1VectorLayer, stream As Stream, dbfStream As Stream, lt As Location, centerAndZoom As Boolean, processShape As ProcessShapeItem)
            Dim vects As Dictionary(Of C1VectorItemBase, C1ShapeAttributes) = ShapeReader.Read(stream, dbfStream)

            vl.BeginUpdate()
            For Each vect As C1VectorItemBase In vects.Keys
                processShape(vect, vects(vect), lt)

                vl.Children.Add(vect)
            Next
            vl.EndUpdate()
        End Sub
    End Module

End Namespace
