Inconsistent behavior of VectorLayer

Sep 8, 2011 at 3:03 PM

Hi.

 

I'm using the following code to populate my map with geometries:

 

 

Dim vl As VectorLayer = New VectorLayer()

Public Sub New()

map1.BaseChildren.Add(vl)

End Sub

Public Sub AddNewPosition(ByVal latitude As Double, ByVal longitude As Double)

Dim box As DeepEarth.Toolkit.Geometry.Polygon = New DeepEarth.Toolkit.Geometry.Polygon()

box.OuterRing = New ObservableCollection(Of Location)() From {New Location(latitude - 0.00007, longitude - 0.00007), New Location(latitude - 0.00007, longitude), New Location(latitude, longitude), New Location(latitude, longitude - 0.00007)}
box.Fill = New SolidColorBrush(Colors.Black)
box.Stroke = New SolidColorBrush(Colors.Red)
box.StrokeThickness = 1
box.Opacity = 1
vl.Add(box.BoundingBox, box)

End Sub

 

I'm adding geometries one by one to the layer with a timer. However, the geometries randomly appear and disappear. It almost seems as if every odd number of adds is normally added and every even number is not added. Using the debugger I can see an item is always added to the VectorLayer; and the count isn't getting lower.

 

Zooming out all old geometries are gone. When I add all geometries to the VectorLayer in a For Loop at once, they're normally added.

Why is that happening?

 

 

Another question: How do I add pushpins to a map or a layer?