Table of Contents

Class GroupLayer

Namespace
ThinkGeo.Core
Assembly
ThinkGeo.Core.dll

This class represents a Layer backed by a group of layers.

public class GroupLayer : Layer
Inheritance
GroupLayer
Inherited Members

Remarks

None

Constructors

GroupLayer()

This is the default constructor for the class.

public GroupLayer()

Remarks

This is the default constructor. If you use this constructor, then you need to set the required properties manually.

GroupLayer(IEnumerable<Layer>)

This is a constructor for the class.

public GroupLayer(IEnumerable<Layer> layers)

Parameters

layers IEnumerable<Layer>

This parameter represents the layers in this class that you want to use.

Remarks

This constructor gets the layer ready to use.

Properties

HasBoundingBox

This property checks to see if a Layer has a BoundingBox or not. If it has no BoundingBox, it will throw an exception when you call the GetBoundingBox() and GetFullExtent() APIs. In GroupLayer, we override this API and mark it as true.

public override bool HasBoundingBox { get; }

Property Value

bool

Remarks

The default implementation in the base class returns false.

Layers

This property gets the layers you want to use.

public GeoCollection<Layer> Layers { get; }

Property Value

GeoCollection<Layer>

Remarks

This property gets the layers you want to use.

Methods

CloseCore()

This method closes the FeatureSource and releases any resources it was using.

protected override void CloseCore()

Remarks

This abstract method is called from the concrete public method Close. The close method plays an important role in the life cycle of the Layer. It may be called after drawing to release any memory and other resources that were allocated since the Open method was called.

If you override the Core version of this method, it is recommended that you take the following things into account: This method may be called multiple times, so we suggest you write the method so that that a call to a closed Layer is ignored and does not generate an error. We also suggest that in the Close you free all resources that have been opened. Remember that the object will not be destroyed, but will be re-opened possibly in the near future.

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 are 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 Layer.

protected override RectangleShape GetBoundingBoxCore()

Returns

RectangleShape

This method returns the bounding box of the Layer.

Remarks

This method returns the bounding box of the Layer.

Exceptions

InvalidOperationException

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

OpenCore()

This method opens the Layer so that it is initialized and ready to use.

protected override void OpenCore()

Remarks

This abstract method is called from the concrete public method Open. The open method plays an important role, as it is responsible for initializing the Layer. Most methods on the Layer will throw an exception if the state of the Layer is not opened. When the map draws each layer, it will open the layer as one of its first steps; then, after it is finished drawing with that layer, it will close it. In this way, we are sure to release all resources used by the Layer.

When implementing the abstract method, consider opening the FeatureSource or RasterSource. You will get a chance to close these in the Close method of the Layer.

Exceptions

InvalidOperationException

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