ThinkGeo.com    |     Documentation    |     Premium Support

Exception with ScaleBarAdornmentLayer


Hello,


ScaleBarAdornmentLayer raises a GDI+ exception with 3.0.307.


This can be reproduced in your sample "CreateAScaleLineAdornmentLayer.cs" simply by changing ScaleLineAdornmentLayer to ScaleBarAdornmentLayer



L'exception System.Runtime.InteropServices.ExternalException n'a pas été gérée

  Message="Une erreur générique s'est produite dans GDI+."

  Source="System.Drawing"

  ErrorCode=-2147467259

  StackTrace:

       à System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)

       à System.Drawing.Image.Save(Stream stream, ImageFormat format)

       à ThinkGeo.MapSuite.Core.GdiPlusGeoCanvas.EndDrawingCore()

       à ThinkGeo.MapSuite.Core.GeoCanvas.EndDrawing()

       à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xe6f5d5d0c25c9bd5(Graphics x783a718028818269, RectangleShape xb35a33b423b17f65, Overlay x99251f66cdabc2ad)

       à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xf12dc5c7e687c240(Boolean x991dc8ddc7528b44, RectangleShape x178b193eec228e6e)

       à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x9ac8c50f434f4b39(Int32 xb565f4681f05557a)

       à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh()

       à ArpentGIS.frmMain.cmShowScale_ItemClick(Object sender, ItemClickEventArgs e) dans D:\ToBackup\D3E\ArpentGIS\frmMain.cs:ligne 667

       à DevExpress.XtraBars.BarItem.OnClick(BarItemLink link)

       à DevExpress.XtraBars.BarBaseButtonItem.OnClick(BarItemLink link)

       à DevExpress.XtraBars.BarItemLink.OnLinkClick()

       à DevExpress.XtraBars.BarItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)

       à DevExpress.XtraBars.BarItemLink.OnLinkActionCore(BarLinkAction action, Object actionArgs)

       à DevExpress.XtraBars.ViewInfo.BarSelectionInfo.ClickLink(BarItemLink link)

       à DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(BarItemLink link)

       à DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnUnPressItem(DXMouseEventArgs e, RibbonHitInfo hitInfo)

       à DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnUnPress(DXMouseEventArgs e, RibbonHitInfo hitInfo)

       à DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnMouseUp(DXMouseEventArgs e)

       à DevExpress.XtraBars.Ribbon.Handler.RibbonHandler.OnMouseUp(DXMouseEventArgs e)

       à DevExpress.XtraBars.Ribbon.RibbonControl.OnMouseUp(MouseEventArgs e)

       à System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

       à System.Windows.Forms.Control.WndProc(Message& m)

       à DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)

       à DevExpress.XtraBars.Ribbon.RibbonControl.WndProc(Message& m)

       à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

       à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

       à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

       à DevExpress.Utils.Win.Hook.ControlWndHook.CallWindowProc(IntPtr pPrevProc, IntPtr hWnd, Int32 message, IntPtr wParam, IntPtr lParam)

       à DevExpress.Utils.Win.Hook.ControlWndHook.WindowProc(IntPtr hWnd, Int32 message, IntPtr wParam, IntPtr lParam)

       à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

       à System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)

       à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

       à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

       à System.Windows.Forms.Application.Run(Form mainForm)

       à ArpentGIS.Program.Main() dans D:\ToBackup\D3E\ArpentGIS\Program.cs:ligne 21

       à System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)

       à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

       à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

       à System.Threading.ThreadHelper.ThreadStart_Context(Object state)

       à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       à System.Threading.ThreadHelper.ThreadStart()

  InnerException: 

 


Any help is welcome.


Patrick.



Patrick, 
  
 Thanks for your reporting. 
  
 We recreated your problem and it is a bug when we ingrate it into DesktopEdition. We already fix this problem. 
  
 If you want, we can send you a temporary version or you can wait for next release. 
  
 Sorry for inconvenience. 
  
 Thanks. 
 Yale 


I’d appreciate a temporary version, we are so late in the planning. 
  
 Patrick.

Patrick, 
  
 We will send it to you tomorrow. 
  
 Sorry for the inconvenience . 
  
 Yale 


