Hi,
I have a PostgreFeature layer, it has type/length/width etc columns. Initially it is displayed uisng the Default LineStyle. Need to create the thematic map based on the column the user selected.
I tried the ClassBreakStyle, but the layer is invisible, what could be wrong? Here is my code:
Private Function GetClassBreakRenderer() As ClassBreakStyle
Dim lineStyle0 As New LineStyle(New GeoPen(New GeoSolidBrush(GeoColor.SimpleColors.Black), 10))
Dim lineStyle1 As New LineStyle(New GeoPen(New GeoSolidBrush(GeoColor.SimpleColors.Red), 10))
Dim lineStyle2 As New LineStyle(New GeoPen(New GeoSolidBrush(GeoColor.SimpleColors.Yellow), 10))
Dim lineStyle3 As New LineStyle(New GeoPen(New GeoSolidBrush(GeoColor.SimpleColors.Green), 10))
Dim lineStyle4 As New LineStyle(New GeoPen(New GeoSolidBrush(GeoColor.FromArgb(255, 255, 0, 255)), 10))
Dim lineStyle5 As New LineStyle(New GeoPen(New GeoSolidBrush(GeoColor.FromArgb(255, 160, 255, 255)), 10))
Dim lineStyle6 As New LineStyle(New GeoPen(New GeoSolidBrush(GeoColor.FromArgb(255, 128, 0, 128)), 10))
Dim lineStyle7 As New LineStyle(New GeoPen(New GeoSolidBrush(GeoColor.FromArgb(255, 0, 128, 0)), 10))
Dim lineStyle8 As New LineStyle(New GeoPen(New GeoSolidBrush(GeoColor.FromArgb(255, 0, 0, 255)), 10))
Dim lineStyle9 As New LineStyle(New GeoPen(New GeoSolidBrush(GeoColor.FromArgb(255, 255, 220, 208)), 10))
Dim clsBreakColl As New Collection(Of ClassBreak)
clsBreakColl.Add(New ClassBreak(0, lineStyle0))
clsBreakColl.Add(New ClassBreak(1, lineStyle1))
clsBreakColl.Add(New ClassBreak(2, lineStyle2))
clsBreakColl.Add(New ClassBreak(3, lineStyle3))
clsBreakColl.Add(New ClassBreak(4, lineStyle4))
clsBreakColl.Add(New ClassBreak(5, lineStyle5))
clsBreakColl.Add(New ClassBreak(6, lineStyle6))
clsBreakColl.Add(New ClassBreak(7, lineStyle7))
clsBreakColl.Add(New ClassBreak(8, lineStyle8))
clsBreakColl.Add(New ClassBreak(9, lineStyle9))
' Create class break renderer.
Dim breaksRender As New ClassBreakStyle("shiptype", BreakValueInclusion.IncludeValue, clsBreakColl)
Return breaksRender
End Function
Private Sub mnuThematicMap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuThematicMap.Click
Dim postgreLyr As FeatureLayer = Map1.FindFeatureLayer("PostgrePlineLayer")
If postgreLyr Is Nothing Then
MsgBox("Remote vessel track data is not available.")
Exit Sub
End If
postgreLyr.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear()
postgreLyr.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(GetClassBreakRenderer())
Map1.Refresh()
End Sub