TextOnPathLabel and polygons

Topics: SharpMap Project, SharpMap v0.9 / v1.x, WinForms Controls
Mar 14, 2012 at 8:21 PM

After source code was updated, i wanted to show my street labels on the map, but got an NullReferenceException during labels rendering (geometry was a polygon - i have one label style for all geometry layers). Help me fix this , please. For linestring layers everything works fine.

(label.TextOnPathLabel.DrawTextOnPath(); //<-- exception here)

System.NullReferenceException was unhandled
  Message=Object reference not set to an instance of an object.
  Source=SharpMap
  StackTrace:
       at SharpMap.Layers.LabelLayer.Render(Graphics g, Map map)
       at SharpMap.Layers.LayerGroup.Render(Graphics g, Map map)
       at SharpMap.Map.RenderMap(Graphics g, LayerCollectionType layerCollectionType, Boolean drawMapDecorations)
       at SharpMap.Forms.MapBox.GetMap(Map map, LayerCollection layers, LayerCollectionType layerCollectionType, BoundingBox extent)
       at SharpMap.Forms.MapBox.GetImagesAsync(BoundingBox extent, Int32 imageGeneration)
       at SharpMap.Forms.MapBox.<>c__DisplayClass12.<UpdateImage>b__f(Object )
       at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
       at System.Threading.ThreadPoolWorkQueue.Dispatch()
       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
  InnerException:

Developer
Mar 15, 2012 at 2:39 AM

Fixed in change set: 96745

When use all label in one layer. Maybe we should add a custome theme for label style