ThinkGeo.com    |     Documentation    |     Premium Support

TrackOverlay question

What is the purpose of the TrackOverlay.


I have though about using it on several occasions but it doesn't behave as I would expect.  For instance, I want to draw a line on the display and use that line to process data.  This works OK, but if I want to clear the line and draw another line, the original never goes away.  I can call TrackOverlay.TrackShapeLayer.InternalFeatures.Clear, but if I set the track mode to Line again, the original line reappears and drawing continues from the last point entered.


The only way around this behavior is using MapWindow.TrackOverlay = new TrackInteractiveOverlay();


I know that I can create my own interactive overlay, but then I am abandoning a built in tool in MapSuite.  I want to understand the tool in this case.  Is the behavior described above by design, and if so what is the functionality addressed by the design?


Charles



Charles,


Have you tried wrapping the line where you clear your feature collection with the Lock.EnterWriteLock / ExitWriteLock code?  An example:


MapWindow.TrackOverlay.Lock.EnterWriteLock();


try  


{


     MapWindow.TrackOverlay.TrackShapeLayer.InternalFeature.Clear();


}


finally

{


     MapWindow.TrackOverlay.Lock.ExitWriteLock();

}


This should clear any previous track shapes from the map.


 



Chad, thanks for your sharing! 
  
 Charles, did you try the idea from Chad, which would probably fix your problem! 
  
 In version 3.0.362, we use the lock system to discard the cached tiles, if not, it would use the cached tiles instead of redraw it. 
  
 Any more questions please feel free to let me know. 
  
 Thanks. 
  
 Yale