MatrixObject::MatrixObject

Description

Default constructor


Construct a MatrixObject from an existing MatrixLayer


Construct a MatrixObject based on a string


Copy constructor -- refers to the same internal object as colOriginal


It constructs the MatrixObject from the name of a dataset. The dataset must be attached to a matrix, or this construction will produce invalid MatrixObject.

Syntax

MatrixObject( )

MatrixObject( MatrixLayer & mLayer, UINT nObjectIndex )

MatrixObject( LPCTSTR MatrixName, UINT nObjectIndex )

MatrixObject( DataObject & OriginalObj )

MatrixObject( LPCSTR lpcszDatasetName )

Parameters

mLayer
[input] MatrixLayer object which contains one or more matrix objects
nObjectIndex
[input] Index of one of the matrix layers in the MatrixLayer
Presently only zero is supported, as a Matrix can have only one layer

MatrixName
[input] name of the MatrixLayer object
nObjectIndex
[input] Index of one of the matrix objects in the MatrixLayer object.
Presently only zero is supported, as a MatrixLayer can have only one object

OriginalObj
[input] an object of DataObject which is a base class for MatrixObject

lpcszDatasetName
[input] name of the Data set.

Return

Examples

EX1

//Default constructor
void    MatrixObject_MatrixObject_Ex1()
{
    MatrixObject    mobj;
    MatrixLayer        mlay = Project.ActiveLayer();
    if( mlay )
    {
        mobj = mlay.MatrixObjects(0);
        if( mobj )
        {
            mobj.SetSize(480,640);
            printf("Matrix is now %u Columns by %u Rows\n", mobj.GetNumCols(), mobj.GetNumRows());
        }
    }
    else
        printf("The active layer is not a matrix.\n");
}


EX2

// Assuming a Matrix window exists, you can construct a MatrixObject from its layer
// Matrix window should be the active window
void    MatrixObject_MatrixObject_Ex2()
{
    MatrixLayer ml = Project.ActiveLayer();
    MatrixObject moMy(ml, 0);
    if(moMy)
        out_str("Matrix active");
    else
        out_str("Matrix not active");
}


EX3

// Construct a MatrixObject from a window name
// Assumes that a matrix named Matrix1 exists in the project
void    MatrixObject_MatrixObject_Ex3()
{
    MatrixObject moMy("MBook1", 0);
    if(moMy)
        out_str("matrix1 exists");
    else
        out_str("matrix1 doesn't exist!");
}


EX4

//Copy constructor 
void    MatrixObject_MatrixObject_Ex4()
{
    MatrixPage mp = Project.MatrixPages(0);
    if(!mp)
        return;
    
    MatrixObject moMy1(mp.GetName(), 0);
    MatrixObject moMy2(moMy1); //Copy constructor 
}


EX5

//It constructs the MatrixObject from the name of a dataset
void    MatrixObject_MatrixObject_Ex5()
{
    MatrixObject    mobj("MBook1");
    if (!mobj)
    {
        out_str("The matrix object is invalid!");
    }
}

Remark

See Also

header to Include

origin.h