ColorNodes Collection
The ColorNodes collection contains all of the nodes in a given ColorMap.
The following table provides the properties of the ColorNodes collection:
Property |
Description |
Returns the application object. It is a read-only property. |
|
Returns the number of nodes in the collection. It is a read-only property. |
|
Returns the parent object. It is a read-only property. |
The following table provides the methods of the ColorNodes collection:
Method |
Description |
Adds a new node to the collection. |
|
Remove all nodes from the collection. |
|
Returns an individual node. |
|
Removes an existing node from the collection. |
Remarks
The ColorNodes collection acts as an asynchronous copy of the node set. All changes applied to nodes in the collection remain cached until the cached collection is reassigned to the object. See Example 2 below.
Example 1
The following script demonstrates how the ColorNodes collection is used in reference to the ColorMap 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 color relief map and assigns the map coordinate system to the
'variable named "MapFrame"
Set MapFrame = Shapes.AddColorReliefMap(GridFileName:=SurferApp.Path+"\Samples\demogrid.grd")
'Declares ColorReliefLayer as an object
Dim ColorReliefLayer As Object
'Assigns the color relief map properties to the variable named "ColorReliefLayer"
Set ColorReliefLayer = MapFrame.Overlays(1)
'Declares ColorMap as an object
Dim ColorMap As Object
'Assigns the color spectrum properties to the variable named
'"ColorMap"
Set ColorMap = ColorReliefLayer.ColorMap
'Declares ColorNodes as an object
Dim ColorNodes As Object
'Assigns the color nodes collection to the variable named
'"ColorNodes"
Set ColorNodes = ColorMap.ColorNodes
End Sub
Example 2
The following line demonstrates how the ColorNodes collection in the active document is updated after changes are made to the collection.
'Updates the color map in Surfer with the cached nodes
collection
ColorMap.ColorNodes = ColorNodes