Overlays Collection

The Overlays collection is a collection of map layers (also called overlays) which are Shape objects. It contains all maps in the MapFrame. If maps are combined in a composite map, then multiple Overlay objects can exist. For example, assume one post map and one contour map are combined in a composite map. The result is one map frame with two overlays (contour map and post map).

The following table provides the properties of the Overlays collection:

Property

Description

Application

Returns the application object. It is a read-only property

Count

Returns the number of overlays. It is a read-only property.

Parent

Returns the parent object. It is a read-only property.

The following table provides the methods of the Overlays collection:

Method

Description

BreakApart

Break apart the specified overlay into a stand-alone map.

Item*

Returns an individual overlay.

SetZOrder

Moves the specified overlay forward or backward in the drawing order.

*default method

Example

The following script demonstrates how the Overlays collection is used in reference to the MapFrame object.

Sub Main

 

'Declares SurferApp as an object

Dim SurferApp As Object

 

'Creates an instance of the Surfer Application object and assigns it to

'the variable named "SurferApp"

Set SurferApp = CreateObject("Surfer.Application")

 

'Makes Surfer visible

SurferApp.Visible = True

 

'Declares Plot as an object

Dim Plot As Object

 

'Creates a plot document in Surfer and assigns it to the variable named

'"Plot"

Set Plot = SurferApp.Documents.Add(srfDocPlot)

 

'Declares Shapes as an object

Dim Shapes As Object

 

'Assigns the Shapes collection to the variable named "Shapes"

Set Shapes = Plot.Shapes

 

'Declares MapFrame as an object

Dim MapFrame As Object

 

'Creates a contour map and assigns the map coordinate system to the

'variable named "MapFrame"

Set MapFrame = Shapes.AddContourMap(GridFileName:=SurferApp.Path+"\Samples\demogrid.grd")

 

'Declares Overlays as an object

Dim Overlays As Object

 

'Assigns the Overlays collection to the variable named "Overlays"

Set Overlays = MapFrame.Overlays

 

End Sub