Hi,
I want to display a series of markers, based on a TAB data set. Each marker should have an individual popup showing data from a column.
I've created a class "ColumnBasedMarkerStyle", with a constructor taken a column name as argument, and an overriden function GetMarkers().
But the marker layer doesn't display anything, but I'm not sure whether the error's in the class definition, or in the class invocation.
Any help is appreciated. My code is below.
Public Class ColumnBasedMarkerStyle
Inherits MarkerStyle
Private m_ColumnName As String
Public Sub New(ByVal cn As String)
m_ColumnName = cn
End Sub
Public Overrides Function GetMarkers(ByVal fts As System.Collections.Generic.IEnumerable(Of Feature)) _
As System.Collections.ObjectModel.Collection(Of Marker)
Dim m As New Marker
Dim mks As New System.Collections.ObjectModel.Collection(Of Marker)
Dim msg As String = "Info:<ul>"
If m_ColumnName = "" Then
msg += "<li>NO information</li>"
Else
For Each ft In fts
msg += "<li>" + ft.ColumnValues(m_ColumnName).ToString() + "</li>"
Next
End If
msg += "</ul>"
m.Popup.ContentHtml = msg
mks.Add(m)
Return mks
End Function
End Class
-----
Dim mo As New InMemoryMarkerOverlay()
myDataset.FeatureSource.Open()
For Each ft In myDataset.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns)
mo.Features.Add(ft)
Next
myDataset.FeatureSource.Close()
mo.Name = "My markers"
mo.IsVisible = False
mo.IsBaseOverlay = False
mo.IsVisibleInOverlaySwitcher = True
mo.ZoomLevelSet.ZoomLevel01.CustomMarkerStyle = New ColumnBasedMarkerStyle("NAME")
mo.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Map1.CustomOverlays.Add(mo)