ThinkGeo.com    |     Documentation    |     Premium Support

Red cross

Dear all,


After building my application with 3.0.392, without any change in my code since 3.0.362


When I run my application there is a large red cross over the control.

This red cross automaticaly desappear when I load a layer.


Where does it come from and how to remove it ?


Thanks


Patrick.



Patrick, 
  
 Thanks for your reporting! I think the reason for this is that we changed some logic as well as some APIs in the MapControl. 
  
 So please try to remove the code related with MapControl in InitializeComponent and re-drag a new updated MapControl(3.0.392) to your application, hopefully it works. 
  
 Any more questions feel free to let me know. 
  
 Thanks. 
  
 Yale 


Ok, I’m going further, 
  
 now I have the following exception when I add the WorldKit Overlay (again, was working with 3.0.362 and I did not changed my code): 
  
 System.NullReferenceException 
    à ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas canvas) 
    à ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas) 
    à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x27d0591c2adda8d9(RectangleShape xb35a33b423b17f65, Overlay x99251f66cdabc2ad, Int32 xa209325f5c895f7e, Int32 x7454a0d1965919b1, GeographyUnit xbb704b4400ce6f76) 
    à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x568a187128faa92b(IEnumerable`1 xa6f0db4f183189f1) 
    à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x9ac8c50f434f4b39(Int32 xb565f4681f05557a) 
    à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh()

Patrick, 
  
 So you mean this exception will ONLY happen when the WorldMapKit layers are loaded? And this exception will always happen or just happen at random time? 
  
 If possible, can you show me your codes? 
  
 Any more information will be appreciated. 
  
 Thanks. 
  
 Yale 


Yale,  
  
 at this stage, MS3 crashes randomly for different reasons. 
 I mean with WMK the crash is systematic. 
  
 Here is my code: 
  
       DecorsOverlay.Lock.EnterWriteLock(); 
       try 
       { 
           RenderMap renderMaps = new RenderMap(WorldKitUtil.FullDataPath); 
           renderMaps.LoadLayers(DecorsOverlay.Layers, DecorsOverlay.Layers);  // I’ve done no change on the provided method that I get from you in february 
  
         foreach (FeatureLayer l in DecorsOverlay.Layers) 
           l.FeatureSource.Projection = ProjectionHelper.GetProjection(ProjectionEnum.WGS84, ActiveProjection); 
  
         DecorsOverlay.IsVisible = true; 
       } 
       finally 
       { 
         DecorsOverlay.Lock.ExitWriteLock(); 
       } 
       m_MainMap.Refresh(); 
  
 The crash occurs in the refresh. 
  
 ProjectionHelper.GetProjection() 
 { 
       Proj = new Proj4Projection( 
            Proj4Projection.GetEpsgParametersString(4326), 
            GetExternalProjectionMSBugFixed()); 
        Proj.Open(); 
   
       return Proj; 
   } 
  
 GetExternalProjectionMSBugFixed() 
 { 
 if (IntPtr.Size == 4) 
 return “+proj=lcc+lat_1=46.8+lat_0=46.8+lon_0=2.3372291666985+k_0=0.99987742+x_0=600000+y_0=200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs”; 
           else 
 return “+proj=lcc+lat_1=46.8+lat_0=46.8+lon_0=0+k_0=0.99987742+x_0=600000+y_0=200000+a=6378249.2+b=6356515+towgs84=-168,-60,320,0,0,0,0+pm=paris+units=m+no_defs”; 
 } 
  
 Patrick.

To be comprehensive, here is the load method: 
  
       m_WorkfileOverlay = new LayerOverlay(); 
       m_DecorsOverlay = new LayerOverlay(); 
       m_DecorsOverlay.IsVisible = false; 
  
       m_MainMap.Overlays.Add(DecorsOverlay);  // this is used for WMK 
       m_MainMap.Overlays.Add(WorkfileOverlay); // this is used for user layers 
  
       m_MainMap.AdornmentOverlay.ShowLogo = false; 
       m_MainMap.DrawingQuality = DrawingQuality.HighQuality; 
       m_MainMap.SmoothingMode = SmoothingMode.HighQuality; 
       m_MainMap.CompositingQuality = CompositingQuality.HighQuality; 
       m_MainMap.ZoomLevelSnapping = ZoomLevelSnappingMode.None; 
  
       m_MainMap.MaximumScale = 5000000; 
       m_MainMap.MinimumScale = 10; 
       m_MainMap.ThreadingMode = MapThreadingMode.SingleThreaded;  // still not stable in multithread

Patrick,


I did a test sample according to your codes while I removed the WorldMapKitRenderers.cs file for its privacy, we did not find any exception for a long time test in version 3.0.362 & 3.0.392.
 
If possible, can you try this sample to see if any difference with your application.
 
Any more questions feel free to let me know.
 
Thanks.
 
Yale

1102-Post6189_Demo.zip (11 KB)

Yale, 
  
 I found that this issue is the same than gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/13/aft/5959/afv/topic/afpgj/1/Default.aspx#9530 
  
 I got exactly the same message; but for me it was working prior to 392. 
  
 When can you send me a robust version? 
 Patrick.

Yale, 
  
 here is how to make your sample crash, even without projection; simply with overlay.isvisible=true … :( 
  
 public partial class Sample : Form 
     { 
       LayerOverlay DecorsOverlay; 
  
         // Here is the world map kit data folder. 
       private string WorldKitUtil = @"D:\ToBackup\D3E\ArpentGIS\WorldKit"; 
  
         public Sample() 
         { 
             InitializeComponent(); 
         } 
  
         private void Form1_Load(object sender, EventArgs e) 
         { 
             m_MainMap.AdornmentOverlay.ShowLogo = false; 
             m_MainMap.DrawingQuality = DrawingQuality.HighQuality; 
             m_MainMap.SmoothingMode = SmoothingMode.HighQuality; 
             m_MainMap.CompositingQuality = CompositingQuality.HighQuality; 
             m_MainMap.ZoomLevelSnapping = ZoomLevelSnappingMode.None; 
             m_MainMap.MapUnit = GeographyUnit.Meter; 
  
             m_MainMap.MaximumScale = 5000000; 
             m_MainMap.MinimumScale = 10; 
             m_MainMap.ThreadingMode = MapThreadingMode.SingleThreaded; 
  
             DecorsOverlay = new LayerOverlay(); 
             DecorsOverlay.IsVisible = false; 
             m_MainMap.Overlays.Add(DecorsOverlay); 
  
             m_MainMap.CurrentExtent = new RectangleShape(-479416.547677974, -5663.49998753297, 110946.662602835, -469726.512469881); 
  
             m_MainMap.Refresh(); 
         } 
  
         private void btnChangeVisible_Click(object sender, EventArgs e) 
         { 
           DecorsOverlay.Lock.EnterWriteLock(); 
             try 
             { 
               RenderMap renderMaps = new RenderMap(WorldKitUtil); 
               renderMaps.LoadLayers(DecorsOverlay.Layers, DecorsOverlay.Layers); 
  
               DecorsOverlay.IsVisible = true; 
                
             } 
             finally 
             { 
               DecorsOverlay.Lock.ExitWriteLock(); 
             } 
             m_MainMap.Refresh(); 
         } 
     } 
 }

Yale, 
  
 here is how to make your sample crash, even without projection; simply with overlay.isvisible=true … :( 
  
 public partial class Sample : Form 
     { 
       LayerOverlay DecorsOverlay; 
  
         // Here is the world map kit data folder. 
       private string WorldKitUtil = @"D:\ToBackup\D3E\ArpentGIS\WorldKit"; 
  
         public Sample() 
         { 
             InitializeComponent(); 
         } 
  
         private void Form1_Load(object sender, EventArgs e) 
         { 
             m_MainMap.AdornmentOverlay.ShowLogo = false; 
             m_MainMap.DrawingQuality = DrawingQuality.HighQuality; 
             m_MainMap.SmoothingMode = SmoothingMode.HighQuality; 
             m_MainMap.CompositingQuality = CompositingQuality.HighQuality; 
             m_MainMap.ZoomLevelSnapping = ZoomLevelSnappingMode.None; 
             m_MainMap.MapUnit = GeographyUnit.Meter; 
  
             m_MainMap.MaximumScale = 5000000; 
             m_MainMap.MinimumScale = 10; 
             m_MainMap.ThreadingMode = MapThreadingMode.SingleThreaded; 
  
             DecorsOverlay = new LayerOverlay(); 
             DecorsOverlay.IsVisible = false; 
             m_MainMap.Overlays.Add(DecorsOverlay); 
  
             m_MainMap.CurrentExtent = new RectangleShape(-479416.547677974, -5663.49998753297, 110946.662602835, -469726.512469881); 
  
             m_MainMap.Refresh(); 
         } 
  
         private void btnChangeVisible_Click(object sender, EventArgs e) 
         { 
           DecorsOverlay.Lock.EnterWriteLock(); 
             try 
             { 
               RenderMap renderMaps = new RenderMap(WorldKitUtil); 
               renderMaps.LoadLayers(DecorsOverlay.Layers, DecorsOverlay.Layers); 
  
               DecorsOverlay.IsVisible = true; 
                
             } 
             finally 
             { 
               DecorsOverlay.Lock.ExitWriteLock(); 
             } 
             m_MainMap.Refresh(); 
         } 
     } 
 }

Patrick, 
  
 Thanks for your code! Just make sure with your code, it will take a long time to render a wrong map? I think the reason is without projection, the wrong MapUnit as well as wrong CurrentExtent are set. 
  
 Any more questions please feel free to let me know. 
  
 Thanks. 
  
 Yale 


Yale, 
  
 the wrong mapunit & current extend are a bad cut/paste. 
 the test has been done with mapunit in meter with the projection and mapunit in degre without the projection. 
  
 Patrick.

Patrick,  
  
 Glad to hear it is working!

Ryan, 
  
 It’s not working !!! 
  
 Patrick.

Patrick, 
  
 Sorry for the delay, we are now busy on the new public release! 
  
 I tested by changing the MapUnit and CurrentExtent and it works. Could you send us a small sample to show your problem? That would be very helpful 
  
 Any more questions please feel free to let me know. 
  
 Thanks. 
  
 Yale 


Yale, David, 
  
 This is solved by 3.0.415; thank you. 
  
 Patrick.

Patrick, 
  
 Thanks for letting us know the status, I am glad it is working! 
  
 Any more questions please feel free to let me know. 
  
 Thanks. 
  
 Yale