ClassedPostLayer Object

The ClassedPostLayer object contains the properties and methods for a classed post map created in Surfer with the Shapes method AddClassedPostLayer or AddClassedPostMap.

Derived from: Layer object, which is derived from Shape object (All methods and properties of Layer and Shape apply to this object.)

The following table provides the properties of the ClassedPostLayer object:

Property

Description

BinCount

Returns the number of data values in this bin. It is a read-only property

BinFillColorMap

Returns the color map object used for all of the bins' symbol fill colors.

BinLineColorMap

Returns the color map object used for all of the bins' symbol line colors.

BinLowerLimit

Returns the lower limit of the specified bin. It is a read-only property.

BinName

Returns/sets the name of the class at the specified bin.

BinningMethod

Returns/sets the binning method.

BinPercent

Returns the percentage of data in this bin. It is a read-only property.

BinSymbol

Returns the symbol format object for the specified bin. It is a read-only property.

BinSymbolSizeMax

Returns/sets the maximum bin symbol size.  It is a read-only property.

BinSymbolSizeMin

Returns/sets the minimum bin symbol size. It is a read-only property.

BinUpperLimit

Returns the upper limit of the specified bin. It is a read-only property.

DataFile

Returns/sets the name of the data file used to create the map.

FirstRow

Returns/sets the first row to use from the worksheet.

LabCol

Returns/sets the column containing the labels (0 if none).

LabelAngle

Returns/sets the label angle in degrees.

LabelFont

Returns the label font format object. It is a read-only property.

LabelFormat

Returns the label format object. It is a read-only property.

LabelLine

Returns the line format object for the label lines. It is a read-only property.

LabelLineLength

Returns/sets the label line length in page units.

LabelPlane

Returns/sets the label plane.

LabelPos

Returns/sets the label position method.

LabelXOffset

Returns/sets the label position offset in the X direction (page units).

LabelYOffset

Returns/sets the label position offset in the Y direction (page units).

LastRow

Returns/sets the last row to use from the worksheet.

Legend

Returns the legend object if enabled. It is a read-only property.

NumClasses

Returns/Sets the number of classes.

Opacity

Returns/sets the opacity.

ShowLegend

Returns/sets the show legend state.

SymAngle

Returns/sets the symbol angle in degrees.

SymFrequency

Returns/sets the symbol frequency.

xCol

Returns/sets the column containing the X coordinates (1-based).

yCol

Returns/sets the column containing the Y coordinates (1-based).

zCol

Returns/sets the column containing the Z coordinates (1-based).

The following table provides the methods of the ClassedPostLayer object:

Method

Description

ApplyBinFillColorMap

Applies BinFillColorMap to all the bins' symbols.

ApplyBinLineColorMap

Applies BinLineColorMap to all the bins' symbols.

LoadClasses

Loads a CLS class file.

SaveClasses

Saves a CLS class file.

SetBinLimits

Sets the lower and upper limits of each bin (2 elements per bin).

SetBinSymbols

Sets the symbol set and symbol for all bins' symbols.

SetBinSymbolsFillUniform

Sets the symbol fill color and opacity for all bins.

SetBinSymbolsLineUniform

Sets the symbol line color and opacity for all bins.

SetInputData

Sets the input data file and columns. The SetInputData2 method should be used instead of this method when the worksheet being loaded is an Excel file where the sheet name needs to be specified.

SetInputData2

Sets the input data file and columns. It can also be used to specify any data import options when loading a data file.

Example 1

The following script demonstrates how the ClassedPostLayer object 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 classed post map and assigns the map coordinate system

'to the variable named "MapFrame"

Set MapFrame = Shapes.AddClassedPostMap(DataFileName:=SurferApp.Path+"\Samples\demogrid.dat")

 

'Declares ClassedPostLayer as an object

Dim ClassedPostLayer As Object

 

'Assigns the classed post map properties to the variable named

'"ClassedPostLayer"

Set ClassedPostLayer = MapFrame.Overlays(1)

 

End Sub

Example 2

The following script demonstrates how to change the name of a bin and the characteristics of the symbols within the bin.

Dim Surfer As Object

Set Surfer = GetObject(,"Surfer.Application")

 

Surfer.Visible = True

 

Set Doc = Surfer.Documents.Add

Set Map = Doc.Shapes.AddClassedPostMap2(Surfer.Path + "\Samples\Demogrid.dat")

Set ClassLayer = Map.Overlays.Item(1)

 

