Hi Guys,
My TilePreCacher was working fine with dlls version 6.0.260.0 and now throws the following exception:
System.ArgumentException: The format of the well known binary is incorrect.
Nombre del parámetro: wellKnownBinary ---> System.ArgumentException: 24413: Not valid because of two overlapping edges in curve (1).
en ThinkGeo.MapSuite.Core.BaseShape.CreateShapeFromWellKnownData(Byte[] wellKnownBinary)
--- Fin del seguimiento de la pila de la excepción interna ---
en ThinkGeo.MapSuite.Core.BaseShape.CreateShapeFromWellKnownData(Byte[] wellKnownBinary)
en ThinkGeo.MapSuite.Core.Feature.GetShape()
en ThinkGeo.MapSuite.Core.LineStyle.SiE=(RectangleShape fmM=, IEnumerable`1 f2M=)
en ThinkGeo.MapSuite.Core.LineStyle.DrawCore(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers)
en ThinkGeo.MapSuite.Core.Style.Draw(IEnumerable`1 features, GeoCanvas canvas, Collection`1 labelsInThisLayer, Collection`1 labelsInAllLayers)
en ThinkGeo.MapSuite.Core.ZoomLevel.DrawCore(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)
en ThinkGeo.MapSuite.Core.ZoomLevel.Draw(GeoCanvas canvas, IEnumerable`1 features, Collection`1 currentLayerLabels, Collection`1 allLayerLabels)
en ThinkGeo.MapSuite.Core.ShapeFileFeatureLayer.ZlU=(GeoCanvas Z1U=, RectangleShape aFU=, Collection`1 aVU=, ZoomLevel alU=, Collection`1 a1U=, Collection`1 bFU=, ShapeFileFeatureSource bVU=, Collection`1 blU=, Collection`1 b1U=)
en ThinkGeo.MapSuite.Core.ShapeFileFeatureLayer.WVU=(GeoCanvas WlU=, RectangleShape W1U=, Collection`1 XFU=, ZoomLevel XVU=, Collection`1 XlU=, ShapeFileFeatureSource X1U=, Collection`1 YFU=, Collection`1 YVU=)
en ThinkGeo.MapSuite.Core.ShapeFileFeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
en ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)
en TilePreCacherIssueDemo.Module1.Main() en Z:\Documents\Mis Documentos\Visual Studio Projects\TilePreCacherIssueDemo\TilePreCacherIssueDemo\Module1.vb:línea 39
You can download the refered shape file from here: dl.dropboxusercontent.com/u/6792052/GebcoOneBathyA4.rar
And this is the source I used:
Imports System.Collections.ObjectModel
Imports ThinkGeo.MapSuite.Core
Imports ThinkGeo.MapSuite.WpfDesktopEdition
Module Module1
Sub Main()
Dim ZoomLevelIdx As Integer = 13
Dim cacheDirectory As String = ".\TileCache"
Dim cacheId As String = "WorldMapOverlay"
Dim ZoomLevelSet As New ZoomLevelSet
Dim mapUnit As GeographyUnit = GeographyUnit.DecimalDegree
Dim GebcoOneBathymetricLayer As ShapeFileFeatureLayer = New ShapeFileFeatureLayer(".\GebcoOneBathyA4.shp", ShapeFileReadWriteMode.ReadOnly)
GebcoOneBathymetricLayer.ZoomLevelSet.ZoomLevel08.DefaultLineStyle = New LineStyle(New GeoPen(GeoColor.SimpleColors.Silver, 1))
GebcoOneBathymetricLayer.ZoomLevelSet.ZoomLevel08.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level15
GebcoOneBathymetricLayer.WrappingExtent = New RectangleShape(-180, 90, 180, -90)
GebcoOneBathymetricLayer.WrappingMode = WrappingMode.WrapDateline
'Create a tile cache object with the cache directory and cache id.
Dim tileCache As New FileBitmapTileCache(cacheDirectory, cacheId)
tileCache.ImageFormat = TileImageFormat.Png
tileCache.TileMatrix.Scale = ZoomLevelSet.GetZoomLevels(ZoomLevelIdx).Scale
tileCache.TileMatrix.BoundingBox = New RectangleShape(-100000000, 100000000, 100000000, -100000000)
Dim cell As New TileMatrixCell(694, 4330, New RectangleShape(10.283203125, 59.501953125, 10.3271484375, 59.4580078125))
' create a bitmap whoes size equals to the tile size.
Using bitmap As New System.Drawing.Bitmap(256, 256)
' create a GeoCanvas which for drawing the passed layers.
Dim geoCanvas As New GdiPlusGeoCanvas()
geoCanvas.BeginDrawing(bitmap, cell.BoundingBox, mapUnit)
SyncLock GebcoOneBathymetricLayer
If Not GebcoOneBathymetricLayer.IsOpen Then
GebcoOneBathymetricLayer.Open()
End If
Try
GebcoOneBathymetricLayer.Draw(geoCanvas, New Collection(Of SimpleCandidate)()) '<<<--- Exception ocurs here
Console.WriteLine("OK")
Catch ex As Exception
Console.WriteLine("Cell Col: " & cell.Column & " Row: " & cell.Row & " BB: " & cell.BoundingBox.ToString & vbCrLf & _
"Exception: " & ex.ToString())
End Try
End SyncLock
geoCanvas.EndDrawing()
' create tile object to maintain current tile information.
Dim tile As New BitmapTile(bitmap, cell.BoundingBox, ZoomLevelSet.GetZoomLevels(ZoomLevelIdx).Scale)
' save tile.
tileCache.SaveTile(tile)
End Using
Console.ReadKey()
End Sub
End Module