I may just be suffering from brain death, but I could use some help with an example that shows different images based on the values in an array. I started with something below, but it just crashes (the map does not even show up)... it should give you an idea of what I am trying to do:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WinformsMap1.MapUnit = GeographyUnit.DecimalDegree
Dim LayerOverlay As LayerOverlay = New LayerOverlay()
Dim worldLayer As ShapeFileFeatureLayer = New ShapeFileFeatureLayer("C:\Program Files (x86)\ThinkGeo\Map Suite Desktop Evaluation Edition 4.0\Samples\SampleData\Data\Countries02.shp")
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
LayerOverlay.Layers.Add("WorldLayer", worldLayer)
WinformsMap1.Overlays.Add(LayerOverlay)
'This is the point layer for all points
Dim pointLayer As New InMemoryFeatureLayer()
pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Dim dynamicOverlay As New LayerOverlay()
dynamicOverlay.Layers.Add("PointLayer", pointLayer)
WinformsMap1.Overlays.Add("PointOverlay", dynamicOverlay)
WinformsMap1.CurrentExtent = New RectangleShape(0, 78, 30, 26)
WinformsMap1.Refresh()
AddData()
End Sub
Private Sub AddData()
Dim data() As String = {"A", "B", "C"}
Dim lat() As Double = {26.5, 27.5, 29}
Dim lon() As Double = {-80.1, -82, -83}
Dim pointLayer As InMemoryFeatureLayer = DirectCast(WinformsMap1.FindFeatureLayer("PointLayer"), InMemoryFeatureLayer)
Dim textStyle As TextStyle = New TextStyle("NAME", New GeoFont(Me.Font.FontFamily.Name, 10), New GeoSolidBrush(GeoColor.StandardColors.Black))
Dim iconValueStyle As IconValueStyle = New IconValueStyle()
iconValueStyle.ColumnName = "TY"
iconValueStyle.IconValueItems.Add(New IconValueItem("A", New GeoImage("./test.png"), textStyle))
iconValueStyle.IconValueItems.Add(New IconValueItem("B", New GeoImage("./test1.png"), textStyle))
iconValueStyle.IconValueItems.Add(New IconValueItem("C", New GeoImage("./test.png"), textStyle))
pointLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(iconValueStyle)
pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
For i As Integer = 0 To data.Count - 1
Dim id As String = data(i)
Dim feature1 As New Feature(lon(i), lat(i), id)
If Not pointLayer.InternalFeatures.Contains(id) Then
pointLayer.InternalFeatures.Add(data(i), feature1)
End If
Next
WinformsMap1.Refresh(WinformsMap1.Overlays("PointOverlay"))
End Sub