2.2.4.17.24 GraphLayer::GraphLayer

Description

Construct and attach a GraphLayer object based on the name of the graph window and the layer index


Copy constructor which constructs a GraphLayer object from an existing Layer object. Note that the existing Layer object must also be in a garph page.

Syntax

GraphLayer( LPCSTR lpcszWinName, int nLayerNum = -1 )


GraphLayer( Layer & layer )

Parameters

lpcszWinName
the name of the graph window (page)
nLayerNum
(optional) 0-offset index of the layer (use <0
for the active layer)


layer
[input] the source Layer object

Return

Examples

EX1

// For this example to run, a graph window must exist in the project.
// Make sure that the window has at least two layers.
// Make layer 2 active before running the function.
void    GraphLayer_GraphLayer_ex1()
{
    // Construct a GraphLayer object and attach it to the second layer of the current window.
    // (note that in the constructor the layer index is 0-offset, so the
    // first layer needs index 0)
    GraphLayer        gl(Project.GraphPages(0).GetName(), 1);
    
    // Display the index of the layer in graph page
    // (note that the index returned from the "GetIndex" method
    // is 0-offset, so the first layer will have index 0):
    out_int("Layer index = ", gl.GetIndex() + 1);
}


EX2

// For this example to run, a graph window must exist in the project.
// Make sure that the window has at least two layers.
// Make layer 2 active before running the function.
void    GraphLayer_Constructor_ex2()
{
    // Construct a GraphLayer object and attach it to the second layer of the current window.
    // (note that in the constructor the layer index is 0-offset, so the
    // first layer needs index 0)
    GraphLayer        gl(Project.GraphPages(0).GetName(), 1);
    
    GraphLayer        gl2(gl);
    
    // Display the index of the layer in graph page
    // (note that the index returned from the "GetIndex" method
    // is 1-offset, so the first layer will have index 1):
    out_int("Layer index = ", gl2.GetIndex());
}

Remark

See Also

Header to Include

origin.h