2.2.4.24 Layer


Name

Layer

Remark

The Layer class provides methods and properties common to all internal Origin layers. All Origin pages (windows) except note pages contain one or more layers.

Origin objects found "on" a page are generally contained by layers which are themselves contained by the page. Origin layers may contain many different graph objects thus the Layer class contains a collection of all the graph objects in the layer.

An Origin C Layer object is a wrapper object that is a reference to an internal Origin layer object. Origin C wrapper objects do not actually exist in Origin and merely refer to the internal Origin object. Consequently, multiple Origin C wrapper objects can refer to the same internal Origin object.

The Layer class is derived from the OriginObject class from which it inherits methods and properties.

Hierarchy

Examples

EX1

int Layer_ex1()
{
    // Call this function with a graph layer active
    // 
    // Declare a layer object and point to currently active layer
    Layer ly = Project.ActiveLayer();
    if( ly.IsValid() )
    {
        // Get and report name of page containing this layer
        Page pg = ly.GetPage();
        printf( "Active layer is contained in page: %s\n", pg.GetName() );
        
        // If page is a graph page... 
        if( EXIST_PLOT == pg.GetType() )
        {
            // List the name of all graph objects in the layer
            GraphObject gobj;
            foreach( gobj in ly.GraphObjects )
                printf( "   Graph object: %s\n", gobj.GetName() );
            return 0;
        }
        else
            return 1;
    }
    else
    {
        out_str( "Invalid layer object\n" );
        return 2;
    }
}

Header to Include

origin.h

Reference

Members

Name Brief Example
CreateGraphObject Create a specified type graph object. Examples
CreateShapeGraphObjects Create multiple polyline, polygon or polypolygon graph objects in the layer and put them into different blocks. Examples
CreateLinkTable Insert a table object. Examples
Delete Delete one layer. Examples
Detach Detach the internal Origin layer from the layer object. Examples
GetCreationIndex Get the creation index from a layer. The creation index will keep unchange for a page. Examples
GetIndex Get the index of the Layer in the parent page (0 offset). Note: In version 7, the index was based on 1-offset. In versions 7.5 and later, the index is based on 0-offset. Examples
GetImageData Get the data (gray scale levels) of a bitmap graphic object. Examples
GetNameDisplayText Return the name property to show for sheets. Examples
GetPage Get the parent Page object that contains the layer. Examples
GetPosition Get Layer area. Examples
GetSpecialGraphicObjectsCollection Returns the collection of only those with the given prefix. Examples
GetSystemParam Get the layer's internal info. Examples
InsertGraph Add GraphPageBase as a GraphObject to Graph/Worksheet/Matrix. Examples
InsertWks Add Worksheet as a GraphObject to Graph. Examples
Layer 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. Examples
LoadTemplate Load template by template name Examples
LT_execute Execute LabTalk script with a specific layer as the active layer. This method is equivalent to the LabTalk commands "win -o" and "layer -o". Examples
LT_evaluate Evaluate an expression with a specific layer as the active layer. Examples
LT_set_var Set LabTalk variable value with a specific layer as the active layer. Examples
LT_get_var Get LabTalk variable value with a specific layer as the active layer. Examples
LT_set_str Set LabTalk string variable with a specific layer as the active layer. Examples
LT_get_str Get LabTalk string variable with a specific layer as the active layer. Examples
MakeLineProfile It computes profile of the image or matrix, including, possibly, averaging over a moving window around a point, and the standard deviation withing the window. Examples
MakePixelProfile It computes a one pixel of the image or matrix, including, possibly, averaging over neignboring pixels, and the standard deviation of the neighborhood. Examples
PageToWorld Converts the page (i.e. paper, logical) coordinates into the world (i.e. axis scale) coordinates. Examples
PasteImage Paste image as a GraphObject which from clipboard into layer Examples
PathsObjectsManagement Loading an SVG file into a matrix layer (sheet) and associate it with one matrix object. It can individually associate Paths object (a graphic object obtained from loading an SVG) by index with a matrix object. Examples
RemoveGraphObject Remove specified GraphObject from layer. The object is referred to by index. Examples
SetPosition Set Layer area [and units]. Examples
UnitsConvert Layer position coordinates convert. Examples
ViewToWorld Convert logical to world coordinates. Examples
WorldToView Convert world to logical coordinates. Examples
WorldToPage Converts the world (i.e. axis scale) coordinates into the page (i.e. paper, logical) coordinates. Examples

Property

Name Brief Example
GraphObjects Collection of all GraphObjects in the layer. Examples