# Layers are not refreshed properly in RC1

**URL:** <https://community.thinkgeo.com/t/layers-are-not-refreshed-properly-in-rc1/435>\
**Category:** WinForms\
**Created:** [May 27, 2009, 1:08pm UTC](https://community.thinkgeo.com/t/layers-are-not-refreshed-properly-in-rc1/435 "2009-05-27T13:08:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rose](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@Rose](https://community.thinkgeo.com/u/Rose)\
**Post date:** [May 27, 2009, 1:08pm UTC](https://community.thinkgeo.com/t/layers-are-not-refreshed-properly-in-rc1/435/1 "2009-05-27T13:08:05Z")

</div>

HI,

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

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

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

I&nbsp;used&nbsp;to&nbsp;set&nbsp;the&nbsp;full&nbsp;extent&nbsp;using&nbsp;following&nbsp;code:

&nbsp;

&nbsp;Map1.currentExtnet=Me.GetBoundingBox(Map1.StaticOverlay.Layers)

StaticOverlay&nbsp;is&nbsp;obsolete,&nbsp;what&nbsp;should&nbsp;I&nbsp;use&nbsp;now?

Rose

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![David](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@David](https://community.thinkgeo.com/u/David)\
**Post date:** [May 27, 2009, 7:11pm UTC](https://community.thinkgeo.com/t/layers-are-not-refreshed-properly-in-rc1/435/2 "2009-05-27T19:11:31Z")

</div>

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