Imports ThinkGeo.MapSuite.Core ' Mark the class Serializable so that it works in every serialization context _ Public Class KmlFeatureLayer Inherits FeatureLayer Protected Sub New() Me.New(String.Empty) End Sub Public CurrentExtent As RectangleShape Public Sub New(ByVal kmlPathFileName As String) Me.New(kmlPathFileName, KmlStringType.File) End Sub Public Sub New(ByVal kmlString As String, ByVal stringType As KmlStringType) MyBase.New() FeatureSource = New KmlFeatureSource(kmlString, stringType) End Sub Public Overrides ReadOnly Property HasBoundingBox() As Boolean Get Return True End Get End Property Protected Overrides Sub OpenCore() Dim tempZoomLevel As ZoomLevel = getCurrentZoomlevel(CurrentExtent) If tempZoomLevel.DefaultAreaStyle IsNot Nothing Or tempZoomLevel.DefaultLineStyle IsNot Nothing Then MyBase.OpenCore() End If End Sub Protected Overrides Sub DrawCore(canvas As ThinkGeo.MapSuite.Core.GeoCanvas, labelsInAllLayers As System.Collections.ObjectModel.Collection(Of ThinkGeo.MapSuite.Core.SimpleCandidate)) Dim tempZoomLevel As ZoomLevel = getCurrentZoomlevel(CurrentExtent) If tempZoomLevel.DefaultAreaStyle IsNot Nothing Or tempZoomLevel.DefaultLineStyle IsNot Nothing Then MyBase.DrawCore(canvas, labelsInAllLayers) End If End Sub Private Function getCurrentZoomlevel(extent As RectangleShape) As ZoomLevel Return Me.ZoomLevelSet.GetZoomLevel(extent, 100, GeographyUnit.DecimalDegree) End Function End Class