Hi James,
As explained earlier in the thread, I'm using a custom marker style class to enable individual column based popups.
The markers are added to an InMemoryMarkerOverlay via a reprojected vector layer, but the reprojection seems to be in order, producing correct coordinates for the markers.
Here how the two layers are built and added to CustomOverlays:
Public Class ColumnBasedMarkerStyle
Inherits ThinkGeo.MapSuite.WebEdition.MarkerStyle
Private m_ColumnName_Name As String = ""
Private m_ColumnName_WebImage As String = ""
Public Sub New(ByVal cn As String, ByVal wi As String)
m_ColumnName_Name = cn
m_ColumnName_WebImage = wi
End Sub
Public Overrides Function GetMarkers(ByVal fts As System.Collections.Generic.IEnumerable(Of Feature)) _
As System.Collections.ObjectModel.Collection(Of Marker)
Dim mks As New System.Collections.ObjectModel.Collection(Of Marker)
For Each ft In fts
Dim m As New Marker()
m.IsVisible = True
Dim baseShape As BaseShape = ft.GetShape()
If TypeOf baseShape Is PointShape Then
m.Position = TryCast(baseShape, PointShape)
Else
m.Position = TryCast(baseShape.GetCenterPoint, PointShape)
End If
If m_ColumnName_WebImage = "" Then
m.WebImage = New WebImage("/images/red_point.gif")
Else
m.WebImage = New WebImage(ft.ColumnValues(m_ColumnName_WebImage))
End If
With m.WebImage
'hardcoded for red_point.gif !
.ImageOffsetX = -3.5F
.ImageOffsetY = -3.5F
End With
Dim msg As String = ""
If m_ColumnName_Name = "" Then
msg = "<b>Uden navn:</b><hr/>"
Else
msg = "<b>" + ft.ColumnValues(m_ColumnName_Name).ToString() + "</b><hr/>"
End If
With m.Popup
.BorderWidth = 2
.Width = 300
.Height = 250
.ContentHtml = msg
End With
mks.Add(m)
Next
Return mks
End Function
End Class
Here the definition of the custom marker style object:
Dim skulpturer = New TabFileFeatureLayer("C:\Maps\MapInfo\Skulpturer_webgis.TAB", "ID", "OGRSchema")
With skulpturer.ZoomLevelSet.ZoomLevel01
.DefaultPointStyle = PointStyles.CreateSimplePointStyle(PointSymbolType.Circle, New GeoColor(0, 0, 255), 10)
.DefaultTextStyle = TextStyles.Capital2("NAVN")
.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
End With
skulpturer.IsVisible = True
skulpturer.FeatureSource.Projection = New ManagedProj4Projection( _
ManagedProj4Projection.GetEpsgParameters(25832), _
ManagedProj4Projection.GetGoogleMapParameters())
Dim ptsOverlay = New LayerOverlay("Odense skulpturer P", False, TileType.SingleTile)
ptsOverlay.Layers.Add(skulpturer)
ptsOverlay.IsVisible = True
Map1.CustomOverlays.Add(ptsOverlay)
'..............................................
Dim mo As New InMemoryMarkerOverlay("MyMarkers")
skulpturer.FeatureSource.Open()
mo.FeatureSource.Open()
For Each c In skulpturer.FeatureSource.GetColumns()
mo.Columns.Add(New FeatureSourceColumn(c.ColumnName, c.TypeName, c.MaxLength))
Next
For Each ft In skulpturer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns)
mo.Features.Add(ft) 'transfers column data ??
Next
mo.FeatureSource.Close()
skulpturer.FeatureSource.Close()
mo.Name = "Odense skulpturer M"
mo.IsVisible = True 'False 'for now
mo.IsBaseOverlay = False
mo.IsVisibleInOverlaySwitcher = True
With mo.ZoomLevelSet.ZoomLevel01
.CustomMarkerStyle = New ColumnBasedMarkerStyle("NAVN", "") ', mo.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage)
.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
End With
Map1.CustomOverlays.Add(mo)
I'm attaching the "Skulpturer_webgis" MapInfo TAB.
TIA
Skupturer_webgis.zip (14.8 KB)