ApplySymbologyUniqueValues

The ApplySymbologyUniqueValues method sets line, fill, and/or symbol properties for the features of the symbology's unique values in the VectorBaseLayer object. Using this method, features that do not have an attribute value in the layer may be displayed.

Syntax

object. ApplySymbologyUniqueValues( AttributeField, ShowMissingValues, SortMethod, AddAll, AddValues, LineColorMethod, LineColor, LineOpacity, FillColorMethod, FillColor, FillOpacity, SymbolLineMethod, SymbolLineColor, SymbolLineOpacity, SymbolFillMethod, SymbolFillColor, SymbolFillOpacity )

Parameter

Type

Default

Description

AttributeField

String

 

required

ShowMissingValues

Boolean

True

optional

SortMethod

SrfSymUniqVSortMethod

attribute type

optional

AddAll

Boolean

True

optional; adds all available attributes from the specified AttributeField

AddValues

String

Empty

optional; if AddAll is false then default is Empty

LineColorMethod

SrfSymUniqVColorMethod

srfSymUniqVColorAsIs

optional

LineColor

SrfColor

 

optional

LineOpacity

Double

 

optional

FillColorMethod

SrfSymUniqVColorMethod

srfSymUniqVColorAsIs

optional

FillColor

SrfColor

 

optional

FillOpacity

Double

 

optional

SymbolLineMethod

SrfSymUniqVColorMethod

srfSymUniqVColorAsIs

optional

SymbolLineColor

SrfColor

 

optional

SymbolLineOpacity

Double

 

optional

SymbolFillMethod

SrfSymUniqVColorMethod

srfSymUniqVColorAsIs

optional

SymbolFillColor

SrfColor

 

optional

SymbolFillOpacity

Double

 

optional

Example 1

This example shows how to show symbology with unique values in the legend.

Dim Surfer As Object

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

Surfer.Visible = True

 

' Create symbology using unique values

Set doc = Surfer.Documents.Add

Set map = doc.Shapes.AddDataBaseMap(ImportFileName:=Surfer.Path+"\samples\NV_LasVegasValley_2010_000379.laz", ImportOptions:="AcceptNthPoint=1000")

Set layer = map.Overlays.Item(1)

 

layer.ApplySymbologyUniqueValues(AttributeField:="Column D", SortMethod:=srfSymUniqVSortNumeric)

layer.ShowLegend = True

Example 2

This example shows how to add unique symbology with specific attributes to the vector base layer.

Dim Surfer As Object

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

Surfer.Visible = True

 

' Create symbology using unique values and only add some specific attributes

Set doc = Surfer.Documents.Add

Set map = doc.Shapes.AddDataBaseMap(ImportFileName:=Surfer.Path+"\samples\WellLocations.dat")

Set layer = map.Overlays.Item(1)

 

Dim well_ids(4) As String

well_ids(0) = "MW-5" : well_ids(1) = "MW-6" : well_ids(2) = "MW-7" : well_ids(3) = "MW-8" : well_ids(4) = "MW-9"

 

' Set the line to invisible and the fill color to blue (we'll change a few specifics to red below)

layer.ApplySymbologyUniqueValues(AttributeField:="ID", AddAll:=False, AddValues:=well_ids, SymbolLineColorMethod:=srfSymUniqVColorFixed

, SymbolLineOpacity:=0, SymbolFillColorMethod:=srfSymUniqVColorFixed

, SymbolFillColor:=srfColorBlue)

layer.ShowLegend = True

 

' Update some symbol properties for the unique values

Set uvs = layer.SymbologyUniqueValues

For Each uv In uvs

Debug.Print uv.Value + " changing to solid circle"

uv.Symbol.Index = 12

Next

 

' Change MW-7 to be all red

uvs.Item("MW-7").Symbol.FillColorRGBA.Color = srfColorRed

uvs.Item("MW-7").Line.ForeColorRGBA.Color = srfColorRed

uvs.Item("MW-7").Fill.ForeColorRGBA.Color = srfColorRed

 

' Add all the possible values back instead and apply the same colormap to symbol line/fill

layer.ApplySymbologyUniqueValues(AttributeField:="ID")

layer.SymbologyColorMap(Type:=srfSymCMUnCSymbolLine).LoadPreset("Green-Red")

layer.SymbologyColorMap(Type:=srfSymCMUnCSymbolFill).LoadPreset("Green-Red")

Used by: VectorBaseLayer object

See Also

Legend

PostLayer Object

Symbology

Vector Base Layer