Hello Yale,
can you take a look on our server side code. There are two methods to draw the map. Maybe there is an bug. But why occurs this error only on drawing the image for zoomlevel13?
Public Function getLayerImage(ByVal dblBBULX As Double, ByVal dblBBULY As Double, _
ByVal dblBBLRX As Double, ByVal dblBBLRY As Double, _
ByVal lngImageWidth As Integer, ByVal lngImageHeight As Integer, _
ByVal lngID_Layer As Int64) As Byte()
Dim ocNettroLayer As cNettroLayer = Nothing
Dim ocNettroRasterLayer As cNettroRasterLayer
Dim oBoundingBox As ThinkGeo.MapSuite.Core.RectangleShape
Dim oGdiPlusGeoCanvas As ThinkGeo.MapSuite.Core.GdiPlusGeoCanvas
Dim oGeoImage As ThinkGeo.MapSuite.Core.GeoImage
Dim bytArray(-1) As Byte
Try
oBoundingBox = New ThinkGeo.MapSuite.Core.RectangleShape(New ThinkGeo.MapSuite.Core.PointShape(dblBBULX, dblBBULY), _
New ThinkGeo.MapSuite.Core.PointShape(dblBBLRX, dblBBLRY))
If Me.ermittleLayer(lngID_Layer, ocNettroLayer) Then
oGdiPlusGeoCanvas = New ThinkGeo.MapSuite.Core.GdiPlusGeoCanvas
oGeoImage = ThinkGeo.MapSuite.Core.GdiPlusGeoCanvas.CreateGeoImage(lngImageWidth, lngImageHeight)
SyncLock ocNettroLayer
Try
oGdiPlusGeoCanvas.BeginDrawing(oGeoImage, oBoundingBox, ThinkGeo.MapSuite.Core.GeographyUnit.Meter)
ocNettroRasterLayer = DirectCast(ocNettroLayer, cNettroRasterLayer)
ocNettroRasterLayer.zeichneKartenAusschnitt(oGdiPlusGeoCanvas) 'Draws the World-Files ont the Canvas
Finally
If oGdiPlusGeoCanvas.IsDrawing Then
oGdiPlusGeoCanvas.EndDrawing()
End If
End Try
End SyncLock
bytArray = ThinkGeo.MapSuite.Core.GdiPlusGeoCanvas.ConvertGeoImageToMemoryStream(oGeoImage).ToArray
'Code zum Testen ob Karte richtig gezeichnet wurde
'Dim oStream As System.IO.Stream
'Dim oImage As System.Drawing.Bitmap = Nothing
'Try
' oStream = New System.IO.MemoryStream(bytArray)
' oImage = New System.Drawing.Bitmap(oStream)
' oImage.Save("c:\Canvas_Zoomlevel13.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
'Catch ex As Exception
'Finally
' oStream.Close()
' oImage.Dispose()
'End Try
End If
Catch ex As Exception
With New Nettropolis.Shared2.cErrorLogging
.logError(ex, bolThrowException:=True, bolShowError:=False)
End With
Finally
getLayerImage = bytArray
End Try
End Function
Public Sub zeichneKartenAusschnitt(ByRef oCanvas As ThinkGeo.MapSuite.Core.GdiPlusGeoCanvas)
Dim oEnvelope As GisSharpBlog.NetTopologySuite.Geometries.Envelope
Dim strRowIndexDokumentArrayList As System.Collections.ArrayList
Dim oGdiPlusRasterLayer As ThinkGeo.MapSuite.Core.GdiPlusRasterLayer = Nothing
Dim oGeoImage As ThinkGeo.MapSuite.Core.GeoImage
Dim oCenterPoint As ThinkGeo.MapSuite.Core.PointShape
Dim oCenterPointScreen As ThinkGeo.MapSuite.Core.ScreenPointF
Dim extent As ThinkGeo.MapSuite.Core.RectangleShape
Dim strPfad As String = ""
Dim intersectionShape As ThinkGeo.MapSuite.Core.RectangleShape = Nothing
Try
oEnvelope = New GisSharpBlog.NetTopologySuite.Geometries.Envelope(oCanvas.CurrentWorldExtent.UpperLeftPoint.X, _
oCanvas.CurrentWorldExtent.LowerRightPoint.X, _
oCanvas.CurrentWorldExtent.UpperLeftPoint.Y, _
oCanvas.CurrentWorldExtent.LowerRightPoint.Y)
If Not m_oSTRtree Is Nothing Then
strRowIndexDokumentArrayList = m_oSTRtree.Query(oEnvelope)
If strRowIndexDokumentArrayList.Count > 0 Then
For Each strRowIndexDokument As String In strRowIndexDokumentArrayList
'oGdiPlusRasterLayer.UpperThreshold = m_dblUpperThreshold
'oGdiPlusRasterLayer.LowerThreshold = m_dblLowerThreshold
If Me.Kartendatei.ermittleKartendateiCachePfad(Convert.ToInt32(strRowIndexDokument), strPfad) Then
Try
oGdiPlusRasterLayer = New ThinkGeo.MapSuite.Core.GdiPlusRasterLayer(strPfad)
oGdiPlusRasterLayer.Open()
extent = oGdiPlusRasterLayer.GetBoundingBox()
oGeoImage = oGdiPlusRasterLayer.ImageSource.GetImage(oCanvas.CurrentWorldExtent, CInt(Math.Round(oCanvas.Width)), CInt(Math.Round(oCanvas.Height)))
Finally
If oGdiPlusRasterLayer.IsOpen Then
oGdiPlusRasterLayer.Close()
End If
End Try
intersectionShape = extent.GetIntersection(oCanvas.CurrentWorldExtent).GetBoundingBox()
oCenterPoint = intersectionShape.GetCenterPoint()
oCenterPointScreen = ThinkGeo.MapSuite.Core.ExtentHelper.ToScreenCoordinate(oCanvas.CurrentWorldExtent, oCenterPoint, oCanvas.Width, oCanvas.Height)
oCanvas.DrawScreenImage(oGeoImage, oCenterPointScreen.X, oCenterPointScreen.Y, oGeoImage.GetWidth + 2, oGeoImage.GetHeight + 2, _
ThinkGeo.MapSuite.Core.DrawingLevel.LevelOne, 0.0, 0.0, 0.0)
oGeoImage.Close()
End If
Next
End If
End If
Catch ex As Exception
With New Nettropolis.Shared2.cErrorLogging
.logError(ex, bolThrowException:=True, bolShowError:=False)
End With
Finally
End Try
End Sub