# Restriction Layer Bug?

**URL:** <https://community.thinkgeo.com/t/restriction-layer-bug/503>\
**Category:** WinForms\
**Created:** [June 24, 2009, 8:02pm UTC](https://community.thinkgeo.com/t/restriction-layer-bug/503 "2009-06-24T20:02:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clint1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/f6c823/32.png) [@Clint1](https://community.thinkgeo.com/u/Clint1)\
**Post date:** [June 24, 2009, 8:02pm UTC](https://community.thinkgeo.com/t/restriction-layer-bug/503/1 "2009-06-24T20:02:34Z")

</div>

HI,&nbsp;I'm&nbsp;using&nbsp;the&nbsp;latest&nbsp;public&nbsp;version&nbsp;of&nbsp;the&nbsp;Desktop&nbsp;Edition&nbsp;RC&nbsp;and&nbsp;I&nbsp;think&nbsp;there&nbsp;may&nbsp;be&nbsp;a&nbsp;bug&nbsp;with&nbsp;the&nbsp;restriction&nbsp;layer.

What&nbsp;I'm&nbsp;doing&nbsp;is&nbsp;creating&nbsp;a&nbsp;RestrictionLayer&nbsp;and&nbsp;adding&nbsp;it&nbsp;as&nbsp;the&nbsp;last&nbsp;layer&nbsp;in&nbsp;the&nbsp;Overlay&nbsp;that&nbsp;holds&nbsp;all&nbsp;my&nbsp;layers&nbsp;(World&nbsp;map&nbsp;Kit).&nbsp;&nbsp;The&nbsp;RestrictionLayer&nbsp;covers&nbsp;up&nbsp;most&nbsp;of&nbsp;the&nbsp;stuff,&nbsp;but&nbsp;once&nbsp;I&nbsp;zoom&nbsp;in&nbsp;around&nbsp;the&nbsp;border&nbsp;of&nbsp;the&nbsp;RestrictionLayer&nbsp;I&nbsp;can&nbsp;see&nbsp;the&nbsp;labels&nbsp;for&nbsp;the&nbsp;cities&nbsp;and&nbsp;roads.&nbsp;&nbsp;It&nbsp;looks&nbsp;like&nbsp;the&nbsp;labels&nbsp;aren't&nbsp;being&nbsp;covered&nbsp;up&nbsp;by&nbsp;the&nbsp;restriction&nbsp;layer&nbsp;and&nbsp;they&nbsp;drawing&nbsp;on&nbsp;top.&nbsp;&nbsp;I&nbsp;think&nbsp;I&nbsp;can&nbsp;work&nbsp;around&nbsp;it&nbsp;by&nbsp;adding&nbsp;the&nbsp;RestrictionLayer&nbsp;to&nbsp;a&nbsp;new&nbsp;overlay,&nbsp;but&nbsp;I&nbsp;really&nbsp;don't&nbsp;want&nbsp;to&nbsp;do&nbsp;this&nbsp;unless&nbsp;I&nbsp;have&nbsp;too.

Thanks

&nbsp;

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [June 24, 2009, 9:27pm UTC](https://community.thinkgeo.com/t/restriction-layer-bug/503/2 "2009-06-24T21:27:34Z")

</div>

Clint,&nbsp;

Thanks&nbsp;for&nbsp;your&nbsp;report!&nbsp;We&nbsp;can&nbsp;create&nbsp;the&nbsp;problem&nbsp;as&nbsp;you&nbsp;said&nbsp;very&nbsp;easily!  
&nbsp;  
Currently,&nbsp;in&nbsp;our&nbsp;drawing&nbsp;logic,&nbsp;we&nbsp;will&nbsp;always&nbsp;draw&nbsp;the&nbsp;label&nbsp;at&nbsp;the&nbsp;top&nbsp;of&nbsp;each&nbsp;overlay,&nbsp;so&nbsp;there&nbsp;is&nbsp;2&nbsp;ways&nbsp;to&nbsp;go&nbsp;around&nbsp;this&nbsp;problem&nbsp;without&nbsp;changing&nbsp;anything&nbsp;in&nbsp;MapSuite&nbsp;component.  
&nbsp;  
1)&nbsp;As&nbsp;you&nbsp;said,&nbsp;put&nbsp;it&nbsp;to&nbsp;another&nbsp;Overlay.  
&nbsp;  
2)&nbsp;Put&nbsp;it&nbsp;into&nbsp;one&nbsp;overlay,&nbsp;but&nbsp;need&nbsp;to&nbsp;create&nbsp;a&nbsp;special&nbsp;RestrictionAreaStyle,&nbsp;Following&nbsp;is&nbsp;the&nbsp;sample&nbsp;code&nbsp;you&nbsp;can&nbsp;follow.  
`//Create a RestricitonAreaStyle and Override the DrawCore.    public class RestrictionAreaStyle : AreaStyle    {        public RestrictionAreaStyle()            :base()        {         }        public RestrictionAreaStyle(GeoPen outlinePen)            : base(outlinePen)        {         }        public RestrictionAreaStyle(GeoSolidBrush fillSolidBrush)            :base(fillSolidBrush)        {        }        public RestrictionAreaStyle(GeoPen outlinePen, GeoSolidBrush fillSolidBrush)            : base(outlinePen, fillSolidBrush)        {         }        public RestrictionAreaStyle(GeoPen outlinePen, GeoSolidBrush fillSolidBrush, PenBrushDrawingOrder penBrushDrawingOrder)            : base(outlinePen, fillSolidBrush, penBrushDrawingOrder)        {         }        protected override void DrawCore(IEnumerable<Feature> features, GeoCanvas canvas, System.Collections.ObjectModel.Collection<SimpleCandidate> labelsInThisLayer, System.Collections.ObjectModel.Collection<SimpleCandidate> labelsInAllLayers)        {            if (canvas.CurrentWorldExtent.Width == 0) { return; }            foreach (Feature feature in features)            {                WellKnownType shapeWellKnownType = feature.GetWellKnownType();                if (shapeWellKnownType != WellKnownType.Polygon && shapeWellKnownType != WellKnownType.Multipolygon)                {                    continue;                }                canvas.DrawArea(feature, OutlinePen, Advanced.FillCustomBrush, DrawingLevel.LabelLevel, XOffsetInPixel, YOffsetInPixel, PenBrushDrawingOrder);            }        }//Use the Created Restriction Style for the RestrictionLayer.GeoPen geoPen = new GeoPen(GeoColor.StandardColors.Transparent, 0);            geoPen.DashStyle = LineDashStyle.Solid;            GeoHatchBrush brush = new GeoHatchBrush(GeoHatchStyle.Percent80, GeoColor.StandardColors.LightGray, GeoColor.StandardColors.Black);            RestrictionAreaStyle areaStyle = new RestrictionAreaStyle();            areaStyle.Advanced.FillCustomBrush = brush;            areaStyle.OutlinePen = geoPen;            restrictionLayer.CustomStyles.Add(areaStyle);`

Any&nbsp;more&nbsp;questions&nbsp;just&nbsp;let&nbsp;me&nbsp;know.

Thanks.  
&nbsp;  
Yale
