we use our own raster layer class based on your MultiGeoRasterLayer-Demo to display Tif-WorldFile. We have implemented this layer in an web service. This means we draw the map in the web service and send the image back to client where it is drawn on the canvas.
Sometimes we recognize that the raster layer is not drawn when we zoom in or out although we show the same map extent. We debugged our raster layer class and noticed that code works correct.
We detect the layers inside bounding box, open them with GDIPlusRasterLayer, draw them on GDIPlusGeoCanvas and send image back to client. But sometimes we can detect that the image GDIPlusGeoCanvas has drawn is not correct.
I have attached the images drawn by GDIPlusGeoCanvas where you can see that image for Zoomlevel13 is not correct.
Please let me know if you need additional information.
Thanks Thomas
-------
PS
I noticed that DrawCore() is called twice via MapControl if I change map extent e.g. pan to left. Is this correct?
So basically your problem is that in the server side which use the GdiPlusGeoCanvas to draw directly sometimes did not draw the image correctly. I doubt if the following drawing procedures are applied correctly in the server side. gdiPlusRasterCanvas.BeginDrawing; gdiPlusRasterCanvas.Draw; gdiPlusRasterCanvas.Flush; gdiPlusRasterCanvas.EndDrawing;
About the twice or more times when Panning, I think that is correct, because we will draw the map when new tiles comes up on panning, which will make the map control much more responsive. We can change this behavior by set all the overlay to non base overlays.
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
'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
Could you give more information about this? For example, could you try to figure out the parameters passed in when an empty image expected to return? I could not find very obvious error on your code except missing some Flush before EndDrawing.
Is it possible to make a small application with this problem exists for us to recreate it? That would be very helpful.
I think the 65 MB should be too large to upload via the discussion form or email, so could you contact our support to see whether he can provide you a port to upload it, when you send mail to him, please make sure let him know that this is expected to forward to Yale.