ThinkGeo.com    |     Documentation    |     Premium Support

InteraciveResult.InteractiveOverlayDrawType

Greetings,


I was wondering if you could explain the InteractiveOverlayDrawType parameter of an InteractiveResult.  I was assuming that it would return if the specific layer needed to draw, however I have run into cases where when I have InteractiveOverlayDrawType.DoNotDraw set, some of my other layers do not draw, but as soon as I change it to InteractiveOverlayDrawType.Draw, everything renders normally.  Also, when you set it to InteractiveOverlayDrawType.Draw, do you still have to call a refresh on the map for that overlay?


Thanks for your help,


Ryan



Ryan, 
  
 Your assuming is right, just one thing is not very exact. It will do nothing to ignore the DoNotDraw, will call the private-refresh if detect it’s the Draw. The private-refresh is not the public-Refresh method which you can access, the public-Refresh checks if invoke required or not at first, and then clear the screen bitmap tile caches for all overlays, then find which overlays’ data have changed, then clear the all caches for these overlays, finally call private-refresh.  About Refresh method, it’s tough to explain the detail of processes for a few words, and it’s private so I can not tell you more. 
  
 Please let me know if you have more questions. 
  
 Thanks 
 James 


Ryan, 
  
   I think James is a little too close to the internal details. :-)  Let me see if i can explain a little better from an outside perspective. 
  
   The InteractiveResult is where you tell is if your InteractiveOverlay needs to be drawn.  For example if you have an InteractiveOverlay that shows an icon and allows you to change the image if you click on it.  In this case you would put some code in the MapMouseClickCore method and when it fired you would check if the user clicked on your icon.  If they did not then you can use the default which is not to draw.  Internally we keep an image cached of the current viewable area so if you say DoNotDraw we re-use the cached image.  If the user did click on your icon then you would change the style or whatever and then use the Draw result.  This will cause us to throw away our cached image and re-render your Overlay.  I am 99% sure this is the way it works.  If you see something different let me know.  I can work up a code community project to explain it better and have some samples. 
  
 David

David,


If I return InteractiveOverlayDrawType.Draw as my result, will I have to call Refresh() somewhere to get it to draw?  I'm running into an issue where I am returning Draw however the DrawCore code is never getting called unless I call the Refresh method.  Thanks.


Ryan



Ryan, 
  
   You know I think I remember there was a bug related to this that we had not yet fixed.  If memory serves me you need to do something like in the method call Lock.IsDirty = true and that with the Draw result should make it so you do not need to call the refresh.  Try that and let me know, if not I will get to the bottom of that. 
  
 David

Ryan, 
  
 I guess that you add your own interactive overlay to winformsMap1.InteractiveOverlays collection, otherwise we can not guarantee it work properly. 
 Set InteractiveOverlayDrawType to Draw can tell our drawing system that this interactive overlay need to draw, but the precondition is that the previous interactive overlay should tell the drawing system “process other overlays” from ProcessOtherOverlaysMode. So if the previous overlay sets it to DoNotProcessOtherOverlays, your overlay won’t be draw if the index is behind. 
  
 So you can adjust the index of your overlay in collection until it works. 
  
 Please let me know if you have more questions. 
  
 Thanks 
 James 


Setting Lock.IsDirty = true solved my problem.  Thank you for your help!


.Ryan.



Ryan, 
  
 I am glad it’s working with you. 
  
 I apologize that we don’t have enough document, samples and something else which can instruct the users how to use interactive overlay, the interactive overlay is more complicated than the normal overlay, for example, the layer overlay is working like this way, the users just need to add layers with the correct style and zoom level. But you know, we provide three interactive overlays by default, they can make your map dynamically and interactively, if you can create your own one that will could be making amazing effect, but you need to deal with a lot of difficult stuff such as interaction arguments,  interactive result… etc. 
  
 We will think about this thing and try to provide more samples on the code community that can help the users get start with it. 
  
 Let me know if you have more questions about interactive overlay. 
  
 Thanks 
 James