Table of Contents

Class RestrictionLayer

Namespace
ThinkGeo.Core
Assembly
ThinkGeo.Core.dll

This layer can show or hide one or many zones that you want to restrict from being displayed. You can use the specified style to decorate the zones and set the lower/upper scale to control at which zoom levels you want to show or hide the zones. The default decoration style is a hatch pattern. You can change this to a circle with slash image, or, if you want a different look, you can use custom styles.

public class RestrictionLayer : Layer
Inheritance
RestrictionLayer
Inherited Members

Examples

RestrictionLayer restrictionLayer = new RestrictionLayer();
RectangleShape africaZone = new RectangleShape(-17.67, 37.01, 60.02, -34.68)
restrictionLayer.Zones.Add(africaZone);
restrictionLayer.RestrictionMode = RestrictionMode.ShowZones;
restrictionLayer.UpperScale = 250000000;
restrictionLayer.LowerScale = double.MinValue;

...
// You can see only Africa because we have added a RestrictionLayer and its mode is ShowZones.
restrictionLayer.RestrictionMode = RestrictionMode.ShowZones;

...
// You can not see Africa because we have added a RestrictionLayer and its mode is HideZones.
restrictionLayer.RestrictionMode = RestrictionMode.HideZones;
Dim restrictionLayer As RestrictionLayer =  New RestrictionLayer()
RectangleShape africaZone = New RectangleShape(-17.67, 37.01, 60.02, -34.68)
restrictionLayer.Zones.Add(africaZone)
restrictionLayer.RestrictionMode = RestrictionMode.ShowZones
restrictionLayer.UpperScale = 250000000
restrictionLayer.LowerScale = Double.MinValue

...
' You can see only Africa because we have added a RestrictionLayer and its mode is ShowZones.
restrictionLayer.RestrictionMode = RestrictionMode.ShowZones

...
' You can not see Africa because we have added a RestrictionLayer and its mode is HideZones.
restrictionLayer.RestrictionMode = RestrictionMode.HideZones

Constructors

RestrictionLayer()

Initializes a new instance of the RestictionLayer class.

public RestrictionLayer()

RestrictionLayer(IEnumerable<AreaBaseShape>)

Initializes a new instance of the RestictionLayer class for the specified zones.

public RestrictionLayer(IEnumerable<AreaBaseShape> zones)

Parameters

zones IEnumerable<AreaBaseShape>

RestrictionLayer(IEnumerable<AreaBaseShape>, RestrictionMode)

Initializes a new instance of the RestictionLayer class for the specified zones and restriction mode.

public RestrictionLayer(IEnumerable<AreaBaseShape> zones, RestrictionMode zonesToShowOrHide)

Parameters

zones IEnumerable<AreaBaseShape>
zonesToShowOrHide RestrictionMode

RestrictionLayer(IEnumerable<AreaBaseShape>, RestrictionMode, double, double)

Initializes a new instance of the RestictionLayer class for the specified zones, restriction mode, upper scale and lower scale.

public RestrictionLayer(IEnumerable<AreaBaseShape> zones, RestrictionMode zonesToShowOrHide, double upperScale, double lowerScale)

Parameters

zones IEnumerable<AreaBaseShape>
zonesToShowOrHide RestrictionMode
upperScale double
lowerScale double

Properties

CustomStyles

Allows you to add custom styles to decorate restriction zones. In this case, you must set RestrictionStyle to UseCustomStyles as well.

public GeoCollection<Style> CustomStyles { get; }

Property Value

GeoCollection<Style>

LowerScale

Specifies the lower threshold of the layer.

public double LowerScale { get; set; }

Property Value

double

Remarks

If Restriction mode is ShowZones:

If currentScale is less than LowerScale, it will hide the whole map; otherwise, it will show the specified zones.

If Restriction mode is HideZones:

if currentScale is less than or equal to UpperScale and greater than or equal to LowerScale, it will hide the specified zones; otherwise it will do nothing.

RestrictionMode

Specifies whether you want to show or hide zones.

public RestrictionMode RestrictionMode { get; set; }

Property Value

RestrictionMode

RestrictionStyle

Specifies the display style of the restriction zones.

public RestrictionStyle RestrictionStyle { get; set; }

Property Value

RestrictionStyle

UpperScale

Specifies the upper threshold of the layer.

public double UpperScale { get; set; }

Property Value

double

Remarks

If Restriction mode is ShowZones:

If currentScale is greater than UpperScale, it will hide the whole map; otherwise, it will show the specified zones.

If Restriction mode is HideZones:

If currentScale is less than or equal to UpperScale and greater than or equal to LowerScale, it will hide the specified zones; otherwise, it will do nothing.

Zones

Specifies the areas you want to restrict.

public GeoCollection<AreaBaseShape> Zones { get; }

Property Value

GeoCollection<AreaBaseShape>

Methods

DrawCore(GeoCanvas, Collection<SimpleCandidate>)

This method draws the Layer.

protected override void DrawCore(GeoCanvas canvas, Collection<SimpleCandidate> labelsInAllLayers)

Parameters

canvas GeoCanvas

This parameter is the view object or a NativeImage to draw on.

labelsInAllLayers Collection<SimpleCandidate>

This parameter represents the labels used for collision detection and duplication checking.

Remarks

This abstract method is called from the concrete public method Draw. This method draws the representation of the layer based on the extent you provided.

When implementing this abstract method, consider each feature and its column data values. You can use the full power of the GeoCanvas to do the drawing. If you need column data for a feature, be sure to override the GetRequiredColumnNamesCore and add the columns you need to the collection. In many of the styles, we add properties to allow the user to specify which field they need; then, in the GetRequiredColumnNamesCore, we read that property and add it to the collection.

GetBoundingBoxCore()

This method returns the bounding box of the zones.

protected override RectangleShape GetBoundingBoxCore()

Returns

RectangleShape

This method returns the bounding box of the zones.

Remarks

This method returns the bounding box of the zones.

Exceptions

InvalidOperationException

In the event you attempt to call this method on a layer which has not been opened, it will throw an InvalidOperationException.