'print the 3rd bin's original name, update this bin's name, and then print updated value

Debug.Print ClassLayer.BinName(3)

ClassLayer.BinName(3) = "New name"

Debug.Print ClassLayer.BinName(3)

 

'print the original max and min symbol size values

Debug.Print ClassLayer.BinSymbolSizeMin

Debug.Print ClassLayer.BinSymbolSizeMax

 

'update the max and min symbol size values

ClassLayer.BinSymbolSizeMin = 0.2

ClassLayer.BinSymbolSizeMax = 1.4

 

'print the updated max and min symbol size values

Debug.Print ClassLayer.BinSymbolSizeMin

Debug.Print ClassLayer.BinSymbolSizeMax

 

'get the BinLineColorMap and load it with the Rainbow preset

Set LineCM = ClassLayer.BinLineColorMap

LineCM.LoadPreset("Rainbow")

 

'apply the BinLineColorMap object to the classed post map

ClassLayer.ApplyBinLineColorMap()

 

'get the BinFillColorMap and load it with the Blues preset

Set FillCM = ClassLayer.BinFillColorMap

FillCM.LoadPreset("Blues")

 

'apply the BinFillColorMap object to the classed post map

ClassLayer.ApplyBinFillColorMap()

 

'set the bin symbols' symbol to the 'Number 10' of the GSI Default Symbols set

ClassLayer.SetBinSymbols(10)

 

'save the current classes to a CLS file ("classes.cls")

ClassLayer.SaveClasses("C:\Users\David\Downloads\classes.cls")

 

'create a new classed post map to load the classes that were just saved

Set Doc2 = Surfer.Documents.Add

Set Map2 = Doc2.Shapes.AddClassedPostMap2(Surfer.Path + "\Samples\Demogrid.dat")

Set ClassLayer2 = Map2.Overlays.Item(1)

 

'load the classes that were just saved on line 46

ClassLayer2.LoadClasses("C:\Users\David\Downloads\classes.cls")

 

'set all bins' symbols' lines to green with 85% opacity

ClassLayer2.SetBinSymbolsLineUniform(srfColorGreen, 85)

 

'set all bins' symbols' fills to blue with 49% opacity

ClassLayer2.SetBinSymbolsFillUniform(srfColorBlue, 49)

 

'set the bin symbols' symbol to the 'Number 3' of the Arial Black set

ClassLayer2.SetBinSymbols(3, "Arial Black")

 

End Sub

Example 3

The following script demonstrates how to add symbols and a legend with specific properties to a classed post map.

Sub Main

'Declare the variable that will reference the application

Dim SurferApp As Object

Set SurferApp = GetObject(, "Surfer.Application")

SurferApp.Visible = True

Debug.Clear

Debug.Print SurferApp.Version

 

Dim Plot2 As Object

Set Plot2 = SurferApp.Documents.Add

 

'Adds a classed post map

Set MapFrame2 = Plot2.Shapes.AddClassedPostMap(DataFileName:=SurferApp.Path+"\Samples\demogrid.dat", xCol:= 1, yCol:=2, zCol:=3, LabCol:=3)

Dim ClassedPostLayer2 As Object

Set ClassedPostLayer2 = MapFrame2.Overlays(1)

ClassedPostLayer2.NumClasses = 6

ClassedPostLayer2.BinName(2) = "Testing Name"

 

'Sets symbol properties

ClassedPostLayer2.BinSymbolSizeMin = 0.1

ClassedPostLayer2.BinSymbolSizemax = 0.75

ClassedPostLayer2.SetBinSymbols (6)

 

'Sets symbol fill/line color

ClassedPostLayer2.BinLineColorMap.LoadPreset ("BrightYellow-Red")

ClassedPostLayer2.ApplyBinLineColorMap

ClassedPostLayer2.BinFillColorMap.LoadFile(SurferApp.Path+"\samples\rainbow.clr")

ClassedPostLayer2.ApplyBinFillColorMap

ClassedPostLayer2.SaveClasses ("C:\users\kari\downloads\Classes_SRF-3848.cls")

 

'Add Legend

Set Legend = Plot2.AddLegend

Set CPLegendLayer = Legend.LegendLayers.Item(1)

CPLegendLayer.Template = "\symbol \name (\lower to \upper)"

ClassedPostLayer2.SetBinSymbolsLineUniform(srfColorMagenta, 95)

ClassedPostLayer2.SetBinSymbolsFillUniform(srfColorBlue, 55)

 

End Sub