Layer::Layer

Description

Default constructor which constructs an unattached Layer object. Once the object refers to a physical layer in Origin, the member function IsValid() of the base class OriginObject can be used to determine if the object is valid.


Copy constructor which constructs a Layer object from an existing Layer object. The member function IsValid() of the base class OriginObject can be used to determine if the object is valid (attached to an internal Origin layer object)

Syntax

Layer( )

Layer( Layer & layer )

Parameters

layer
[input] the source Layer object

Return

Examples

EX1

//Show the usage of default constructor.
int Layer_Layer_ex1()
{
    Layer ly;//Default constructor.
    // Point to the currently active layer
    ly = Project.ActiveLayer();
    // Check validity
    if( ly.IsValid() )
    {
        out_str( "Object is valid" );
        return 0;
    }
    else
    {
        out_str( "Object is not valid" );
        return 1;
    }
}


EX2

//Output the index of the graph layers.
void Layer_Layer_ex2()
{
    // Declare layer object ly1 and point to the currently active layer
    Layer ly1 = Project.ActiveLayer();
    if( ly1.IsValid() )
    {
        // Report the index of this layer
        printf( "Index of ly1 is: %d\n", ly1.GetIndex() );
        // Declare layer object ly2 as a copy of ly1    
        Layer ly2( ly1 );
        // Now ly2 and ly1 are pointing to the same object
        printf( "Index of ly2 is: %d\n", ly2.GetIndex() );
    }
    else
        out_str( "Invalid layer object" );                
}

Remark

See Also

header to Include

origin.h