I have a set of points and want to cycle through an array of different colors as I draw lines for these points. Something like:
Sub addLines()
'pts is an array of vertexs
'In page load I am doing:
' Dim lineLayer As New InMemoryFeatureLayer()
' lineLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimplePointStyle(PointSymbolType.Circle, GeoColor.StandardColors.Green, 15)
' lineLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("Name", "Arial", 12, DrawingFontStyles.Bold, GeoColor.StandardColors.Black)
' Dim dynOverlay As New LayerOverlay()
' dynOverlay.Layers.Add("LineLayer", lineLayer)
' WpfMap1.Overlays.Add("LineOverlay", dynOverlay)
Dim c() As GeoColor = New GeoColor() {GeoColor.StandardColors.Brown, GeoColor.StandardColors.Red, GeoColor.StandardColors.Gray}
Dim lineLayer As InMemoryFeatureLayer = DirectCast(WpfMap1.FindFeatureLayer("LineLayer"), InMemoryFeatureLayer)
Dim lineStyle As LineStyle = New LineStyle(New GeoPen(GeoColor.FromArgb(150, GeoColor.StandardColors.Brown), 2))
lineLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(lineStyle)
lineLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Dim j As Integer = 0
For i As Integer = 0 To pts.count - 1 Step 2
Dim lShape As New LineShape
lShape.Vertices.Add(pts(i))
lShape.Vertices.Add(pts(i + 1))
Dim f As New Feature(lShape)
lineLayer.InternalFeatures.Add(f)
If j = c.Count - 1 Then
j = 0
Else
j += 1
End If
lineStyle.InnerPen = New GeoPen(GeoColor.FromArgb(150, c(j)), 2)
Next
End Sub
But I am not getting any lines. If I set the default, then all the lines are the same color. What am I doing wrong, or is there a better way to do it?
Thanks