ThinkGeo.com    |     Documentation    |     Premium Support

Layers are not refreshed properly in RC1

HI,


I have a PostgreFeature Layer, and selected a subset data from it, added the selected data in InMemoryFeatureLayer, and created a thematic map for the InMemoryFeatureLayer, everything worked very well in previous release.


But after upgrade to RC1, when I zoom in/zoom out, the PostgreFeature Layer sometimes is visible, sometimes not. It seems there is a problem in the Refresh() method.


BTW, is there any high level document to explain what is InteractiveOverlay, TrackOverlay, EditOverlay,DynamicOverlay, CustomOverlay, backgroundOverlay, LayerOverlay, ExtentOverlay.....Very confusing compared with previous versions!


I used to set the full extent using following code:


 


 Map1.currentExtnet=Me.GetBoundingBox(Map1.StaticOverlay.Layers)


StaticOverlay is obsolete, what should I use now?


Rose


 


 


 



Rose, 
  
   A couple of questions all wrapped up in one.  Let me try and address them. 
  
 1.The static and dynamic Overlays were replaced by just a Overlays collection on the map. Map.Overlays is all you need.  The reason for this is that people wanted more control over refreshing just one dynamic overlay at a time.  Once we introduced that the concept of dynamic overlays refreshing at once really didn’t make sense anymore.  People also got confused with the CustomOverlays and where the come in order to the static and dynamic.  No we just have one big bucket and you refresh overlays one at a time.  So just add the static overlays ot the Overlays collection first then your dynamic ones. 
  
 2.The second question is about your InMemeoryFeatureLayer and that it doesn’t always show correctly.  I think this is because you are not using the new Lock.EnterWriteLock and Lock.ExitWriteLock.  Whenever you change anything on an overlay you need to wrap that change in these locks.  The ExitWriteOverlay is a cue to our system that when you refresh we need to dump the local cache we built up and render thing fresh.  If you add the locking and refresh after it I think everything will works as it did before but faster as you pan and zoom around.  If you don’t use the locks then we think you never changed things and we wil continue to us the old cache and you will never see any change no matter how you change the overlay.  I go into more detail about this in your post on the EnterWriteLock. 
  
 3.You can still set the current extent the same way the ExtentOverlay handles things like the track zoom, double click zoom, mouse wheel zoom etc.  See below. 
  
 4. We will explain all of the overlays I the video I am producing.  In a nutshell here is the lay of the land. 
  
 StaticOverlay, DynamicOverlay, CustomOverlays – These are all being removed in the next version and are obsolete.  They are being replace with just a single collection called Overlays.  The reason is that one collection is more flexible and less confusing.  Of course it is confusing now to you as we have all of them.  This is because we are still in beta and need the old ones to help you transition.  Once we go to release we will not break compatibility and we will leave these kinds of issues behind.  We want to make sure we get it right though before we freeze it. 
  
 InteractiveOverlays – This is a collection of IntereactiveOverlays, no surprise there.  InteractiveOverlay  is a new kind of Overlay inherited from Overlay and its job is to interact with the client.  It has a number of methods like MouseClick, MouseDoubleClick, MouseMove etc to handle input.  What we did in this version is we created a number of these InteractiveOverlays to handle all of the user input.  We created an ExtentIntereactiveOverlay, this handles the double click zoom in, panning, track zoom in, mouse wheel etc.  We created a TrackInteractiveOverlay that deals with drawing track shapes.  We created a EditInteractiveOverlay that deal with editing of shapes.  Here is the real power of the InteractiveOverlays collection.  All of the overlays I mentioned like the Extent, Track and Edit are all in the InteractiveOverlays collection in a certain order.  When a mouse click is done we loop through the collection and call the MouseClick method on that overlay.  That overlay has the chance to respond to the event or ignore it.  If it ignores it the event is then passed to the next one.  If it responds to the event then the event is no longer passed up the chain.  What this does is it allows us to have thing like editing and panning work at the same time.  If the user mouse downs over a edit node then the edit ways takes over that event.  If not then it passes it along until it gets to the Extent overlay and it handles it as a pan.  In this way you can easily create your own IntereactiveOverlay to meld into our existing system.  You place the overlay in the collection at the proper place to get the effect you want.  This also means you can easily replace our extent, track or editing system with your own easily. 
  
 The properties on the map like EditOverlay, TrackOverlay are just properties that index into the IntereactiveOverlays collection.  Imagine inside of the get method you would see “return this.IntereactiveOverlays[“EditOverlay”]”  It is just a handy way to find the EditOverlay without having to go into the collection. 
  
 David