Hello, 
  
 2 issues with 3.0.313 
  
 1. Missing API 
 These API were existing in MS 2.x … does not seem to exist in 3.x or I cannot find the right name. 
 scaleLineAdornmentLayer.KMLabel = “km”; 
 scaleLineAdornmentLayer.MetersLabel = “m”; 
  
 for your info, “KM” & “M” are in lower case in the internal measure system; so you need to use lowercase or reintroduce the API that allows us to do it. 
  
 2. exception: 
 if I add this code, which was working in 2.x 
  
 scaleLineAdornmentLayer.HasMask = true; 
 scaleLineAdornmentLayer.MaskBrush = new GeoSolidBrush(GeoColor.FromArgb(150, GeoColor.StandardColors.White)); 
 scaleLineAdornmentLayer.MaskContour = new GeoPen(GeoColor.StandardColors.Transparent); 
  
 then I get the following exception: 
 L’exception System.ArgumentOutOfRangeException n’a pas été gérée 
   Message=“The input double value is out of range.\r\nNom du paramètre : maxX” 
   Source=“MapSuiteCore” 
   ParamName=“maxX” 
   StackTrace: 
        à ThinkGeo.MapSuite.Core.x6d719af406ea4c2c.x12e7df23649722cf(Double x86d4512e4c7d8814, String x34decc57f0820440, Double xaee3bf422e2fd725, x1acec04cd58c1af5 xa798986acdb65a29, Double xe21f77686f8b957e, x1acec04cd58c1af5 x495f4164830ffad5) 
        à ThinkGeo.MapSuite.Core.x6d719af406ea4c2c.xb86d8097d383be05(Double x86d4512e4c7d8814, String x34decc57f0820440, Double xaee3bf422e2fd725, x1acec04cd58c1af5 xa798986acdb65a29) 
        à ThinkGeo.MapSuite.Core.RectangleShape…ctor(Double minX, Double maxY, Double maxX, Double minY) 
        à ThinkGeo.MapSuite.Core.ScaleBarAdornmentLayer.x4662498f6b40b0fd(Single x528f4e59760a8425, String xd6e117874cd3ad18, Collection`1 xd9289f16bf954c77) 
        à ThinkGeo.MapSuite.Core.ScaleBarAdornmentLayer.x9ac8c50f434f4b39(GeoCanvas x31c084515ae9393f) 
        à ThinkGeo.MapSuite.Core.ScaleBarAdornmentLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers) 
        à ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers) 
        à ThinkGeo.MapSuite.DesktopEdition.AdornmentOverlay.DrawCore(GeoCanvas canvas) 
        à ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas) 
        à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xe6f5d5d0c25c9bd5(Graphics x783a718028818269, RectangleShape xb35a33b423b17f65, Overlay x99251f66cdabc2ad) 
        à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x8d24c2babbc69053(Overlay x32c2370c791132c5) 
        à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x9ac8c50f434f4b39(Int32 xb565f4681f05557a) 
        à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh()

Thanks, Patrick, 
  
 I really appreciate your post and bug points out. 
  
 I think we already provided some ways to do this in the ScaleLineAdormentLayer, just try the codes below, but seems we did not provides similar functionality in ScaleBarAdormentLayer, I will figure out soon. 
  
 ScaleLineAdornmentLayer scaleLine = new ScaleLineAdornmentLayer(); 
 scaleLine.DisplayUnitString["Meter"] = "M"; 
 scaleLine.DisplayUnitString["Kilometer"] = "KM"; 
 scaleLine.DisplayUnitString["Feet"] = "Ft"; 
 scaleLine.DisplayUnitString["Mile"] = "Mi"; 
 scaleLine.DisplayUnitString["UsSurveyFeet"] = "USF"; 
 scaleLine.DisplayUnitString["Yard"] = "F"; 
  
 About the exception happened in the when set the HasMask in the ScaleBarAdormentLayer, I can recreate it very easily, and we will fix it soon. 
  
 Currently, I suggest you rolls back to ScaleLineAdormentLayer. Sorry for the inconvenience. 
  
 Thanks. 
  
 Yale. 


Any progress ? 
 My software needs to be released on monday.

Patrick,  
  
 It seems that you encountered a few problems! 
  
 For this problem, we fix the 2 bugs you talked about, and we will send you an updated version with these bug fixed tomorrow (version 3.0.331). 
  
 Any more questions just let me know. 
  
 Thanks. 
  
 Yale 


It’s working correctly with 3.0.331, thank you. 
  
 Here is my code for those you can be interested in a nice scale bar: 
  
       // Set scale bar. 
       ScaleBarAdornmentLayer scaleLineAdornmentLayer = new ScaleBarAdornmentLayer(); 
       scaleLineAdornmentLayer.Location = AdornmentLocation.LowerRight; 
       scaleLineAdornmentLayer.UnitFamily = UnitSystem.Metric; 
       scaleLineAdornmentLayer.HasMask = true; 
       scaleLineAdornmentLayer.MaskBrush = new GeoSolidBrush(GeoColor.FromArgb(150, GeoColor.StandardColors.White)); 
       scaleLineAdornmentLayer.MaskContour = new GeoPen(GeoColor.StandardColors.Transparent); 
       scaleLineAdornmentLayer.DisplayUnitString[“Meter”] = “m”; 
       scaleLineAdornmentLayer.DisplayUnitString[“Kilometer”] = “km”;  
       theMap.AdornmentOverlay.Layers.Add(“ScaleLineAdornmentLayer”, scaleLineAdornmentLayer);

Patrick, 
  
 Thanks for your post and sharing! 
  
 Any more questions just let me know. 
  
 Thanks 
  
 Yale 


Hi Yale


I have the same problem as Patrick regarding the MaxX error.


Could I get a copy of the release that fixes this problem?


Thanks,

Sameshan Perumal



Sam, 
  
 Thanks for your interests! 
  
 We will send you the same version to you very soon! 
  
 Any more questions just let me know. 
  
 Thanks. 
  
 Yale