Value cannot be null. Parameter name: axis

Topics: SharpMap Project, SharpMap v2.0, WinForms Controls
Jun 24, 2011 at 6:37 PM

please help me render LabelLayer, i always get this exception (when there is a linestring in my datasource) {"Value cannot be null.\r\nParameter name: axis"}

   at NPack.ClrMatrixOperations`3.Rotate(TMatrix matrix, TVector axis, Double radians)
   at SharpMap.Rendering.MatrixProcessor.Rotate(Matrix matrix, Vector axis, Double radians)
   at SharpMap.Rendering.Matrix.RotateAlong(Vector axis, Double radians)
   at SharpMap.Rendering.Rendering2D.Matrix2D.Rotate(Double theta)
   at SharpMap.Rendering.Rendering2D.Label2D.createTransformFromLabel(Label2D label)
   at SharpMap.Rendering.Rendering2D.Label2D.get_Transform()
   at SharpMap.Rendering.Rendering2D.BasicLabelRenderer2D`1.<RenderLabel>d__0.MoveNext()
   at SharpMap.Rendering.Rendering2D.BasicLabelRenderer2D`1.<DoRenderFeature>d__17.MoveNext()
   at SharpMap.Rendering.Rendering2D.FeatureRenderer2D`2.<RenderFeature>d__0.MoveNext()
   at SharpMap.Presentation.WinForms.MapViewControl.ShowRenderedObjects(IEnumerable`1 renderedObjects)
   at SharpMap.Presentation.WinForms.MapViewControl.SharpMap.Presentation.Views.IMapView2D.ShowRenderedObjects(IEnumerable renderedObjects)
   at SharpMap.Presentation.Presenters.MapPresenter2D.RenderFeatureLayer(IFeatureLayer layer, RenderPhase phase)
   at SharpMap.Presentation.WinForms.MapPresenter.RenderFeatureLayer(IFeatureLayer layer, RenderPhase phase)
   at SharpMap.Presentation.Presenters.MapPresenter2D.RenderLayer(ILayer layer, RenderPhase phase)
   at SharpMap.Presentation.Presenters.MapPresenter2D.RenderAllLayers(RenderPhase phase)
   at SharpMap.Presentation.Presenters.MapPresenter2D.RenderAllLayers()
   at SharpMap.Presentation.Presenters.MapPresenter2D.setViewMetricsInternal(Size2D newViewSize, ICoordinate newCenter, Double newWorldWidth)
   at SharpMap.Presentation.Presenters.MapPresenter2D.setViewEnvelopeInternal(IExtents2D newEnvelope)
   at SharpMap.Presentation.Presenters.MapPresenter2D.ZoomToWorldBoundsInternal(IExtents2D zoomBox)
   at SharpMap.Presentation.Presenters.MapPresenter2D.handleViewZoomToWorldBoundsRequested(Object sender, MapViewPropertyChangeEventArgs`1 e)
   at SharpMap.Presentation.WinForms.MapViewControl.onRequestZoomToWorldBounds(IExtents2D zoomBox)
   at SharpMap.Presentation.WinForms.MapViewControl.ZoomToWorldBounds(IExtents2D zoomBox)
   at Mapl.MainForm.Zoom(Double amount) in F:\Visual Studio 2010\Projects\Mapl_fw2\Mapl\MainForm.cs:line 83
   at Mapl.MainForm.button2_Click(Object sender, EventArgs e) in F:\Visual Studio 2010\Projects\Mapl_fw2\Mapl\MainForm.cs:line 121
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at Mapl.Program.Main() in F:\Visual Studio 2010\Projects\Mapl_fw2\Mapl\Program.cs:line 18
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

My layer init code:

LabelLayer labelLayer = new LabelLayer("Label" + i.ToString(), featureProvider);
                    labelLayer.CoordinateTransformation = trasform;
                    labelLayer.MultipartGeometryLabelingBehaviour = MultipartGeometryLabelingBehavior.CommonCenter;
                    labelLayer.Style.RenderingMode = StyleRenderingMode.Default;
                    LabelStyle ls = (LabelStyle)labelLayer.Style;
                    ls.CollisionDetectionType = CollisionDetectionType.None;
                    ls.LabelExpression = new PropertyNameExpression("Name");

Thanks in advance.